pax_global_header00006660000000000000000000000064137706461570014532gustar00rootroot0000000000000052 comment=d88c60cea9ef2db7e53a27126c9cf2db7d75efa3 babel-7.12.12/000077500000000000000000000000001377064615700127515ustar00rootroot00000000000000babel-7.12.12/.circleci/000077500000000000000000000000001377064615700146045ustar00rootroot00000000000000babel-7.12.12/.circleci/config.yml000066400000000000000000000200411377064615700165710ustar00rootroot00000000000000version: 2.1 aliases: - &restore-yarn-cache key: v2-yarn-cache-{{ checksum "yarn.lock" }} - &save-yarn-cache paths: - ~/.yarn/berry/cache key: v2-yarn-cache-{{ checksum "yarn.lock" }} - &artifact_babel path: ~/babel/packages/babel-standalone/babel.js - &artifact_babel_min path: ~/babel/packages/babel-standalone/babel.min.js - &test262_workdir working_directory: ~/babel/babel-test262-runner - &artifact_test262_tap path: ~/test262.tap - &artifact_test262_xunit path: ~/test-results - &artifact_test262_diff_tap path: ~/diff.tap executors: node-executor: docker: - image: cimg/node:current working_directory: ~/babel # e2e-vue-cli test requires chromium node-browsers-executor: docker: - image: cimg/node:current-browsers working_directory: ~/babel # e2e-jest test requires python node-python-executor: docker: - image: cimg/python:3.9-node working_directory: ~/babel jobs: build-standalone: executor: node-executor steps: - checkout - restore_cache: *restore-yarn-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 - save_cache: *save-yarn-cache test262: executor: node-executor steps: - checkout - run: name: Sync with latest main branch (only on PRs) command: | if [ -n "$CIRCLE_PULL_REQUEST" ] then # $CIRCLE_PR_NUMBER is not always defined: # https://support.circleci.com/hc/en-us/articles/360047521451-Why-is-CIRCLE-PR-NUMBER-empty- git fetch origin refs/pull/${CIRCLE_PULL_REQUEST##*/}/merge git checkout -qf FETCH_HEAD fi - restore_cache: *restore-yarn-cache - run: name: Build Babel command: BABEL_ENV=test make bootstrap - run: name: Setup Test Runner command: | git clone --depth=1 --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 main branch Test262 artifact command: node lib/download-main-artifact ~/test262-main.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 main branch & current job results command: | mkdir -p ~/test-results/test262 node lib/compare-results ~/test262-main.tap ~/test262.tap | tee ~/diff.tap <<: *test262_workdir - store_artifacts: *artifact_test262_diff_tap - run: name: Output comparison 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-yarn-cache publish-verdaccio: executor: node-executor steps: - checkout - restore_cache: *restore-yarn-cache - run: ./scripts/integration-tests/publish-local.sh - persist_to_workspace: root: /tmp/verdaccio-workspace paths: - storage - htpasswd - save_cache: *save-yarn-cache publish-verdaccio-babel-8-breaking: executor: node-executor steps: - checkout - restore_cache: *restore-yarn-cache - run: BABEL_8_BREAKING=true ./scripts/integration-tests/publish-local.sh - persist_to_workspace: root: /tmp/verdaccio-workspace paths: - storage - htpasswd - save_cache: *save-yarn-cache 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: # vue-cli uses puppeteer, and it depends on the libXss.so.1 shared library name: Install Headless Chrome dependencies command: sudo apt-get install -yq libxss1 - run: ./scripts/integration-tests/e2e-vue-cli.sh e2e-jest: executor: node-python-executor steps: - checkout - attach_workspace: at: /tmp/verdaccio-workspace - run: ./scripts/integration-tests/e2e-jest.sh workflows: version: 2 build-standalone: jobs: - build-standalone test262: jobs: - test262: filters: branches: only: - main - next-8-dev - next-8-rebased context: babel-test262 test262-pr: jobs: - approve-test262-run: type: approval filters: branches: ignore: - main - master - next-8-dev - next-8-rebased - test262: requires: - approve-test262-run filters: branches: ignore: - main - master - next-8-dev - next-8-rebased context: babel-test262 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 - e2e-jest: requires: - publish-verdaccio e2e-breaking: jobs: - publish-verdaccio-babel-8-breaking: filters: branches: only: [main, next-8-dev, next-8-rebased] - e2e-babel: requires: - publish-verdaccio-babel-8-breaking - e2e-create-react-app: requires: - publish-verdaccio-babel-8-breaking - e2e-vue-cli: requires: - publish-verdaccio-babel-8-breaking - e2e-jest: requires: - publish-verdaccio-babel-8-breaking e2e-breaking-pr: jobs: - approve-e2e-breaking-run: type: approval filters: branches: ignore: [main, next-8-dev, next-8-rebased] - publish-verdaccio-babel-8-breaking: requires: - approve-e2e-breaking-run - e2e-babel: requires: - publish-verdaccio-babel-8-breaking - e2e-create-react-app: requires: - publish-verdaccio-babel-8-breaking - e2e-vue-cli: requires: - publish-verdaccio-babel-8-breaking - e2e-jest: requires: - publish-verdaccio-babel-8-breaking babel-7.12.12/.codesandbox/000077500000000000000000000000001377064615700153205ustar00rootroot00000000000000babel-7.12.12/.codesandbox/ci.json000066400000000000000000000001531377064615700166050ustar00rootroot00000000000000{ "buildCommand": "codesandbox:build", "sandboxes": ["7s08o", "vhm64"], "packages": ["packages/*"] } babel-7.12.12/.editorconfig000066400000000000000000000003741377064615700154320ustar00rootroot00000000000000root = true [*] insert_final_newline = true charset = utf-8 trim_trailing_whitespace = true end_of_line = lf [*.{js,json,ts,tsx}] indent_style = space indent_size = 2 [Makefile] indent_style = tab [*.{md,markdown}] trim_trailing_whitespace = false babel-7.12.12/.eslintignore000066400000000000000000000012741377064615700154600ustar00rootroot00000000000000/lib /build /.git package.json lerna.json packages/babel-runtime !packages/babel-plugin-transform-runtime/scripts packages/babel-runtime-corejs2 packages/babel-runtime-corejs3 packages/*/node_modules packages/*/lib packages/*/dist packages/*/test/fixtures packages/*/test/tmp codemods/*/node_modules codemods/*/lib codemods/*/dist codemods/*/test/fixtures codemods/*/test/tmp packages/babel-compat-data/build packages/babel-preset-env/data/[^(plugin-features|shipped-proposals).js] packages/babel-preset-env/test/debug-fixtures packages/babel-standalone/babel.js packages/babel-standalone/babel.min.js packages/babel-parser/test/expressions eslint/*/lib eslint/*/node_modules eslint/*/test/fixtures babel-7.12.12/.eslintrc.js000066400000000000000000000043661377064615700152210ustar00rootroot00000000000000"use strict"; const path = require("path"); module.exports = { root: true, plugins: [ "import", "jest", "prettier", "@babel/development", "@babel/development-internal", ], extends: "@babel/internal", rules: { "prettier/prettier": "error", }, env: { node: true, }, overrides: [ { files: ["**/*.ts"], parser: "@typescript-eslint/parser", plugins: ["@typescript-eslint"], rules: { "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error", "no-dupe-class-members": "off", "@typescript-eslint/no-dupe-class-members": "error", "no-undef": "off", "no-redeclare": "off", }, }, { files: [ "packages/*/src/**/*.{js,ts}", "codemods/*/src/**/*.{js,ts}", "eslint/*/src/**/*.{js,ts}", ], 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.{ts,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,ts}"], excludedFiles: ["packages/babel-plugin-transform-regenerator/**/*.js"], rules: { "@babel/development/plugin-name": "error", eqeqeq: ["error", "always", { null: "ignore" }], }, }, { files: ["packages/babel-parser/src/**/*.{js,ts}"], rules: { "@babel/development-internal/dry-error-messages": [ "error", { errorModule: path.resolve( __dirname, "packages/babel-parser/src/parser/error.js" ), }, ], }, }, ], }; babel-7.12.12/.flowconfig000066400000000000000000000020471377064615700151120ustar00rootroot00000000000000[ignore] /build/.* /packages/.*/lib /packages/.*/test /codemods/.*/lib /codemods/.*/test /node_modules/module-deps/ [include] packages/*/src codemods/*/src [libs] lib/file.js lib/parser.js lib/third-party-libs.js.flow lib/preset-modules.js.flow packages/babel-types/lib/index.js.flow lib/babel-packages.js.flow [options] include_warnings=true suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe suppress_comment= \\(.\\|\n\\)*\\$FlowIssue 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' ; Todo: can not make it works, 🤷‍♂️ ; module.name_mapper='^@babel/plugin-syntax-import-meta$' -> '/packages/babel-standalone/node_modules/@babel/plugin-syntax-import-meta/lib/index' module.ignore_non_literal_requires=true babel-7.12.12/.git-blame-ignore-revs000066400000000000000000000005561377064615700170570ustar00rootroot00000000000000# git-blame ignored revisions # To configure, run # git config blame.ignoreRevsFile .git-blame-ignore-revs # Requires Git > 2.23 # See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt # Use prettier (#600) 5180ecdca48e486b4b0f347fcbd752f865df5e55 # Update prettier to v2 (#11579) 41085248560b1403b8d0f99f108491e679531c6c babel-7.12.12/.gitattributes000066400000000000000000000000161377064615700156410ustar00rootroot00000000000000* text eol=lf babel-7.12.12/.github/000077500000000000000000000000001377064615700143115ustar00rootroot00000000000000babel-7.12.12/.github/CHANGELO-preset-env-v0-v1.md000066400000000000000000000553531377064615700207630ustar00rootroot00000000000000# Changelog ## v1.6.1 (2017-10-17) ### :bug: Bug Fix - Update compat table to fix two small issues ([#445](https://github.com/babel/babel-preset-env/pull/445)) (@danez) ES2015 destructuring is not fully supported in Edge 15 and the polyfill required again. `es6.math.imul` is supported on Android as of version 4.4 - Add polyfills for ES6 static Object methods ([#441](https://github.com/babel/babel-preset-env/pull/441)) (@danez) Functions such as `Object.keys`, `Object.freeze`, ... do already exist in ES5, but their behaviour changed in ES2015. `babel-preset-env` with `builtIns: true` now adds the core-js polyfills for this methods if the browser only supports the ES5 variant of the method (like IE11 for example) - Normalize module format of plugins/built-ins data ([#376](https://github.com/babel/babel-preset-env/pull/376)) (@rtsao) ## v1.6.0 (2017-07-04) ### :rocket: New Feature - Bump compat-table for node8 support ([#363](https://github.com/babel/babel-preset-env/pull/363)) (@existentialism) We updated our mappings to support native trailing function commas and string paddings in Node.js 8+. ### :bug: Bug Fix - Handle `chromeandroid` browserslist value ([#367](https://github.com/babel/babel-preset-env/pull/367)) (@yavorsky) We added support for using browserslist's `chromeandroid` in `targets`. ### :memo: Documentation - Tweak uglify option docs ([#368](https://github.com/babel/babel-preset-env/pull/368)) (@existentialism) Thanks to @graingert and @pfiaux for pointing out some needed updates to the `uglify-js`-related docs. ## v1.5.2 (2017-06-07) ### :bug: Bug Fix - Ensure explicit targets always override browsers key targets ([#346](https://github.com/babel/babel-preset-env/pull/346)) (@existentialism) `browser` targets should be overridden by explicit targets, and we inadvertently broke this when we landed string version support. ## v1.5.1 (2017-05-22) ### :bug: Bug Fix - Compile with loose mode ([#322](https://github.com/babel/babel-preset-env/pull/332)) (@existentialism) ## v1.5.0 (2017-05-19) ### :rocket: New Feature - Support target versions as strings ([#321](https://github.com/babel/babel-preset-env/pull/321)) (@existentialism) We were originally waiting on 2.x for a breaking change, but since node v7.10 and other targets are causing some pain, we decided to land a backwards compatible version. ### :house: Internal - Backport: use preset-env and remove flow-strip-types ([#324](https://github.com/babel/babel-preset-env/pull/324)) (@yavorsky) - Bump electron-to-chromium ([#329](https://github.com/babel/babel-preset-env/pull/329)) (@existentialism) - Tweak version mappings to match compat-table updates ([#323](https://github.com/babel/babel-preset-env/pull/323)) (@existentialism) - Bump browserslist ([#319](https://github.com/babel/babel-preset-env/pull/319)) (@existentialism) - Bump compat-table ([#307](https://github.com/babel/babel-preset-env/pull/307)) (@existentialism) - Add debug-fixtures and test/tmp to .eslintignore ([#305](https://github.com/babel/babel-preset-env/pull/305)) (@yavorsky) ## v1.4.0 (2017-04-14) ### :rocket: New Feature - Support `spec` option ([#98](https://github.com/babel/babel-preset-env/pull/98)) (@Kovensky) Added an option to enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them. - Bump compat-table for Edge 15 support ([#273](https://github.com/babel/babel-preset-env/pull/273)) (@existentialism) We updated our mappings so that you can get native support for async/await and other goodies when targeting Edge 15! ### :bug: Bug Fix - Add Android browser to name map ([#270](https://github.com/babel/babel-preset-env/pull/270)) (@existentialism) Fixed a bug that was ignoring Android targets in browserslist queries (for example: "Android >= 4"). ### :memo: Documentation - Clarify note about loading polyfills only once ([#282](https://github.com/babel/babel-preset-env/pull/282)) (@darahak) - Add a reminder about include/exclude options ([#275](https://github.com/babel/babel-preset-env/pull/275)) (@existentialism) ### :house: Internal - Chore: reduce package size. ([#281](https://github.com/babel/babel-preset-env/pull/281)) (@evilebottnawi) - Remove deprecated comment ([#271](https://github.com/babel/babel-preset-env/pull/271)) (@yavorsky) ## v1.3.3 (2017-04-07) ### :bug: Bug Fix - Support electron version in a string format ([#252](https://github.com/babel/babel-preset-env/pull/252)) (@yavorsky) Adding electron as a target was an inadvertent breaking change as it no longer allowed string versions. We added an exception for now, even though it is inconsistent with other versions. Just as a note, the upcoming version 2.x will allow _both_ number and string versions. - Ensure const-check plugin order ([#257](https://github.com/babel/babel-preset-env/pull/257)) (@existentialism) We now force the `const-es2015-check` plugin to run first (so that it can correctly report issues before they get transpiled away). ### :rocket: New Feature - Allow use `babel-plugin-` prefix for include and exclude ([#242](https://github.com/babel/babel-preset-env/pull/242)) (@yavorsky) The `include` and `exclude` options now allow both prefixed (`babel-plugin-transform-es2015-spread`) and prefix-less (`transform-es2015-spread`) plugin names. ### :memo: Documentation - Note babel plugin prefix handling in include/exclude ([#245](https://github.com/babel/babel-preset-env/pull/245)) (@existentialism) - Fix README: debug option shows info in stdout. ([#236](https://github.com/babel/babel-preset-env/pull/236)) (@Gerhut) ### :house: Internal - Add simple smoke-test ([#240](https://github.com/babel/babel-preset-env/pull/240)) (@existentialism) - Add prepublish script (@existentialism) ## v1.3.2 (2017-03-30) - Fixed an issue with a broken publish ## v1.3.1 (2017-03-30) - Fixed a regression with missing files due to `.npmignore`. ## v1.3.0 (2017-03-30) ### :bug: Bug Fix - Add check for ArrayBuffer[Symbol.species] ([#233](https://github.com/babel/babel-preset-env/pull/233)) (@existentialism) We now properly check for `Symbol.species` support in ArrayBuffer and include the polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related errors on IE9. ### :nail_care: Polish - Fill data with electron as a target. ([#229](https://github.com/babel/babel-preset-env/pull/229)) (@yavorsky) We've simplified things by adding `electron` as a target instead of doing a bunch of things at runtime. Electron targets should now also be displayed in the debug output. - separate default builtins for platforms ([#226](https://github.com/babel/babel-preset-env/pull/226)) (@restrry) If you are targeting the `node` environment exclusively, the always-included web polyfills (like `dom.iterable`, and a few others) will now no longer be included. ### :memo: Documentation * remove deprecated projects ([#223](https://github.com/babel/babel-preset-env/pull/223)) [skip ci] (@stevemao) ### :house: Internal * npmignore: Add related to build data and codecov. ([#216](https://github.com/babel/babel-preset-env/pull/216)) (@yavorsky) ## v1.2.2 (2017-03-14) ### :bug: Bug Fix - Refactor browser data parsing to handle families ([#208](https://github.com/babel/babel-preset-env/pull/208)) (@existentialism) When parsing plugin data, we weren't properly handling browser families. This caused `transform-es2015-block-scoping` and other plugins to be incorrectly added for Edge >= 12. (s/o to @mgol for the the report and review!) - Add typed array methods to built-ins features. ([#198](https://github.com/babel/babel-preset-env/pull/198)) (@yavorsky) Fixes an issue where some TypedArray features were not being polyfilled properly. (s/o to @alippai for the report!) ### :memo: Documentation - Fixed minor typo in readme ([#199](https://github.com/babel/babel-preset-env/pull/199)) (@bl4ckdu5t) - Add built-ins, better links, compat-table url, etc ([#195](https://github.com/babel/babel-preset-env/pull/195)) (@yavorsky) - Change CONTRIBUTING.md to use absolute paths ([#194](https://github.com/babel/babel-preset-env/pull/194)) (@aaronang) ### :house: Internal - Bump plugins ([#201](https://github.com/babel/babel-preset-env/pull/201)) (@yavorsky) - Enable code coverage ([#200](https://github.com/babel/babel-preset-env/pull/200)) (@alxpy) - Increase mocha timeout to 10s ([#202](https://github.com/babel/babel-preset-env/pull/202)) (@yavorsky) ## v1.2.1 (2017-03-06) ### :bug: Bug Fix - Add transform-duplicate-keys mapping ([#192](https://github.com/babel/babel-preset-env/pull/192)) (@existentialism) Our plugin data was missing a mapping for the `transform-duplicate-keys` plugin which caused it to never be included. (s/o to @Timer for the report!) ### :memo: Documentation - Clarify reasons for the uglify option in README.md ([#188](https://github.com/babel/babel-preset-env/pull/188)) (@mikegreiling) ## v1.2.0 (2017-03-03) ### :rocket: New Feature - Add uglify as a target ([#178](https://github.com/babel/babel-preset-env/pull/178)) (@yavorsky) Support for `uglify` as a target is now available! This will enable all plugins and, as a result, fully compiles your code to ES5. Note, that useBuiltIns will work as before, and only the polyfills that your other target(s) need will be included. ```json { "presets": [ ["env", { "targets": { "chrome": 55, "uglify": true }, "useBuiltIns": true, "modules": false }] ] } ``` ### :bug: Bug Fix - Respect older versions in invert equals map ([#180](https://github.com/babel/babel-preset-env/pull/180)) (@danez) Fixes a number of bugs that caused some incorrect and/or missing environment data when parsing `compat-table`. ## v1.1.11 (2017-03-01) This release primarily upgrades `compat-table`, which adds support for async on Node 7.6! ### :bug: Bug Fix - Fix hasBeenWarned condition. ([#175](https://github.com/babel/babel-preset-env/pull/175)) (@yavorsky) ### :memo: Documentation - Add yarn example. ([#174](https://github.com/babel/babel-preset-env/pull/174)) (@yavorsky) ### :house: Internal - Bump compat-table ([#177](https://github.com/babel/babel-preset-env/pull/177)) (@existentialism) - Add electron version exception test ([#176](https://github.com/babel/babel-preset-env/pull/176)) (@existentialism) ## v1.1.10 (2017-02-24) ### :bug: Bug Fix - Drop use of lodash/intersection from checkDuplicateIncludeExcludes ([#173](https://github.com/babel/babel-preset-env/pull/173)) (@existentialism) ## v1.1.9 (2017-02-24) ### :bug: Bug Fix - Add tests for debug output ([#156](https://github.com/babel/babel-preset-env/pull/156)) (@existentialism) Since we've (mostly @yavorsky) have fixed a number of bugs recently with the `debug` option output, we added the ability to assert stdout matches what we expect. Read the updated [CONTRIBUTING.md](https://github.com/babel/experimental/babel-preset-env/blob/master/CONTRIBUTING.md#testing-the-debug-option) for more info. - Fixes #143. Log correct targets. ([#155](https://github.com/babel/babel-preset-env/pull/155)) (@yavorsky) This fixes a bug in the `debug` output where incorrect target(s) were being displayed for why a particular plugin/preset was being included. Given targets: ```txt { "firefox": 52, "node": 7.4 } ``` Before: ```txt Using plugins: transform-es2015-destructuring {"node":6.5} transform-es2015-for-of {"node":6.5} transform-es2015-function-name {"node":6.5} transform-es2015-literals {"node":4} transform-exponentiation-operator {"firefox":52} syntax-trailing-function-commas {"firefox":52} ``` After: ```txt Using plugins: transform-es2015-destructuring {"firefox":52} transform-es2015-for-of {"firefox":52} transform-es2015-function-name {"firefox":52} transform-es2015-literals {"firefox":52} transform-exponentiation-operator {"node":7.4} syntax-trailing-function-commas {"node":7.4} ``` ### :memo: Documentation - Fix compat-table link in contributing.md (@existentialism) - Update README examples to fix website ([#151](https://github.com/babel/babel-preset-env/pull/)) (@existentialism) - Fix few typos ([#146](https://github.com/babel/babel-preset-env/pull/146)) (@existentialism) - Add configuration example to clarify `debug: true` ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky) - Fix CHANGELOG’s v1.1.8 updates typo. ([#136](https://github.com/babel/babel-preset-env/pull/136)) (@yavorsky) - README: Update `debug: true` example. ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky) ### :house: Internal - update compat ([#169](https://github.com/babel/babel-preset-env/pull/169)) (@hzoo) - Use external Electron to Chromium library ([#144](https://github.com/babel/babel-preset-env/pull/144)) (@Kilian) - Update yarn lockfile ([#152](https://github.com/babel/babel-preset-env/pull/152)) (@existentialism) - Extract option normalization into independant file ([#125](https://github.com/babel/babel-preset-env/pull/125)) (@baer) - Update yarnfile ([#145](https://github.com/babel/babel-preset-env/pull/145)) (@baer) - devDeps: eslint-config-babel v5.0.0 ([#139](https://github.com/babel/babel-preset-env/pull/139)) (@kaicataldo) - Update compat-table, build data ([#135](https://github.com/babel/babel-preset-env/pull/135)) (@hzoo) ## v1.1.8 (2017-01-10) ### :bug: Bug Fix - Debug: Transformations before logs. ([#128](https://github.com/babel/babel-preset-env/pull/128)) (@yavorsky) Makes sure that all transformations on `targets` (such as `exclude`/`include`) are run before logging out with the `debug` option. Fixes ([#127](https://github.com/babel/babel-preset-env/issues/127)). ### :house: Internal - Remove unnecessary extension. ([#131](https://github.com/babel/babel-preset-env/pull/131)) (@roman-yakobnyuk) - Include yarn.lock and update CI. ([#124](https://github.com/babel/babel-preset-env/pull/124)) (@existentialism) ## v1.1.7 (2017-01-09) Had a publishing issue in the previous release. ## v1.1.6 (2017-01-06) ### :bug: Bug Fix - Explicitly resolve lowest browser version. ([#121](https://github.com/babel/babel-preset-env/pull/121)) (@brokenmass) ```js { "targets": { "browsers": ["ios >= 6"] // was resolving to {ios: 10} rather than {ios: 6} } } ``` ## v1.1.5 (2017-01-04) ### :bug: Bug Fix - Show error if target version is not a number. ([#107](https://github.com/babel/babel-preset-env/pull/107)) (@existentialism) ```js { "presets": [ ["env", { "targets": { "chrome": "52", // will error since it's not a number, "chrome": 52 // correct! } }] ] } ``` - Fix targets for the `debug` option. ([#109](https://github.com/babel/babel-preset-env/pull/109)) (@yavorsky) Now it prints the transformed targets/environments rather than the browsers query. ```txt Using targets: { "chrome": 53, "ie": 10, "node": 6 } Modules transform: false Using plugins: transform-es2015-arrow-functions {"chrome":47,"node":6} transform-es2015-block-scoped-functions {"chrome":41,"ie":11,"node":4} Using polyfills: es6.typed.uint8-clamped-array {"chrome":5,"node":0.12} es6.map {"chrome":51,"node":6.5} ``` ## v1.1.4 (2016-12-16) v1.1.2-v1.1.4 ### :bug: Bug Fix The new `exclude`/`include` options weren't working correctly for built-ins. ([#102](https://github.com/babel/babel-preset-env/pull/102)). Also fixes an issue with debug option. ## v1.1.1 (2016-12-13) ### :bug: Bug Fix Regression with the previous release due to using `Object.values` (ES2017). This wasn't caught because we are using babel-register to run tests and includes polyfills so it didn't fail on CI even though we have Node 0.10 as an env. Looking into fixing this to prevent future issues. ## v1.1.0 (2016-12-13) ### :rocket: New Feature - Add `exclude` option, rename `whitelist` to `include` ([#89](https://github.com/babel/babel-preset-env/pull/89)) (@hzoo) Example: ```js { "presets": [ ["env", { "targets": { "browsers": ["last 2 versions", "safari >= 7"] }, "include": ["transform-es2015-arrow-functions"], "exclude": [ "transform-regenerator", "transform-async-to-generator", "map" ], "useBuiltIns": true }] ] } ``` `"exclude": ["transform-regenerator"]` doesn't transform generators and removes `regeneratorRuntime` from being imported. `"exclude": ["transform-async-to-generator"]` doesn't use the built-in async-to-gen transform so you can use something like [fast-async](https://github.com/MatAtBread/fast-async). `"exclude": ["map"]` doesn't include the `Map` polyfill if you know you aren't using it in your code (w/ `useBuiltIns`). (We will figure out a way to automatically do this [#84](https://github.com/babel/babel-preset-env/issues/84)). If you pass a wrong plugin it will error: valid options for `include/exclude` are in [/data/plugin-features.js](https://github.com/babel/experimental/babel-preset-env/blob/master/data/plugin-features.js) and [/data/built-in-features.js](https://github.com/babel/experimental/babel-preset-env/blob/master/data/built-in-features.js) (without the `es6.`) ### :house: Internal - Optimize result filtration. ([#77](https://github.com/babel/babel-preset-env/pull/77)) (@yavorsky) - Update eslint config to align with other babel projects ([#79](https://github.com/babel/babel-preset-env/pull/79)) (@baer) - Update pathnames to avoid uppercase ([#80](https://github.com/babel/babel-preset-env/pull/80)) (@baer) - Refactor build data for clarity/consistency ([#81](https://github.com/babel/babel-preset-env/pull/81)) (@baer) - Update linting rules to cover all js ([#82](https://github.com/babel/babel-preset-env/pull/82)) (@baer) - Cleanup lib before rebuilding ([#87](https://github.com/babel/babel-preset-env/pull/87)) (@baer) - Move linting dependency to be dev only ([#88](https://github.com/babel/babel-preset-env/pull/88)) (@baer) ### :memo: Documentation - Fix typo ([#78](https://github.com/babel/babel-preset-env/pull/78)) (@rohmanhm) - Fix PR link in changelog. ([#75](https://github.com/babel/babel-preset-env/pull/75)) (@nhajidin) ## v1.0.2 (2016-12-10) ### :bug: Bug Fix * Fix issue with Object.getOwnPropertySymbols ([#71](https://github.com/babel/babel-preset-env/pull/71)) ([@existentialism](https://github.com/existentialism)) Was requiring the wrong module kinda of like in v1.0.1: https://github.com/zloirock/core-js#ecmascript-6-symbol ```diff -import "core-js/modules/es6.object.get-own-property-symbols"; ``` The test is just a part of `Symbol`. ## v1.0.1 (2016-12-10) ### :bug: Bug Fix * Fix regenerator import ([#68](https://github.com/babel/babel-preset-env/pull/68)) ([@hzoo](https://github.com/hzoo)) We were outputting an invalid path for `regenerator`! ```diff +import "regenerator-runtime/runtime"; -import "core-js/modules/regenerator-runtime/runtime"- ``` ## v1.0.0 (2016-12-09) ### :rocket: New Feature * Add `useBuiltIns` option ([#56](https://github.com/babel/babel-preset-env/pull/56)) ([@hzoo](https://github.com/hzoo)), ([@yavorsky](https://github.com/yavorsky)), ([@existentialism](https://github.com/existentialism)) A way to apply `babel-preset-env` for polyfills (via `"babel-polyfill"``). > This option will apply a new Babel plugin that replaces `require("babel-polyfill")` with the individual requires for `babel-polyfill` based on the target environments. Install ``` npm install babel-polyfill --save ``` In ```js import "babel-polyfill"; // create an entry js file that contains this // or import "core-js"; ``` Out (different based on environment) ```js // chrome 55 import "core-js/modules/es7.string.pad-start"; // haha left_pad import "core-js/modules/es7.string.pad-end"; import "core-js/modules/web.timers"; import "core-js/modules/web.immediate"; import "core-js/modules/web.dom.iterable"; ``` `.babelrc` Usage ```js { "presets": [ ["env", { "targets": { "electron": 1.4 }, "modules": false, // webpack 2 "useBuiltIns": true // new option }] ] } ``` > Also looking to make an easier integration point via Webpack with this method. Please reach out if you have ideas! --- * Support [Electron](http://electron.atom.io/) ([#55](https://github.com/babel/babel-preset-env/pull/55)) ([@paulcbetts](https://github.com/paulcbetts)) Electron is also an environment, so [Paul went ahead](https://twitter.com/paulcbetts/status/804507070103851008) and added support for this! `.babelrc` Usage ```js { "presets": [ ["env", {"targets": { "electron": 1.4 }}]] } ``` > Currently we are manually updating the data in [/data/electron-to-chromium.js](https://github.com/babel/experimental/babel-preset-env/blob/master/data/electron-to-chromium.js), but [@kevinsawicki](https://github.com/kevinsawicki) says we could generate the data from [atom-shell/dist/index.json](https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/index.json) as well! (Someone should make a PR :smile:) ## v0.0.9 (2016-11-24) ### :rocket: New Feature * Support Opera ([#48](https://github.com/babel/babel-preset-env/pull/48)) (Henry Zhu) Was as simple as modifying the chrome version and subtracting 13! (so chrome 54 = opera 41) ```js { "presets": [ ["env", { "targets": { "opera": 41 } }] ] } ``` ## v0.0.8 (2016-11-16) ### :nail_care: Polish * Only print the debug info once ([#46](https://github.com/babel/babel-preset-env/pull/46) (Henry Zhu) When using the `debug` option it was printing the data for each file processed rather than once. ```js { "presets": [ ["env", { "debug": true }] ] } ``` ## v0.0.7 (2016-11-02) ### :rocket: New Feature * hardcode a current node version option ([#35](https://github.com/babel/babel-preset-env/pull/35)) (Henry Zhu) ```js { "presets": [ ["env", { "targets": { "node": "current" // parseFloat(process.versions.node) } }] ] } ``` * add 'whitelist' option ([#31](https://github.com/babel/babel-preset-env/pull/31)) (Henry Zhu) ```js { "presets": [ ["env", { "targets": { "chrome": 52 }, "whitelist": ["transform-es2015-arrow-functions"] }] ] } ``` * Add more aliases (Henry Zhu) * Update plugin data: firefox 52 supports async/await! ([#29](https://github.com/babel/babel-preset-env/pull/29)) (Henry Zhu) ### :bug: Bug Fixes * Use compat-table equals option ([#36](https://github.com/babel/babel-preset-env/pull/36)) (Henry Zhu) Compute and use `compat-table` equivalents ```js { "safari6": "phantom", "chrome44": "iojs", "chrome50": "node64", "chrome51": "node65", "chrome54": "node7", "chrome30": "android44", "chrome37": "android50", "chrome39": "android51", "safari7": "ios7", "safari71_8": "ios8", "safari9": "ios9", "safari10": "ios10", "chrome50": "node6" } ``` * Change default behavior to act the same as babel-preset-latest ([#33](https://github.com/babel/babel-preset-env/pull/33)) (Henry Zhu) ```js { "presets": ["env"] } // should act the same as babel-preset-latest ``` ## Internal * Add fixture helper for tests ([#28](https://github.com/babel/babel-preset-env/pull/28)) (Henry Zhu) babel-7.12.12/.github/CHANGELOG-6to5.md000066400000000000000000001003541377064615700167200ustar00rootroot00000000000000# 6to5 Changelog ## 3.6.6 * **Internal** * Upgrade `core-js`. * **Bug Fix** * Fix temp variables not being properly pushed inside of `while` loops. * **New Feature** * Add `auxiliaryComment`/`--auxiliary-comment` option that prepends comments to auxiliary helpers. ## 3.6.5 * **Internal** * Upgrade `core-js`. * **Bug Fix** * Fix block scoping leaking variables in IIFE mode. * Fix tail call transformer exploding on return statements as the consequent of an if statement. * **New Feature** * Add `validation.react` transformer. ## 3.6.4 * **New Feature** * Add support for flow type casts and module types. ## 3.6.3 * **Internal** * Upgrade `acorn-6to5`. * Use `default` property on `6to5-runtime`. ## 3.6.2 * **Polish** * Use better iterator detection in `slicedToArray` helper and add support for it to the `selfContained` transformer. ## 3.6.1 * **Bug Fix** * Multiline JSX string literals are now supported. * Fix scope tracking import specifiers incorrectly. * Fix templates incorrectly recursing into their replacements. * **Internal** * Type inferrence now extends to function return types. * Upgrade `acorn-6to5`. ## 3.6.0 * **New Feature** * Add playground class property initializers. * **Polish** * Completely reimplemented scope tracking, can now track types and optimise certain helpers based on it. * Extremely fast tail recursion optimisation implementation. Thanks [@RReverser](https://github.com/RReverser)! * **Internal** * `kexec` has been removed as an optional dependency and must be user installed. * Upgrade `regenerator-6to5`. * Upgrade `acorn-6to5`. * Upgrade `core-js`. ## 3.5.3 * Enable `es6.tailCall` transformer with the first implementation that only works with self referencing calls until we can implement nested tail calls elegantly. ## 3.5.2 * Disable `es6.tailCall` temporairly after reports of it breaking. ## 3.5.1 * **Polish** * Allow tail calls to work across files without the runtime. * **Internal** * Upgrade `acorn-6to5`. ## 3.5.0 * **Bug Fix** * Destructuring patterns as the left operator in `ForInStatement`/`ForOfStatement`. * **Polish** * Make default parameter IIFE invocation smarter. * Make `__esModule` flag non-enumerable. Thanks [@daliwali](https://github.com/daliwali)! * **Internal** * More performance improvements. * Parsing is now ~30% faster thanks to [marijnh/acorn@7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f](https://github.com/marijnh/acorn/commit/7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f). * **New Feature** * Optional `es6.blockScopingTDZ` is now completely functional and handles all edge cases. * `super` in object literals. * Tail call optimisation. Thanks [@RReverser](https://github.com/RReverser)! ## 3.4.1 * **Bug Fix** * Fix conflicting `--module-ids` shorthand arg in `$ 6to5`. * Add require hook options to cache key. * Fix strict module formatter. ## 3.4.0 * **New Feature** * Add `commonStandard` module formatter. * **Bug Fix** * Fix conflicting `--module-ids` shorthand arg in `$ 6to5`. * **Internal** * Lots of internal refactoring with scope tracking and traversal. * **Polish** * Don't return `map` in the API result if `sourceMap` was set to `"inline"`. ## 3.3.12 * **Bug Fix** * Don't override `MemberExpression`s with `core-js` in `selfContained` if a local binding exists. ## 3.3.11 * **Bug Fix** * Fix the require cache. ## 3.3.10 * **Internal** * 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 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. * Join sibling string literals when creating JSX. ## 3.3.9 * **Bug Fix** * Fix super inside of functions. * Fix super constructor inheritance. ## 3.3.7 * **Bug Fix** * Add `--use-strict` to valid node flags in `6to5-node`. * Fix booleans not being properly stripped from the arguments in `6to5-node`. * Force `.js` extension when writing files to directories with `6to5`. ## 3.3.5 * **Bug Fix** * Fix block scoping inside of while loops. * Make module name regex more conservative. Thanks [@johlrich](https://github.com/johlrich)! * Fix block scoping of constants. * Fix istanbul interop. * Make JSX transforming more inline with the official transformer with spaces after non-empty last lines. * **Polish** * Make it illegal to export a property called `__esModule`. ## 3.3.4 * **Polish** * Add istanbul `require` interop. * **Bug Fix** * Fix incorrect source map column tracking in specific scenarios. ## 3.3.3 * **Polish** * Remap top level `this` to `undefined` instead of throwing an error. * **Bug Fix** * Run `selfContained` transformer over the regenerator runtime when building `6to5-runtime`. * Fix `t.isReferenced` not properly allowing `value` nodes. ## 3.3.1 * **Bug Fix** * Block hoist assignment pattern destructuring. ## 3.3.0 * **Bug Fix** * Do all transforms before the regenerator transform is ran. * **New Feature** * Added back the 2.x optional runtime. ## 3.2.1 * **Bug Fix** * Fix block scoping transformer rewriting breaks and continues to inner labels. ## 3.2.0 * **Bug Fix** * Fixed scope tracking for default parameters IIFE. * Fixed block scoped functions. * Improved `bin/6to5` path resolution. * **New Feature** * You can now trigger super setters in classes. Thanks [@kruppel](https://github.com/kruppel)! * Add `resolveSourceMap` option. * Better support and output for block scoping loops with labels. ## 3.1.1 * **Polish** * Drop `enumerable: false` clause from class method definitions as `enumerable` already defaults to `false`. * **Bug Fix** * Properly transform `XJSIdentifier` nodes referencing `this` into a `ThisExpression`. ## 3.1.0 * **Breaking Change** * [Make class methods unenumerable](https://esdiscuss.org/topic/classes-and-enumerability#content-61). ## 3.0.16 * **Bug Fix** * Don't ignore dynamic import specifiers. * **Internal** * Upgrade `regenerator-6to5`. * **Polish** * Use `Object.assign` in place of extends helper if it exists. * Require individual `lodash` methods. Thanks [@stefanpenner](https://github.com/stefanpenner)! ## 3.0.15 * **Bug Fix** * Use `debug/node` instead of `debug` to avoid browserify using the browser version that references `window`. ## 3.0.14 * **New Feature** * Add `--optional` argument to `6to5-node`. * **Bug Fix** * Fix bug in `asyncToGenerator` helper where it was incorrectly calling generator iterator functions. ## 3.0.13 * **Bug Fix** * Fix modules loose mode using `modules` instead of `es6.modules`. ## 3.0.12 * **Internal** * Add internal debug messages. * **Bug Fix** * Add `noScope` option to `traverse.clearProperties`. ## 3.0.11 * **Bug Fix** * Fix `ast-types` `RestElement` definition. * Make `es6.forOf` loose mode more versatile and support destructuring. ## 3.0.10 * **Bug Fix** * In `types.getIds` make sure the `declaration` inside of `ExportDeclaration` is actually a `Declaration`. ## 3.0.9 * **Bug Fix** * Make `t.isReferenced` more powerful, actually take into consideration all contexts were identifier nodes aren't actually references. * Don't camelcase underscores when converting a string to a valid identifier. ## 3.0.8 * **Bug Fix** * Split up default function declaration exports due to regenerator destroying the parent export declaration. ## 3.0.7 * **Internal** * Upgrade `core-js` to `0.4.9`. * **Bug Fix** * Add id to function express scope tracking. ## 3.0.6 * **Bug Fix** * Fix block scope variable tracking stopping whenever it hits a new scope. * Fix block scope variable tracking breaking on all block statement scopes that have a for loop parent. ## 3.0.5 * **Internal** * More reliable default parameter scope. ## 3.0.4 * **Bug Fix** * Remove traversal stops from block scope tracking. ## 3.0.3 * **Internal** * Ignore options starting with `_`. ## 3.0.2 * **Internal** * Add common plugin options to valid options list. ## 3.0.1 * **Internal** * Downgrade `kexec` as `1.1.0` throws compilation errors. ## 3.0.0 * **Polish** * Generated code autoindentation. * Moved global uid registry to a scope registry resulting in nicer uids. * `this` is now illegal in the top level scope when using the default `useStrict` transformer. * New `asyncToGenerator` helper that's much more compact. * Throw errors on unknown options. * More reliable default parameter scope. * Helpers are now compact and have no newlines. * **Internal** * Rewritten a lot of the internals to much simpler. * Removed TDZ from default parameters as it was very wonky and unreliable. * Upgrade `core-js` to `0.4.6`. * Upgrade `acorn-6to5`. * JSX support is now on-par with react-tools/esprima. * Shorthand destructuring. * **Bug Fix** * Generators now work flawlessly with any parameter transformers. * Optional async function transformers should not name their functions. * Remove `unlink` event watching in `bin/6to5`. * Fix regenerator variable declarations being incorrectly hoisted breaking scope. * Transformers that attempted to simplify expressions that had no consequence now take into account whether it's one of the last statements/expressions in the script. * **New Feature** * New `selfContained` transformer. * New `undeclaredVariableCheck` optional transformer. * Added `--blacklist` and `--whitelist` options to `6to5-node`. * **Breaking Change** * Caching is now always enabled for the require hook. It also now no longer caches require resolutions. * Bare `super();` only works inside of constructors. * Removed the optional runtime in favor of the `selfContained` transformer. * This shorthand has been removed from the playground. * `6to5/polyfill` can now only be required **once**. * **CLI** * `--indent` option has been removed. * `--include-regenerator` option has been removed. * `--amd-modules-id` option has been removed, use `--module-ids` instead. * **Options** * `amdModuleIds` option has been removed, use `moduleIds` instead. * `includeRegenerator` has been removed. * `ignoreRegex` fallback has now been dropped from the require hook. `register(/foo/);`, `register({ ignoreRegex: /foo/ })` -> `register({ ignore: /foo/ })`. * **Modules** * Module interop now only collapses to `module.exports` when there's a **single** export that's default. * Imports and exports are now illegal anywhere except the root level by default. Set `modules` to [loose mode](http://6to5.org/docs/usage/loose) to allow them everywhere. * **Transformers** * Optional fast transformer backwards compatibility support has been removed. Use [loose mode](https://6to5.org/docs/usage/loose). * Removed the `coreAliasing` transformer in favor of `selfContained`. * Renamed transformers: * `specNoForInOfAssignment` -> `validation.noForInOfAssignment` * `specSetters` -> `validation.setters` * `specBlockScopedFunctions` -> `spec.blockScopedFunctions` * `malletOperator` -> `playground.malletOperator` * `methodBinding` -> `playground.methodBinding` * `memoizationOperator` -> `playground.memoizationOperator` * `objectGetterMemoization` -> `playground.objectGetterMemoization` * `modules` -> `es6.modules` * `propertyNameShorthand` -> `es6.properties.shorthand` * `arrayComprehension` -> `es7.comprehensions` * `generatorComprehension` -> `es7.comprehensions` * `arrowFunctions` -> `es6.arrowFunctions` * `classes` -> `es6.classes` * `objectSpread` -> `es7.objectSpread` * `exponentiationOperator` -> `es7.exponentiationOperator` * `spread` -> `es6.spread` * `templateLiterals` -> `es6.templateLiterals` * `propertyMethodAssignment` -> `es6.properties.shorthand` * `computedPropertyNames` -> `es6.properties.computed` * `defaultParameters` -> `es6.parameters.default` * `restParameters` -> `es6.parameters.rest` * `destructuring` -> `es6.destructuring` * `forOf` -> `es6.forOf` * `unicodeRegex` -> `es6.unicodeRegex` * `abstractReferences` -> `es7.abstractReferences` * `constants` -> `es6.constants` * `letScoping` -> `es6.blockScoping` * `blockScopingTDZ` -> `es6.blockScopingTDZ` * `generators` -> `regenerator` * `protoToAssign` -> `spec.protoToAssign` * `typeofSymbol` -> `spec.typeofSymbol` * `coreAliasing` -> `selfContained` * `undefinedToVoid` -> `spec.undefinedToVoid` * `undeclaredVariableCheck` -> `validation.undeclaredVariableCheck` * `specPropertyLiterals` -> `minification.propertyLiterals` * `specMemberExpressionLiterals` -> `minification.memberExpressionLiterals` ## 2.13.7 * **Bug Fix** * Don't realias variables that are already declared in optional `coreAliasing` transformer. ## 2.13.6 * **Bug Fix** * Add `NewExpression` as a valid parent for parentheses insertion for `ConditionalExpression`. ## 2.13.5 * **Bug Fix** * Allow rest parameters to be destructuring patterns. * **Internal** * Upgrade `kexec` to `1.1.0`. ## 2.13.4 * **Bug Fix** * Fix ordering of destructuring and default params. * Fix loop body scope. * Fix `for...of` transformation not retaining it's scope. * Add destructuring assignment support to scope tracking. * **Polish** * More reliable newlines for pretty printing variable declarations. ## 2.13.3 * **Internal** * Add `coverage` and `vendor` to npmignore. ## 2.13.2 * **Bug Fix** * Fix `super` inside of nested functions. * **Internal** * Move let scoping TDZ into a separate transformer until it's more solid. * Use `process.stdin.write` instead of `console.log` in `bin` to avoid sprintfification. ## 2.13.1 * **New Feature** * Temporal dead zone for block binding. ## 2.13.0 * **New Feature** * Block scoped functions. * Add `--loose all` option. * Add playground mallet operator thanks to [@jridgewell](https://github.com/jridgewell). * **Bug Fix** * Rewrote large parts of the let scoping transformer. Now passes all known tests. * **Internal** * Even more optimisations thanks to the awesome [@gaearon](https://github.com/gaearon). * Upgrade `acorn-6to5`. * Fixes exponentation operator thanks to [@charliesome](https://github.com/charliesome). * Fix flow optional parameters with types. * Upgrade `chokidar` to `0.12.6`. * Upgrade `commander` to `2.6.0`. * Upgrade `core-js` to `0.4.5`. * Upgrade `estraverse` to `1.9.1`. * Upgrade `jshint` to `2.5.11`. * Upgrade `regenerator` to `0.8.9`. * Upgrade `regexpu` to `1.0.0`. * Upgrade `source-map` to `0.1.43`. * Upgrade `source-map-support` to `0.2.9`. * Upgrade `browserify` to `8.1.1`. * Upgrade `chai` to `1.10.0`. * Upgrade `istanbul` to `0.3.5`. * Upgrade `mocha` to `2.1.0`. * Upgrade `uglify-js` to `2.4.16`. ## 2.12.6 * **Bug Fix** * Add missing flow type traversal keys. ## 2.12.5 * **Internal** * Fix incorrect `for...in` loop still causing `ember-script` issues. ## 2.12.4 * **Polish** * Rest parameters now allocate the array before populating. * **Internal** * `for...in` loops have been changed to optimized `for` loops - better performance and no enumeration of prototype keys. * Parts of the code generator have now been optimized thanks to [gaearon](https://github.com/gaearon). ## 2.12.3 * **Spec Compliance** * Optional `typeof` transformer checks for `undefined` before passing it to the helper. * Class methods are now named. ## 2.12.2 * **Internal** * Exclude nodes in function parameters and catch clauses from `isReferenced` check. ## 2.12.1 * **Internal** * Add `.jsx` to list of allowed extensions. ## 2.12.0 * **Bug Fix** * Support non-string JSX literals. * **New Feature** * Loose mode for some transformers that enables non-spec behavior. * **Internal** * Uglify `--mangle sort` has been added to the build script, cutting minified scripts in half. ## 2.11.4 * **Internal** * Make all dependency versions fixed. ## 2.11.3 * **Bug Fix** * Allow a string to be passed as the `optional` option. ## 2.11.2 * **Bug Fix** * Support esprima-style catch clause handlers. * **Polish** * Don't print a stacktrace for syntax errors in the CLI. ## 2.11.1 * **Bug Fix** * Remove stray `console.log` outputting debug code. * Remove `Dict` from `coreAliasing`. ## 2.11.0 * **Bug Fix** * Fix unnecessary IIFE in default parameters on method calls. * Add support for supers inside of closures. * **New Feature** * Add `--keep-module-id-extensions`/`keepModuleIdExtensions` option to keep extensions in module ids. * **Polish** * Special case single argument spread properties in `super` inside classes. * Don't use a variable declaration for class declaration IFFE. * Rename `inherits` helper parameters. * `coreAliasing` transformer now aliases `Promise`, `Set`, `Map` and more. Thanks [@AluisioASG](https://github.com/AluisioASG). ## 2.10.1 * **Internal** * Upgrade `core-js` to `0.4.4`. * **New Feature** * Added `--include-regenerator` option to CLI and `includeRegenerator` option to API that includes the regenerator runtime if necessary. ## 2.10.0 * **New Feature** * 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 Compliance** * Disallow setters without a single parameter. * Add `configurable` and `writable` to defined properties. * Use define instead of assignment for class methods. * **Polish** * Fix bin name in `6to5-node --help`. * Fix shorthand `--whitelist` name in `bin/6to5`. * **Internal** * Hot code optimisation of traversal etc thanks to [gaearon](https://github.com/gaearon). ## 2.9.4 * **Bug Fix** * Support `UpdateExpression`s as `MemberExpression` objects. ## 2.9.3 * **Bug Fix** * Remove `exportsWildcard` helper in favor of `defaults`. ## 2.9.2 * **Bug Fix** * Pass `exports` to `exportWildcard` helper to allow for use inside the optional runtime. ## 2.9.1 * **Bug Fix** * Fix runtime generator breaking the helper inclusion loop. ## 2.9.0 * **Internal** * Upgrade `acorn-6to5`. * Now supports destructuring shorthand properties. ## 2.8.1 * **Bug Fix** * Fix computed accessors on object literals. ## 2.8.0 * **New Feature** * Add `commonStrict`, `amdStrict` and `umdStrict` module formatters that remove `module.exports` interop assignment. * Add `--indent` option to the 6to5 CLI. ## 2.7.4 * **Polish** * Inherit assignments from their declaration in destructuring. * Properly align multi-declarator variable declarations. ## 2.7.3 * **Polish** * Indent and add newlines to `React.createElement` calls in `react` transformer. * Remove `Object.assign` calls and replace it with an `extends` helper. ## 2.7.1 * **New Feature** * Expose `version` on browser and node API. * **Internal** * Upgrade `core-js` to 0.4.1 ## 2.7.0 * **Spec Compliance** * Disallow reassignments of imports. * **New Feature** * `reactCompat` option to enable pre-v0.12 react components. ## 2.6.3 * **Bug Fix** * Fix 2.6.0 regression caused by faulty export default from a source handling. ## 2.6.2 * **Bug Fix** * Fix rest parameter keys when on functions with params. ## 2.6.1 * **Bug Fix** * Fix rest parameter arguments key. ## 2.6.0 * **Bug Fix** * Better handling of number literal property keys. * Handle `NewExpression` paren insertion edge cases better. * **Internal** * Fix incorrect AST node `identifier("this")`. * Better `toIdentifier` method that handles reserved words. * Upgrade `acorn-6to5`. * Fix exponentiation operator precedence. * Fix line terminators after async contextual keywords. * Add semicolons as class elements inside of a class body. * Upgrade to `core-js` 4.0.0. * Upgrade to `regenerator` 0.8.3. * Fix non-loop labeled statements. * **New Feature** * Basic destructuring defaults * Add `.es` to list of supported extensions. * Add optional `typeofSymbol` transformer. * Use a `for` loop for rest parameters instead of `Array.prototype.slice`. * **Polish** * Move `"use strict";` to inside module bodies instead of at the top of the file. * Better handling of dynamic imports. * **Spec Compliance** * Class inheritance now has a `function` or `null` type check. * Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports. ## 2.5.0 * Remove `noDuplicateProperties` transformer. * Better generated UIDs based on nodes. * Default parameters now use `arguments[i]`, conditionals and variable declarations instead of using long-form if statements. ## 2.4.10 * Upgrade `acorn-6to5`. ## 2.4.9 * Upgrade `acorn-6to5`. * Add optional `protoToAssign` transformer. * Fix missing properties from computed property keys. * Make ES7 comprehensions `let` variables. ## 2.4.8 * Make `require("6to5/register")` work with browserify - [#370](https://github.com/6to5/6to5/pull/370). Thanks [@hughsk](https://github.com/hughsk)! ## 2.4.7 * Upgrade `acorn-6to5`. ## 2.4.6 * Move `coreAliasing` and `undefinedToVoid` transformers down to catch `moduleFormatter` transforms. ## 2.4.5 * Avoid printing comments if they've already been output. ## 2.4.4 * Add `module` type to browser build `\n\n\n\n" ] } input.mjs000066400000000000000000000006531377064615700353320ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // export default { name: 'HelloWorld', data () { return { msg: 'Welcome to Your Vue.js App' } } } // // // // // // // // // // // // // // // // // // options.json000066400000000000000000000000601377064615700360360ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex{ "plugins": ["transform-modules-commonjs"] } output.js000066400000000000000000000010631377064615700353520ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // var _default = { name: 'HelloWorld', data() { return { msg: 'Welcome to Your Vue.js App' }; } }; // // // // // // // // // // // // // // // // // // exports.default = _default; source-map.json000066400000000000000000000045501377064615700364260ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex{ "version": 3, "sources": [ "HelloWorld.vue" ], "names": [], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFA;AACA,EAAA,IAAA,EAAA,YADA;;AAEA,EAAA,IAAA,GAAA;AACA,WAAA;AACA,MAAA,GAAA,EAAA;AADA,KAAA;AAGA;;AANA,C", "sourceRoot": "src/components", "sourcesContent": [ "\n\n\n\n\n\n" ] } source-mappings.json000066400000000000000000000016311377064615700374640ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex[ { "generated": { "line": 92, "column": 15 }, "original": { "line": 87, "column": 0 } }, { "generated": { "line": 93, "column": 0 }, "original": { "line": 88, "column": 0 } }, { "generated": { "line": 95, "column": 9 }, "original": { "line": 89, "column": 0 } }, { "generated": { "line": 96, "column": 0 }, "original": { "line": 90, "column": 0 } }, { "generated": { "line": 97, "column": 0 }, "original": { "line": 91, "column": 0 } }, { "generated": { "line": 98, "column": 0 }, "original": { "line": 90, "column": 0 } }, { "generated": { "line": 99, "column": 0 }, "original": { "line": 93, "column": 0 } } ] input-source-map-external/000077500000000000000000000000001377064615700336275ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-mapsinput.js000066400000000000000000000001121377064615700353160ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-externalvar foo = function () { return 4; }; //# sourceMappingURL=input.js.map input.js.map000066400000000000000000000002001377064615700360700ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external{"version":3,"sources":["original.js"],"names":[],"mappings":"AAAA,UAAU,Y;SAAM,C;CAAC","sourcesContent":["var foo = () => 4;"]} options.json000066400000000000000000000000351377064615700362130ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external{ "inputSourceMap": true } output.js000066400000000000000000000000471377064615700355260ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-externalvar foo = function () { return 4; }; source-map.json000066400000000000000000000002451377064615700365760ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external{ "mappings": "AAAA,IAAA,GAAA,GAAU,Y;SAAM,C;AAAC,CAAjB", "names": [], "sources": ["original.js"], "sourcesContent": ["var foo = () => 4;"], "version": 3 } babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/000077500000000000000000000000001377064615700320665ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/input.js000066400000000000000000000004071377064615700335640ustar00rootroot00000000000000var foo = function () { return 4; }; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9yaWdpbmFsLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFVBQVUsWTtTQUFNLEM7Q0FBQyIsInNvdXJjZXNDb250ZW50IjpbInZhciBmb28gPSAoKSA9PiA0OyJdfQ== options.json000066400000000000000000000000351377064615700343730ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map{ "inputSourceMap": true } output.js000066400000000000000000000000471377064615700337060ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-mapvar foo = function () { return 4; }; source-map.json000066400000000000000000000002451377064615700347560ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map{ "mappings": "AAAA,IAAA,GAAA,GAAU,Y;SAAM,C;AAAC,CAAjB", "names": [], "sources": ["original.js"], "sourcesContent": ["var foo = () => 4;"], "version": 3 } interpreter-directive-prefix/000077500000000000000000000000001377064615700344115ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-mapsinput.js000066400000000000000000000000521377064615700361030ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix#!env node console.log("Hello, world!"); options.json000066400000000000000000000000301377064615700367700ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix{ "sourceMap": true } output.js000066400000000000000000000000511377064615700363030ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix#!env node console.log("Hello, world!"); source-map.json000066400000000000000000000004171377064615700373610ustar00rootroot00000000000000babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/interpreter-directive-prefix{ "mappings": "AAAA;AAEAA,OAAO,CAACC,GAAR,CAAY,eAAZ", "names": [ "console", "log" ], "sources": [ "source-maps/interpreter-directive-prefix/input.js" ], "sourcesContent": [ "#!env node\n\nconsole.log(\"Hello, world!\");" ], "version": 3 } babel-7.12.12/packages/babel-core/test/fixtures/transformation/source-maps/options.json000066400000000000000000000000461377064615700312440ustar00rootroot00000000000000{ "plugins": ["external-helpers"] } babel-7.12.12/packages/babel-core/test/option-manager.js000066400000000000000000000166211377064615700227650ustar00rootroot00000000000000import { loadOptions as loadOptionsOrig } from "../lib"; import path from "path"; function loadOptions(opts) { return loadOptionsOrig({ cwd: __dirname, ...opts, }); } describe("option-manager", () => { it("throws for babel 5 plugin", () => { return expect(() => { loadOptions({ plugins: [({ Plugin }) => new Plugin("object-assign", {})], }); }).toThrow(/Babel 5 plugin is being run with an unsupported Babel/); }); describe("config plugin/preset flattening and overriding", () => { function makePlugin() { const calls = []; const plugin = (api, opts) => { calls.push(opts); return {}; }; return { plugin, calls }; } 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: [ "./fixtures/option-manager/babel-plugin-foo", { useSpread: true }, ], }); }).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(); expect( loadOptions({ presets: [ "@babel/env", { plugins: [[plugin, undefined, "my-plugin"]] }, ], }), ).toBeTruthy(); }); it("should throw if a plugin name is repeated, with information about the repeated plugin", () => { const { calls, plugin } = makePlugin(); 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([]); }); it("throws for null options", () => { const { calls, plugin } = makePlugin(); expect(() => { loadOptions({ plugins: [[plugin, null]], }); }).toThrow(".plugins[0][1] must be an object, false, or undefined"); expect(calls).toEqual([]); }); it("should not throw if a repeated plugin has a different name", () => { const { calls, plugin } = makePlugin(); loadOptions({ plugins: [ [plugin, { arg: 1 }], [plugin, { arg: 2 }, "some-name"], ], }); expect(calls).toEqual([{ arg: 1 }, { arg: 2 }]); }); it("should merge .env[] plugins with parent presets", () => { const { calls: calls1, plugin: plugin1 } = makePlugin(); const { calls: calls2, plugin: plugin2 } = makePlugin(); loadOptions({ envName: "test", plugins: [[plugin1, { arg: 1 }]], env: { test: { plugins: [ [plugin1, { arg: 3 }], [plugin2, { arg: 2 }], ], }, }, }); expect(calls1).toEqual([{ arg: 3 }]); expect(calls2).toEqual([{ arg: 2 }]); }); it("should throw if a preset is repeated", () => { const { calls, plugin: preset } = makePlugin(); expect(() => { loadOptions({ presets: [preset, preset], }); }).toThrow(/Duplicate plugin\/preset detected/); expect(calls).toEqual([]); }); it("should not throw if a repeated preset has a different name", () => { const { calls, plugin: preset } = makePlugin(); loadOptions({ presets: [ [preset, { arg: 1 }], [preset, { arg: 2 }, "some-name"], ], }); expect(calls).toEqual([{ arg: 1 }, { arg: 2 }]); }); it("should merge .env[] presets with parent presets", () => { const { calls: calls1, plugin: preset1 } = makePlugin(); const { calls: calls2, plugin: preset2 } = makePlugin(); loadOptions({ envName: "test", presets: [[preset1, { arg: 1 }]], env: { test: { presets: [ [preset1, { arg: 3 }], [preset2, { arg: 2 }], ], }, }, }); expect(calls1).toEqual([{ arg: 3 }]); expect(calls2).toEqual([{ arg: 2 }]); }); it("should not merge .env[] presets with parent presets when passPerPreset", () => { const { calls: calls1, plugin: preset1 } = makePlugin(); const { calls: calls2, plugin: preset2 } = makePlugin(); loadOptions({ envName: "test", passPerPreset: true, presets: [[preset1, { arg: 1 }]], env: { test: { presets: [ [preset1, { arg: 3 }], [preset2, { arg: 2 }], ], }, }, }); expect(calls1).toEqual([{ arg: 1 }, { arg: 3 }]); expect(calls2).toEqual([{ arg: 2 }]); }); }); describe("mergeOptions", () => { it("throws for removed babel 5 options", () => { return expect(() => { loadOptions({ randomOption: true, }); }).toThrow(/Unknown option: .randomOption/); }); it("throws for removed babel 5 options", () => { return expect(() => { loadOptions({ auxiliaryComment: true, blacklist: true, }); }).toThrow( // eslint-disable-next-line max-len /Using removed Babel 5 option: .auxiliaryComment - Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`/, ); }); it("throws for resolved but erroring preset", () => { return expect(() => { loadOptions({ presets: [ path.join(__dirname, "fixtures/option-manager/not-a-preset"), ], }); }).toThrow( /While processing: .*option-manager(?:\/|\\\\)not-a-preset\.js/, ); }); }); describe("presets", function () { function presetTest(name) { it(name, function () { const options = loadOptions({ presets: [ path.join(__dirname, "fixtures/option-manager/presets", name), ], }); expect(Array.isArray(options.plugins)).toBe(true); expect(options.plugins).toHaveLength(1); expect(options.presets).toHaveLength(0); }); } function presetThrowsTest(name, msg) { it(name, function () { expect(() => loadOptions({ presets: [ path.join(__dirname, "fixtures/option-manager/presets", name), ], }), ).toThrow(msg); }); } presetTest("es5_function"); presetTest("es5_object"); presetTest("es2015_default_function"); presetTest("es2015_default_object"); presetThrowsTest( "es2015_named", /Must export a default export when using ES6 modules/, ); presetThrowsTest("es2015_invalid", /Unsupported format: string/); presetThrowsTest("es5_invalid", /Unsupported format: string/); }); }); babel-7.12.12/packages/babel-core/test/parse.js000066400000000000000000000017531377064615700211570ustar00rootroot00000000000000import fs from "fs"; import path from "path"; import { parse } from "../lib"; function fixture(...args) { return path.join(__dirname, "fixtures", "parse", ...args); } describe("parse", function () { it("should parse using configuration from .babelrc when a filename is provided", function () { const input = fs.readFileSync(fixture("input.js"), "utf8"); const output = require(fixture("output")); const result = parse(input, { filename: fixture("input.js"), cwd: fixture(), }); expect(JSON.parse(JSON.stringify(result))).toEqual(output); }); it("should parse using passed in configuration", function () { const input = fs.readFileSync(fixture("input.js"), "utf8"); const output = require(fixture("output.json")); const result = parse(input, { parserOpts: { plugins: [["decorators", { decoratorsBeforeExport: false }]], }, cwd: fixture(), }); expect(JSON.parse(JSON.stringify(result))).toEqual(output); }); }); babel-7.12.12/packages/babel-core/test/path.js000066400000000000000000000112051377064615700207720ustar00rootroot00000000000000import { transform } from "../lib/index"; import Plugin from "../lib/config/plugin"; describe("traversal path", function () { it("replaceWithSourceString", function () { const expectCode = "function foo() {}"; const actualCode = transform(expectCode, { cwd: __dirname, plugins: [ new Plugin({ visitor: { FunctionDeclaration: function (path) { path.replaceWithSourceString("console.whatever()"); }, }, }), ], }).code; expect(actualCode).toBe("console.whatever();"); }); it("replaceWith (arrow expression body to block statement body)", function () { const expectCode = "var fn = () => true;"; const actualCode = transform(expectCode, { cwd: __dirname, plugins: [ new Plugin({ visitor: { ArrowFunctionExpression: function (path) { path.get("body").replaceWith({ type: "BlockStatement", body: [ { type: "ReturnStatement", argument: { type: "BooleanLiteral", value: true, }, }, ], }); }, }, }), ], }).code; expect(actualCode).toBe("var fn = () => {\n return true;\n};"); }); it("replaceWith (arrow block statement body to expression body)", function () { const expectCode = "var fn = () => { return true; }"; const actualCode = transform(expectCode, { cwd: __dirname, plugins: [ new Plugin({ visitor: { ArrowFunctionExpression: function (path) { path.get("body").replaceWith({ type: "BooleanLiteral", value: true, }); }, }, }), ], }).code; expect(actualCode).toBe("var fn = () => true;"); }); it("replaceWith (for-in left expression to variable declaration)", function () { const expectCode = "for (KEY in right);"; const actualCode = transform(expectCode, { cwd: __dirname, plugins: [ new Plugin({ visitor: { ForInStatement: function (path) { path.get("left").replaceWith({ type: "VariableDeclaration", kind: "var", declarations: [ { type: "VariableDeclarator", id: { type: "Identifier", name: "KEY", }, }, ], }); }, }, }), ], }).code; expect(actualCode).toBe("for (var KEY in right);"); }); it("replaceWith (for-in left variable declaration to expression)", function () { const expectCode = "for (var KEY in right);"; const actualCode = transform(expectCode, { cwd: __dirname, plugins: [ new Plugin({ visitor: { ForInStatement: function (path) { path.get("left").replaceWith({ type: "Identifier", name: "KEY", }); }, }, }), ], }).code; expect(actualCode).toBe("for (KEY in right);"); }); it("replaceWith (for-loop left expression to variable declaration)", function () { const expectCode = "for (KEY;;);"; const actualCode = transform(expectCode, { cwd: __dirname, plugins: [ new Plugin({ visitor: { ForStatement: function (path) { path.get("init").replaceWith({ type: "VariableDeclaration", kind: "var", declarations: [ { type: "VariableDeclarator", id: { type: "Identifier", name: "KEY", }, }, ], }); }, }, }), ], }).code; expect(actualCode).toBe("for (var KEY;;);"); }); it("replaceWith (for-loop left variable declaration to expression)", function () { const expectCode = "for (var KEY;;);"; const actualCode = transform(expectCode, { cwd: __dirname, plugins: [ new Plugin({ visitor: { ForStatement: function (path) { path.get("init").replaceWith({ type: "Identifier", name: "KEY", }); }, }, }), ], }).code; expect(actualCode).toBe("for (KEY;;);"); }); }); babel-7.12.12/packages/babel-core/test/plugins.js000066400000000000000000000001671377064615700215240ustar00rootroot00000000000000import runner from "@babel/helper-transform-fixture-test-runner"; runner(`${__dirname}/fixtures/plugins`, "plugins"); babel-7.12.12/packages/babel-core/test/resolution.js000066400000000000000000000250251377064615700222460ustar00rootroot00000000000000import * as babel from "../lib/index"; import path from "path"; describe("addon resolution", function () { const base = path.join(__dirname, "fixtures", "resolution"); let cwd; beforeEach(function () { cwd = process.cwd(); process.chdir(base); }); afterEach(function () { process.chdir(cwd); }); it("should find module: presets", function () { process.chdir("module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["module:preset"], }); }); it("should find module: plugins", function () { process.chdir("module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["module:plugin"], }); }); it("should find standard presets", function () { process.chdir("standard-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["mod"], }); }); it("should find standard plugins", function () { process.chdir("standard-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["mod"], }); }); it("should find standard presets with an existing prefix", function () { process.chdir("standard-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["babel-preset-mod"], }); }); it("should find standard plugins with an existing prefix", function () { process.chdir("standard-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["babel-plugin-mod"], }); }); it("should find @babel scoped presets", function () { process.chdir("babel-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@babel/foo"], }); }); it("should find @babel scoped plugins", function () { process.chdir("babel-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@babel/foo"], }); }); it("should find @babel scoped presets with an existing prefix", function () { process.chdir("babel-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@babel/preset-foo"], }); }); it("should find @babel scoped plugins", function () { process.chdir("babel-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@babel/plugin-foo"], }); }); it("should find @foo scoped presets", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo/mod"], }); }); it("should find @foo scoped plugins", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo/mod"], }); }); it("should find @foo scoped presets with an inner babel-preset", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo/thing.babel-preset-convert"], }); }); it("should find @foo scoped plugins with an inner babel-plugin", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo/thing.babel-plugin-convert"], }); }); it("should find @foo scoped presets with an babel-preset suffix", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo/thing-babel-preset"], }); }); it("should find @foo scoped plugins with an babel-plugin suffix", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo/thing-babel-plugin"], }); }); it("should find @foo scoped presets with an existing prefix", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo/babel-preset-mod"], }); }); it("should find @foo scoped plugins with an existing prefix", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo/babel-plugin-mod"], }); }); it("should find @foo/babel-plugin when specified", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo/babel-plugin"], }); }); it("should find @foo/babel-preset when specified", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo/babel-preset"], }); }); it("should find @foo/babel-plugin/index when specified", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo/babel-plugin/index"], }); }); it("should find @foo/babel-preset/index when specified", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo/babel-preset/index"], }); }); it("should find @foo/babel-plugin when just scope given", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo"], }); }); it("should find @foo/babel-preset when just scope given", function () { process.chdir("foo-org-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo"], }); }); it("should find relative path presets", function () { process.chdir("relative-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["./dir/preset.js"], }); }); it("should find relative path plugins", function () { process.chdir("relative-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["./dir/plugin.js"], }); }); it("should find module file presets", function () { process.chdir("nested-module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["mod/preset"], }); }); it("should find module file plugins", function () { process.chdir("nested-module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["mod/plugin"], }); }); it("should find @foo scoped module file presets", function () { process.chdir("scoped-nested-module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@foo/mod/preset"], }); }); it("should find @foo scoped module file plugins", function () { process.chdir("scoped-nested-module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@foo/mod/plugin"], }); }); it("should find @babel scoped module file presets", function () { process.chdir("babel-scoped-nested-module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, presets: ["@babel/mod/preset"], }); }); it("should find @babel scoped module file plugins", function () { process.chdir("babel-scoped-nested-module-paths"); babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["@babel/mod/plugin"], }); }); it("should throw about module: usage for presets", function () { process.chdir("throw-module-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, presets: ["foo"], }); }).toThrow( /Cannot resolve module 'babel-preset-foo'.*\n- If you want to resolve "foo", use "module:foo"/, ); }); it("should throw about module: usage for plugins", function () { process.chdir("throw-module-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["foo"], }); }).toThrow( /Cannot resolve module 'babel-plugin-foo'.*\n- If you want to resolve "foo", use "module:foo"/, ); }); it("should throw about @babel usage for presets", function () { process.chdir("throw-babel-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, presets: ["foo"], }); }).toThrow( /Cannot resolve module 'babel-preset-foo'.*\n- Did you mean "@babel\/foo"\?/, ); }); it("should throw about @babel usage for plugins", function () { process.chdir("throw-babel-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["foo"], }); }).toThrow( /Cannot resolve module 'babel-plugin-foo'.*\n- Did you mean "@babel\/foo"\?/, ); }); it("should throw about passing a preset as a plugin", function () { process.chdir("throw-opposite-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, presets: ["testplugin"], }); }).toThrow( /Cannot resolve module 'babel-preset-testplugin'.*\n- Did you accidentally pass a plugin as a preset\?/, ); }); it("should throw about passing a plugin as a preset", function () { process.chdir("throw-opposite-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["testpreset"], }); }).toThrow( /Cannot resolve module 'babel-plugin-testpreset'.*\n- Did you accidentally pass a preset as a plugin\?/, ); }); it("should throw about missing presets", function () { process.chdir("throw-missing-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, presets: ["foo"], }); }).toThrow(/Cannot resolve module 'babel-preset-foo'/); }); it("should throw about missing plugins", function () { process.chdir("throw-missing-paths"); expect(() => { babel.transform("", { filename: "filename.js", babelrc: false, plugins: ["foo"], }); }).toThrow(/Cannot resolve module 'babel-plugin-foo'/); }); }); babel-7.12.12/packages/babel-core/test/transformation.js000066400000000000000000000002051377064615700231020ustar00rootroot00000000000000import runner from "@babel/helper-transform-fixture-test-runner"; runner(`${__dirname}/fixtures/transformation`, "transformation"); babel-7.12.12/packages/babel-generator/000077500000000000000000000000001377064615700175605ustar00rootroot00000000000000babel-7.12.12/packages/babel-generator/.npmignore000066400000000000000000000000271377064615700215560ustar00rootroot00000000000000src test scripts *.log babel-7.12.12/packages/babel-generator/README.md000066400000000000000000000006651377064615700210460ustar00rootroot00000000000000# @babel/generator > Turns an AST into code. See our website [@babel/generator](https://babeljs.io/docs/en/babel-generator) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen) associated with this package. ## Install Using npm: ```sh npm install --save-dev @babel/generator ``` or using yarn: ```sh yarn add @babel/generator --dev ``` babel-7.12.12/packages/babel-generator/package.json000066400000000000000000000012421377064615700220450ustar00rootroot00000000000000{ "name": "@babel/generator", "version": "7.12.11", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-generator" }, "main": "lib/index.js", "files": [ "lib" ], "dependencies": { "@babel/types": "workspace:^7.12.11", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, "devDependencies": { "@babel/helper-fixtures": "workspace:*", "@babel/parser": "workspace:*" } } babel-7.12.12/packages/babel-generator/scripts/000077500000000000000000000000001377064615700212475ustar00rootroot00000000000000babel-7.12.12/packages/babel-generator/scripts/generate-typescript-tests.js000066400000000000000000000033161377064615700267460ustar00rootroot00000000000000/* Copies tests from the @babel/parser's TypeScript test suite to @babel/generator. */ const { copySync, emptyDirSync, existsSync, readdirSync, readFileSync, } = require("fs-extra"); const { join } = require("path"); const testsFrom = join( __dirname, "../../babel-parser/test/fixtures/typescript" ); const testsTo = join(__dirname, "../test/fixtures/typescript"); emptyDirSync(testsTo); copySync(join(testsFrom, "options.json"), join(testsTo, "options.json")); for (const groupName of readdirSync(testsFrom)) { if (groupName === "options.json") continue; const groupFromDir = join(testsFrom, groupName); const testNames = readdirSync(groupFromDir); const groupHasOptions = testNames.includes("options.json"); for (const testName of testNames) { if (testName === "options.json") { continue; } const testFromDir = join(groupFromDir, testName); const testToDir = join(testsTo, `${groupName}-${testName}`); let optionsJsonFrom; const ownOptions = join(testFromDir, "options.json"); if (existsSync(ownOptions)) { const options = JSON.parse(readFileSync(ownOptions)); // Don't include a test that doesn't parse or does not provide babel AST if (options.throws || options.plugins.indexOf("estree") >= 0) { continue; } optionsJsonFrom = ownOptions; } else if (groupHasOptions) { // Copy group options to each individual one, since we don't have groups here. optionsJsonFrom = join(groupFromDir, "options.json"); } emptyDirSync(testToDir); if (optionsJsonFrom) { copySync(optionsJsonFrom, join(testToDir, "options.json")); } copySync(join(testFromDir, "actual.js"), join(testToDir, "actual.js")); } } babel-7.12.12/packages/babel-generator/src/000077500000000000000000000000001377064615700203475ustar00rootroot00000000000000babel-7.12.12/packages/babel-generator/src/buffer.js000066400000000000000000000261701377064615700221640ustar00rootroot00000000000000import type SourceMap from "./source-map"; const SPACES_RE = /^[ \t]+$/; /** * The Buffer class exists to manage the queue of tokens being pushed onto the output string * in such a way that the final string buffer is treated as write-only until the final .get() * call. This allows V8 to optimize the output efficiently by not requiring it to store the * string in contiguous memory. */ export default class Buffer { constructor(map: ?SourceMap) { this._map = map; } _map: SourceMap = null; _buf: Array = []; _last: string = ""; _queue: Array = []; _position: Object = { line: 1, column: 0, }; _sourcePosition: Object = { identifierName: null, line: null, column: null, filename: null, }; _disallowedPop: Object | null = null; /** * Get the final string output from the buffer, along with the sourcemap if one exists. */ get(): Object { this._flush(); const map = this._map; 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: this._buf.join("").trimRight(), map: null, rawMappings: map?.getRawMappings(), }; if (map) { // The `.map` property is lazy to allow callers to use the raw mappings // without any overhead Object.defineProperty(result, "map", { configurable: true, enumerable: true, get() { return (this.map = map.get()); }, set(value) { Object.defineProperty(this, "map", { value, writable: true }); }, }); } return result; } /** * Add a string to the buffer that cannot be reverted. */ append(str: string): void { this._flush(); const { line, column, filename, identifierName, force, } = this._sourcePosition; this._append(str, line, column, identifierName, filename, force); } /** * Add a string to the buffer than can be reverted. */ queue(str: string): void { // Drop trailing spaces when a newline is inserted. if (str === "\n") { while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) { this._queue.shift(); } } const { line, column, filename, identifierName, force, } = this._sourcePosition; this._queue.unshift([str, line, column, identifierName, filename, force]); } _flush(): void { let item; while ((item = this._queue.pop())) this._append(...item); } _append( str: string, line: number, column: number, identifierName: ?string, filename: ?string, force?: boolean, ): void { this._buf.push(str); this._last = str[str.length - 1]; // Search for newline chars. We search only for `\n`, since both `\r` and // `\r\n` are normalized to `\n` during parse. We exclude `\u2028` and // `\u2029` for performance reasons, they're so uncommon that it's probably // ok. It's also unclear how other sourcemap utilities handle them... let i = str.indexOf("\n"); let last = 0; // If the string starts with a newline char, then adding a mark is redundant. // This catches both "no newlines" and "newline after several chars". if (i !== 0) { this._mark(line, column, identifierName, filename, force); } // Now, find each reamining newline char in the string. while (i !== -1) { this._position.line++; this._position.column = 0; last = i + 1; // We mark the start of each line, which happens directly after this newline char // unless this is the last char. if (last < str.length) { this._mark(++line, 0, identifierName, filename, force); } i = str.indexOf("\n", last); } this._position.column += str.length - last; } _mark( line: number, column: number, identifierName: ?string, filename: ?string, force?: boolean, ): void { this._map?.mark( this._position.line, this._position.column, line, column, identifierName, filename, force, ); } removeTrailingNewline(): void { if (this._queue.length > 0 && this._queue[0][0] === "\n") { this._queue.shift(); } } removeLastSemicolon(): void { if (this._queue.length > 0 && this._queue[0][0] === ";") { this._queue.shift(); } } endsWith(suffix: string): boolean { // Fast path to avoid iterating over this._queue. if (suffix.length === 1) { let last; if (this._queue.length > 0) { const str = this._queue[0][0]; last = str[str.length - 1]; } else { last = this._last; } return last === suffix; } const end = this._last + this._queue.reduce((acc, item) => item[0] + acc, ""); if (suffix.length <= end.length) { return end.slice(-suffix.length) === suffix; } // We assume that everything being matched is at most a single token plus some whitespace, // which everything currently is, but otherwise we'd have to expand _last or check _buf. return false; } hasContent(): boolean { return this._queue.length > 0 || !!this._last; } /** * Certain sourcemap usecases expect mappings to be more accurate than * Babel's generic sourcemap handling allows. For now, we special-case * identifiers to allow for the primary cases to work. * The goal of this line is to ensure that the map output from Babel will * have an exact range on identifiers in the output code. Without this * line, Babel would potentially include some number of trailing tokens * that are printed after the identifier, but before another location has * been assigned. * This allows tooling like Rollup and Webpack to more accurately perform * their own transformations. Most importantly, this allows the import/export * transformations performed by those tools to loose less information when * applying their own transformations on top of the code and map results * generated by Babel itself. * * The primary example of this is the snippet: * * import mod from "mod"; * mod(); * * With this line, there will be one mapping range over "mod" and another * over "();", where previously it would have been a single mapping. */ exactSource(loc: Object, cb: () => void) { // In cases where parent expressions start at the same locations as the // identifier itself, the current active location could already be the // start of this range. We use 'force' here to explicitly start a new // mapping range for this new token. this.source("start", loc, true /* force */); cb(); // In cases where tokens are printed after this item, we want to // ensure that they get the location of the _end_ of the identifier. // To accomplish this, we assign the location and explicitly disable // the standard Buffer withSource previous-position "reactivation" // logic. This means that if another item calls '.source()' to set // the location after the identifier, it is fine, but the position won't // be automatically replaced with the previous value. this.source("end", loc); this._disallowPop("start", loc); } /** * Sets a given position as the current source location so generated code after this call * will be given this position in the sourcemap. */ source(prop: string, loc: Location, force?: boolean): void { if (prop && !loc) return; // Since this is called extremely often, we re-use the same _sourcePosition // object for the whole lifetime of the buffer. this._normalizePosition(prop, loc, this._sourcePosition, force); } /** * Call a callback with a specific source location and restore on completion. */ withSource(prop: string, loc: Location, cb: () => void): void { if (!this._map) return cb(); // Use the call stack to manage a stack of "source location" data because // the _sourcePosition object is mutated over the course of code generation, // and constantly copying it would be slower. const originalLine = this._sourcePosition.line; const originalColumn = this._sourcePosition.column; const originalFilename = this._sourcePosition.filename; const originalIdentifierName = this._sourcePosition.identifierName; this.source(prop, loc); cb(); if ( // If the current active position is forced, we only want to reactivate // the old position if it is different from the newest position. (!this._sourcePosition.force || this._sourcePosition.line !== originalLine || this._sourcePosition.column !== originalColumn || this._sourcePosition.filename !== originalFilename) && // Verify if reactivating this specific position has been disallowed. (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename) ) { this._sourcePosition.line = originalLine; this._sourcePosition.column = originalColumn; this._sourcePosition.filename = originalFilename; this._sourcePosition.identifierName = originalIdentifierName; this._sourcePosition.force = false; this._disallowedPop = null; } } /** * Allow printers to disable the default location-reset behavior of the * sourcemap output, so that certain printers can be sure that the * "end" location that they set is actually treated as the end position. */ _disallowPop(prop: string, loc: Location) { if (prop && !loc) return; this._disallowedPop = this._normalizePosition(prop, loc); } _normalizePosition( prop: string, loc: Object, targetObj: Object, force?: boolean, ) { const pos = loc ? loc[prop] : null; if (targetObj === undefined) { // Initialize with fields so that the object doesn't change shape. targetObj = { identifierName: null, line: null, column: null, filename: null, force: false, }; } const origLine = targetObj.line; const origColumn = targetObj.column; const origFilename = targetObj.filename; targetObj.identifierName = (prop === "start" && loc?.identifierName) || null; targetObj.line = pos?.line; targetObj.column = pos?.column; targetObj.filename = loc?.filename; // We want to skip reassigning `force` if we're re-setting the same position. if ( force || targetObj.line !== origLine || targetObj.column !== origColumn || targetObj.filename !== origFilename ) { targetObj.force = force; } return targetObj; } getCurrentColumn(): number { const extra = this._queue.reduce((acc, item) => item[0] + acc, ""); const lastIndex = extra.lastIndexOf("\n"); return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex; } getCurrentLine(): number { const extra = this._queue.reduce((acc, item) => item[0] + acc, ""); let count = 0; for (let i = 0; i < extra.length; i++) { if (extra[i] === "\n") count++; } return this._position.line + count; } } babel-7.12.12/packages/babel-generator/src/generators/000077500000000000000000000000001377064615700225205ustar00rootroot00000000000000babel-7.12.12/packages/babel-generator/src/generators/base.js000066400000000000000000000044331377064615700237740ustar00rootroot00000000000000export function File(node: Object) { if (node.program) { // Print this here to ensure that Program node 'leadingComments' still // get printed after the hashbang. this.print(node.program.interpreter, node); } this.print(node.program, node); } export function Program(node: Object) { this.printInnerComments(node, false); this.printSequence(node.directives, node); if (node.directives && node.directives.length) this.newline(); this.printSequence(node.body, node); } export function BlockStatement(node: Object) { this.token("{"); this.printInnerComments(node); const hasDirectives = node.directives?.length; if (node.body.length || hasDirectives) { this.newline(); this.printSequence(node.directives, node, { indent: true }); if (hasDirectives) this.newline(); this.printSequence(node.body, node, { indent: true }); this.removeTrailingNewline(); this.source("end", node.loc); if (!this.endsWith("\n")) this.newline(); this.rightBrace(); } else { this.source("end", node.loc); this.token("}"); } } export function Noop() {} export function Directive(node: Object) { this.print(node.value, node); this.semicolon(); } // These regexes match an even number of \ followed by a quote const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/; const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/; export function DirectiveLiteral(node: Object) { const raw = this.getPossibleRaw(node); if (raw != null) { this.token(raw); return; } const { value } = node; // NOTE: In directives we can't change escapings, // because they change the behavior. // e.g. "us\x65 string" (\x65 is e) is not a "use strict" directive. if (!unescapedDoubleQuoteRE.test(value)) { this.token(`"${value}"`); } else if (!unescapedSingleQuoteRE.test(value)) { this.token(`'${value}'`); } else { throw new Error( "Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes.", ); } } export function InterpreterDirective(node: Object) { this.token(`#!${node.value}\n`); } export function Placeholder(node: Object) { this.token("%%"); this.print(node.name); this.token("%%"); if (node.expectedNode === "Statement") { this.semicolon(); } } babel-7.12.12/packages/babel-generator/src/generators/classes.js000066400000000000000000000057261377064615700245250ustar00rootroot00000000000000import * as t from "@babel/types"; export function ClassDeclaration(node: Object, parent: Object) { if ( !this.format.decoratorsBeforeExport || (!t.isExportDefaultDeclaration(parent) && !t.isExportNamedDeclaration(parent)) ) { this.printJoin(node.decorators, node); } if (node.declare) { // TS this.word("declare"); this.space(); } if (node.abstract) { // TS this.word("abstract"); this.space(); } this.word("class"); if (node.id) { this.space(); this.print(node.id, node); } this.print(node.typeParameters, node); if (node.superClass) { this.space(); this.word("extends"); this.space(); this.print(node.superClass, node); this.print(node.superTypeParameters, node); } if (node.implements) { this.space(); this.word("implements"); this.space(); this.printList(node.implements, node); } this.space(); this.print(node.body, node); } export { ClassDeclaration as ClassExpression }; export function ClassBody(node: Object) { this.token("{"); this.printInnerComments(node); if (node.body.length === 0) { this.token("}"); } else { this.newline(); this.indent(); this.printSequence(node.body, node); this.dedent(); if (!this.endsWith("\n")) this.newline(); this.rightBrace(); } } export function ClassProperty(node: Object) { this.printJoin(node.decorators, node); this.tsPrintClassMemberModifiers(node, /* isField */ true); if (node.computed) { this.token("["); this.print(node.key, node); this.token("]"); } else { this._variance(node); this.print(node.key, node); } // TS if (node.optional) { this.token("?"); } if (node.definite) { this.token("!"); } this.print(node.typeAnnotation, node); if (node.value) { this.space(); this.token("="); this.space(); this.print(node.value, node); } this.semicolon(); } export function ClassPrivateProperty(node: Object) { this.printJoin(node.decorators, node); if (node.static) { this.word("static"); this.space(); } this.print(node.key, node); this.print(node.typeAnnotation, node); if (node.value) { this.space(); this.token("="); this.space(); this.print(node.value, node); } this.semicolon(); } export function ClassMethod(node: Object) { this._classMethodHead(node); this.space(); this.print(node.body, node); } export function ClassPrivateMethod(node: Object) { this._classMethodHead(node); this.space(); this.print(node.body, node); } export function _classMethodHead(node) { this.printJoin(node.decorators, node); this.tsPrintClassMemberModifiers(node, /* isField */ false); this._methodHead(node); } export function StaticBlock(node) { this.word("static"); this.space(); this.token("{"); if (node.body.length === 0) { this.token("}"); } else { this.newline(); this.printSequence(node.body, node, { indent: true, }); this.rightBrace(); } } babel-7.12.12/packages/babel-generator/src/generators/expressions.js000066400000000000000000000136731377064615700254520ustar00rootroot00000000000000import * as t from "@babel/types"; import * as n from "../node"; export function UnaryExpression(node: Object) { if ( node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || // throwExpressions node.operator === "throw" ) { this.word(node.operator); this.space(); } else { this.token(node.operator); } this.print(node.argument, node); } export function DoExpression(node: Object) { this.word("do"); this.space(); this.print(node.body, node); } export function ParenthesizedExpression(node: Object) { this.token("("); this.print(node.expression, node); this.token(")"); } export function UpdateExpression(node: Object) { if (node.prefix) { this.token(node.operator); this.print(node.argument, node); } else { this.startTerminatorless(true); this.print(node.argument, node); this.endTerminatorless(); this.token(node.operator); } } export function ConditionalExpression(node: Object) { this.print(node.test, node); this.space(); this.token("?"); this.space(); this.print(node.consequent, node); this.space(); this.token(":"); this.space(); this.print(node.alternate, node); } export function NewExpression(node: Object, parent: Object) { this.word("new"); this.space(); this.print(node.callee, node); if ( this.format.minified && node.arguments.length === 0 && !node.optional && !t.isCallExpression(parent, { callee: node }) && !t.isMemberExpression(parent) && !t.isNewExpression(parent) ) { return; } this.print(node.typeArguments, node); // Flow this.print(node.typeParameters, node); // TS if (node.optional) { this.token("?."); } this.token("("); this.printList(node.arguments, node); this.token(")"); } export function SequenceExpression(node: Object) { this.printList(node.expressions, node); } export function ThisExpression() { this.word("this"); } export function Super() { this.word("super"); } export function Decorator(node: Object) { this.token("@"); this.print(node.expression, node); this.newline(); } export function OptionalMemberExpression(node: Object) { this.print(node.object, node); if (!node.computed && t.isMemberExpression(node.property)) { throw new TypeError("Got a MemberExpression for MemberExpression property"); } let computed = node.computed; if (t.isLiteral(node.property) && typeof node.property.value === "number") { computed = true; } if (node.optional) { this.token("?."); } if (computed) { this.token("["); this.print(node.property, node); this.token("]"); } else { if (!node.optional) { this.token("."); } this.print(node.property, node); } } export function OptionalCallExpression(node: Object) { this.print(node.callee, node); this.print(node.typeArguments, node); // Flow this.print(node.typeParameters, node); // TS if (node.optional) { this.token("?."); } this.token("("); this.printList(node.arguments, node); this.token(")"); } export function CallExpression(node: Object) { this.print(node.callee, node); this.print(node.typeArguments, node); // Flow this.print(node.typeParameters, node); // TS this.token("("); this.printList(node.arguments, node); this.token(")"); } export function Import() { this.word("import"); } function buildYieldAwait(keyword: string) { return function (node: Object) { this.word(keyword); if (node.delegate) { this.token("*"); } if (node.argument) { this.space(); const terminatorState = this.startTerminatorless(); this.print(node.argument, node); this.endTerminatorless(terminatorState); } }; } export const YieldExpression = buildYieldAwait("yield"); export const AwaitExpression = buildYieldAwait("await"); export function EmptyStatement() { this.semicolon(true /* force */); } export function ExpressionStatement(node: Object) { this.print(node.expression, node); this.semicolon(); } export function AssignmentPattern(node: Object) { this.print(node.left, node); if (node.left.optional) this.token("?"); this.print(node.left.typeAnnotation, node); this.space(); this.token("="); this.space(); this.print(node.right, node); } export function AssignmentExpression(node: Object, parent: Object) { // Somewhere inside a for statement `init` node but doesn't usually // needs a paren except for `in` expressions: `for (a in b ? a : b;;)` const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); if (parens) { this.token("("); } this.print(node.left, node); this.space(); if (node.operator === "in" || node.operator === "instanceof") { this.word(node.operator); } else { this.token(node.operator); } this.space(); this.print(node.right, node); if (parens) { this.token(")"); } } export function BindExpression(node: Object) { this.print(node.object, node); this.token("::"); this.print(node.callee, node); } export { AssignmentExpression as BinaryExpression, AssignmentExpression as LogicalExpression, }; export function MemberExpression(node: Object) { this.print(node.object, node); if (!node.computed && t.isMemberExpression(node.property)) { throw new TypeError("Got a MemberExpression for MemberExpression property"); } let computed = node.computed; if (t.isLiteral(node.property) && typeof node.property.value === "number") { computed = true; } if (computed) { this.token("["); this.print(node.property, node); this.token("]"); } else { this.token("."); this.print(node.property, node); } } export function MetaProperty(node: Object) { this.print(node.meta, node); this.token("."); this.print(node.property, node); } export function PrivateName(node: Object) { this.token("#"); this.print(node.id, node); } export function V8IntrinsicIdentifier(node: Object) { this.token("%"); this.word(node.name); } babel-7.12.12/packages/babel-generator/src/generators/flow.js000066400000000000000000000321421377064615700240270ustar00rootroot00000000000000import * as t from "@babel/types"; import { ExportAllDeclaration } from "./modules"; export function AnyTypeAnnotation() { this.word("any"); } export function ArrayTypeAnnotation(node: Object) { this.print(node.elementType, node); this.token("["); this.token("]"); } export function BooleanTypeAnnotation() { this.word("boolean"); } export function BooleanLiteralTypeAnnotation(node: Object) { this.word(node.value ? "true" : "false"); } export function NullLiteralTypeAnnotation() { this.word("null"); } export function DeclareClass(node: Object, parent: Object) { if (!t.isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } this.word("class"); this.space(); this._interfaceish(node); } export function DeclareFunction(node: Object, parent: Object) { if (!t.isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } this.word("function"); this.space(); this.print(node.id, node); this.print(node.id.typeAnnotation.typeAnnotation, node); if (node.predicate) { this.space(); this.print(node.predicate, node); } this.semicolon(); } export function InferredPredicate(/*node: Object*/) { this.token("%"); this.word("checks"); } export function DeclaredPredicate(node: Object) { this.token("%"); this.word("checks"); this.token("("); this.print(node.value, node); this.token(")"); } export function DeclareInterface(node: Object) { this.word("declare"); this.space(); this.InterfaceDeclaration(node); } export function DeclareModule(node: Object) { this.word("declare"); this.space(); this.word("module"); this.space(); this.print(node.id, node); this.space(); this.print(node.body, node); } export function DeclareModuleExports(node: Object) { this.word("declare"); this.space(); this.word("module"); this.token("."); this.word("exports"); this.print(node.typeAnnotation, node); } export function DeclareTypeAlias(node: Object) { this.word("declare"); this.space(); this.TypeAlias(node); } export function DeclareOpaqueType(node: Object, parent: Object) { if (!t.isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } this.OpaqueType(node); } export function DeclareVariable(node: Object, parent: Object) { if (!t.isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } this.word("var"); this.space(); this.print(node.id, node); this.print(node.id.typeAnnotation, node); this.semicolon(); } export function DeclareExportDeclaration(node: Object) { this.word("declare"); this.space(); this.word("export"); this.space(); if (node.default) { this.word("default"); this.space(); } FlowExportDeclaration.apply(this, arguments); } export function DeclareExportAllDeclaration(/*node: Object*/) { this.word("declare"); this.space(); 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; this.print(declar, node); if (!t.isStatement(declar)) this.semicolon(); } else { this.token("{"); if (node.specifiers.length) { this.space(); this.printList(node.specifiers, node); this.space(); } this.token("}"); if (node.source) { this.space(); this.word("from"); this.space(); this.print(node.source, node); } this.semicolon(); } } export function ExistsTypeAnnotation() { this.token("*"); } export function FunctionTypeAnnotation(node: Object, parent: Object) { this.print(node.typeParameters, node); this.token("("); this.printList(node.params, node); if (node.rest) { if (node.params.length) { this.token(","); this.space(); } this.token("..."); this.print(node.rest, node); } this.token(")"); // this node type is overloaded, not sure why but it makes it EXTREMELY annoying if ( parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction" || (parent.type === "ObjectTypeProperty" && parent.method) ) { this.token(":"); } else { this.space(); this.token("=>"); } this.space(); this.print(node.returnType, node); } export function FunctionTypeParam(node: Object) { this.print(node.name, node); if (node.optional) this.token("?"); if (node.name) { this.token(":"); this.space(); } this.print(node.typeAnnotation, node); } export function InterfaceExtends(node: Object) { this.print(node.id, node); this.print(node.typeParameters, node); } export { InterfaceExtends as ClassImplements, InterfaceExtends as GenericTypeAnnotation, }; export function _interfaceish(node: Object) { this.print(node.id, node); this.print(node.typeParameters, node); if (node.extends.length) { this.space(); this.word("extends"); this.space(); this.printList(node.extends, node); } if (node.mixins && node.mixins.length) { this.space(); this.word("mixins"); this.space(); this.printList(node.mixins, node); } if (node.implements && node.implements.length) { this.space(); this.word("implements"); this.space(); this.printList(node.implements, node); } this.space(); this.print(node.body, node); } export function _variance(node) { if (node.variance) { if (node.variance.kind === "plus") { this.token("+"); } else if (node.variance.kind === "minus") { this.token("-"); } } } export function InterfaceDeclaration(node: Object) { this.word("interface"); this.space(); this._interfaceish(node); } function andSeparator() { this.space(); this.token("&"); this.space(); } export function InterfaceTypeAnnotation(node: Object) { this.word("interface"); if (node.extends && node.extends.length) { this.space(); this.word("extends"); this.space(); this.printList(node.extends, node); } this.space(); this.print(node.body, node); } export function IntersectionTypeAnnotation(node: Object) { this.printJoin(node.types, node, { separator: andSeparator }); } export function MixedTypeAnnotation() { this.word("mixed"); } export function EmptyTypeAnnotation() { this.word("empty"); } export function NullableTypeAnnotation(node: Object) { this.token("?"); this.print(node.typeAnnotation, node); } export { NumericLiteral as NumberLiteralTypeAnnotation, StringLiteral as StringLiteralTypeAnnotation, } from "./types"; export function NumberTypeAnnotation() { this.word("number"); } export function StringTypeAnnotation() { this.word("string"); } export function ThisTypeAnnotation() { this.word("this"); } export function TupleTypeAnnotation(node: Object) { this.token("["); this.printList(node.types, node); this.token("]"); } export function TypeofTypeAnnotation(node: Object) { this.word("typeof"); this.space(); this.print(node.argument, node); } export function TypeAlias(node: Object) { this.word("type"); this.space(); this.print(node.id, node); this.print(node.typeParameters, node); this.space(); this.token("="); this.space(); this.print(node.right, node); this.semicolon(); } export function TypeAnnotation(node) { this.token(":"); this.space(); if (node.optional) this.token("?"); this.print(node.typeAnnotation, node); } export function TypeParameterInstantiation(node): void { this.token("<"); this.printList(node.params, node, {}); this.token(">"); } export { TypeParameterInstantiation as TypeParameterDeclaration }; export function TypeParameter(node) { this._variance(node); this.word(node.name); if (node.bound) { this.print(node.bound, node); } if (node.default) { this.space(); this.token("="); this.space(); this.print(node.default, node); } } export function OpaqueType(node: Object) { this.word("opaque"); this.space(); this.word("type"); this.space(); this.print(node.id, node); this.print(node.typeParameters, node); if (node.supertype) { this.token(":"); this.space(); this.print(node.supertype, node); } if (node.impltype) { this.space(); this.token("="); this.space(); this.print(node.impltype, node); } this.semicolon(); } export function ObjectTypeAnnotation(node: Object) { if (node.exact) { this.token("{|"); } else { this.token("{"); } // TODO: remove the array fallbacks and instead enforce the types to require an array const props = node.properties.concat( node.callProperties || [], node.indexers || [], node.internalSlots || [], ); if (props.length) { this.space(); this.printJoin(props, node, { addNewlines(leading) { if (leading && !props[0]) return 1; }, indent: true, statement: true, iterator: () => { if (props.length !== 1 || node.inexact) { this.token(","); this.space(); } }, }); this.space(); } if (node.inexact) { this.indent(); this.token("..."); if (props.length) { this.newline(); } this.dedent(); } if (node.exact) { this.token("|}"); } else { this.token("}"); } } export function ObjectTypeInternalSlot(node: Object) { if (node.static) { this.word("static"); this.space(); } this.token("["); this.token("["); this.print(node.id, node); this.token("]"); this.token("]"); if (node.optional) this.token("?"); if (!node.method) { this.token(":"); this.space(); } this.print(node.value, node); } export function ObjectTypeCallProperty(node: Object) { if (node.static) { this.word("static"); this.space(); } this.print(node.value, node); } export function ObjectTypeIndexer(node: Object) { if (node.static) { this.word("static"); this.space(); } this._variance(node); this.token("["); if (node.id) { this.print(node.id, node); this.token(":"); this.space(); } this.print(node.key, node); this.token("]"); this.token(":"); this.space(); this.print(node.value, node); } export function ObjectTypeProperty(node: Object) { if (node.proto) { this.word("proto"); this.space(); } if (node.static) { this.word("static"); this.space(); } if (node.kind === "get" || node.kind === "set") { this.word(node.kind); this.space(); } this._variance(node); this.print(node.key, node); if (node.optional) this.token("?"); if (!node.method) { this.token(":"); this.space(); } this.print(node.value, node); } export function ObjectTypeSpreadProperty(node: Object) { this.token("..."); this.print(node.argument, node); } export function QualifiedTypeIdentifier(node: Object) { this.print(node.qualification, node); this.token("."); this.print(node.id, node); } export function SymbolTypeAnnotation() { this.word("symbol"); } function orSeparator() { this.space(); this.token("|"); this.space(); } export function UnionTypeAnnotation(node: Object) { this.printJoin(node.types, node, { separator: orSeparator }); } export function TypeCastExpression(node: Object) { this.token("("); this.print(node.expression, node); this.print(node.typeAnnotation, node); this.token(")"); } export function Variance(node: Object) { if (node.kind === "plus") { this.token("+"); } else { this.token("-"); } } export function VoidTypeAnnotation() { this.word("void"); } babel-7.12.12/packages/babel-generator/src/generators/index.js000066400000000000000000000004611377064615700241660ustar00rootroot00000000000000export * from "./template-literals"; export * from "./expressions"; export * from "./statements"; export * from "./classes"; export * from "./methods"; export * from "./modules"; export * from "./types"; export * from "./flow"; export * from "./base"; export * from "./jsx"; export * from "./typescript"; babel-7.12.12/packages/babel-generator/src/generators/jsx.js000066400000000000000000000046501377064615700236670ustar00rootroot00000000000000export function JSXAttribute(node: Object) { this.print(node.name, node); if (node.value) { this.token("="); this.print(node.value, node); } } export function JSXIdentifier(node: Object) { this.word(node.name); } export function JSXNamespacedName(node: Object) { this.print(node.namespace, node); this.token(":"); this.print(node.name, node); } export function JSXMemberExpression(node: Object) { this.print(node.object, node); this.token("."); this.print(node.property, node); } export function JSXSpreadAttribute(node: Object) { this.token("{"); this.token("..."); this.print(node.argument, node); this.token("}"); } export function JSXExpressionContainer(node: Object) { this.token("{"); this.print(node.expression, node); this.token("}"); } export function JSXSpreadChild(node: Object) { this.token("{"); this.token("..."); this.print(node.expression, node); this.token("}"); } export function JSXText(node: Object) { const raw = this.getPossibleRaw(node); if (raw != null) { this.token(raw); } else { this.token(node.value); } } export function JSXElement(node: Object) { const open = node.openingElement; this.print(open, node); if (open.selfClosing) return; this.indent(); for (const child of (node.children: Array)) { this.print(child, node); } this.dedent(); this.print(node.closingElement, node); } function spaceSeparator() { this.space(); } export function JSXOpeningElement(node: Object) { this.token("<"); this.print(node.name, node); this.print(node.typeParameters, node); // TS if (node.attributes.length > 0) { this.space(); this.printJoin(node.attributes, node, { separator: spaceSeparator }); } if (node.selfClosing) { this.space(); this.token("/>"); } else { this.token(">"); } } export function JSXClosingElement(node: Object) { this.token(""); } export function JSXEmptyExpression(node: Object) { this.printInnerComments(node); } export function JSXFragment(node: Object) { this.print(node.openingFragment, node); this.indent(); for (const child of (node.children: Array)) { this.print(child, node); } this.dedent(); this.print(node.closingFragment, node); } export function JSXOpeningFragment() { this.token("<"); this.token(">"); } export function JSXClosingFragment() { this.token(""); } babel-7.12.12/packages/babel-generator/src/generators/methods.js000066400000000000000000000061671377064615700245330ustar00rootroot00000000000000import * as t from "@babel/types"; export function _params(node: Object) { this.print(node.typeParameters, node); this.token("("); this._parameters(node.params, node); this.token(")"); this.print(node.returnType, node); } export function _parameters(parameters, parent) { for (let i = 0; i < parameters.length; i++) { this._param(parameters[i], parent); if (i < parameters.length - 1) { this.token(","); this.space(); } } } export function _param(parameter, parent) { this.printJoin(parameter.decorators, parameter); this.print(parameter, parent); if (parameter.optional) this.token("?"); // TS / flow this.print(parameter.typeAnnotation, parameter); // TS / flow } export function _methodHead(node: Object) { const kind = node.kind; const key = node.key; if (kind === "get" || kind === "set") { this.word(kind); this.space(); } if (node.async) { // ensure `async` is in the same line with property name this._catchUp("start", key.loc); this.word("async"); this.space(); } if (kind === "method" || kind === "init") { if (node.generator) { this.token("*"); } } if (node.computed) { this.token("["); this.print(key, node); this.token("]"); } else { this.print(key, node); } if (node.optional) { // TS this.token("?"); } this._params(node); } export function _predicate(node: Object) { if (node.predicate) { if (!node.returnType) { this.token(":"); } this.space(); this.print(node.predicate, node); } } export function _functionHead(node: Object) { if (node.async) { this.word("async"); this.space(); } this.word("function"); if (node.generator) this.token("*"); this.space(); if (node.id) { this.print(node.id, node); } this._params(node); this._predicate(node); } export function FunctionExpression(node: Object) { this._functionHead(node); this.space(); this.print(node.body, node); } export { FunctionExpression as FunctionDeclaration }; export function ArrowFunctionExpression(node: Object) { if (node.async) { this.word("async"); this.space(); } const firstParam = node.params[0]; if ( node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam) ) { if ( (this.format.retainLines || node.async) && node.loc && node.body.loc && node.loc.start.line < node.body.loc.start.line ) { this.token("("); if (firstParam.loc && firstParam.loc.start.line > node.loc.start.line) { this.indent(); this.print(firstParam, node); this.dedent(); this._catchUp("start", node.body.loc); } else { this.print(firstParam, node); } this.token(")"); } else { this.print(firstParam, node); } } else { this._params(node); } this._predicate(node); this.space(); this.token("=>"); this.space(); this.print(node.body, node); } function hasTypes(node, param) { return ( node.typeParameters || node.returnType || param.typeAnnotation || param.optional || param.trailingComments ); } babel-7.12.12/packages/babel-generator/src/generators/modules.js000066400000000000000000000111751377064615700245330ustar00rootroot00000000000000import * as t from "@babel/types"; export function ImportSpecifier(node: Object) { if (node.importKind === "type" || node.importKind === "typeof") { this.word(node.importKind); this.space(); } this.print(node.imported, node); if (node.local && node.local.name !== node.imported.name) { this.space(); this.word("as"); this.space(); this.print(node.local, node); } } export function ImportDefaultSpecifier(node: Object) { this.print(node.local, node); } export function ExportDefaultSpecifier(node: Object) { this.print(node.exported, node); } export function ExportSpecifier(node: Object) { this.print(node.local, node); if (node.exported && node.local.name !== node.exported.name) { this.space(); this.word("as"); this.space(); this.print(node.exported, node); } } export function ExportNamespaceSpecifier(node: Object) { this.token("*"); this.space(); this.word("as"); this.space(); this.print(node.exported, node); } export function ExportAllDeclaration(node: Object) { this.word("export"); this.space(); if (node.exportKind === "type") { this.word("type"); this.space(); } this.token("*"); this.space(); this.word("from"); this.space(); this.print(node.source, node); this.printAssertions(node); this.semicolon(); } export function ExportNamedDeclaration(node: Object) { if ( this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration) ) { this.printJoin(node.declaration.decorators, node); } this.word("export"); this.space(); ExportDeclaration.apply(this, arguments); } export function ExportDefaultDeclaration(node: Object) { if ( this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration) ) { this.printJoin(node.declaration.decorators, node); } this.word("export"); this.space(); this.word("default"); this.space(); ExportDeclaration.apply(this, arguments); } function ExportDeclaration(node: Object) { if (node.declaration) { const declar = node.declaration; this.print(declar, node); if (!t.isStatement(declar)) this.semicolon(); } else { if (node.exportKind === "type") { this.word("type"); this.space(); } const specifiers = node.specifiers.slice(0); // print "special" specifiers first let hasSpecial = false; for (;;) { const first = specifiers[0]; if ( t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first) ) { hasSpecial = true; this.print(specifiers.shift(), node); if (specifiers.length) { this.token(","); this.space(); } } else { break; } } if (specifiers.length || (!specifiers.length && !hasSpecial)) { this.token("{"); if (specifiers.length) { this.space(); this.printList(specifiers, node); this.space(); } this.token("}"); } if (node.source) { this.space(); this.word("from"); this.space(); this.print(node.source, node); this.printAssertions(node); } this.semicolon(); } } export function ImportDeclaration(node: Object) { this.word("import"); this.space(); if (node.importKind === "type" || node.importKind === "typeof") { this.word(node.importKind); this.space(); } const specifiers = node.specifiers.slice(0); if (specifiers?.length) { // print "special" specifiers first for (;;) { const first = specifiers[0]; if ( t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first) ) { this.print(specifiers.shift(), node); if (specifiers.length) { this.token(","); this.space(); } } else { break; } } if (specifiers.length) { this.token("{"); this.space(); this.printList(specifiers, node); this.space(); this.token("}"); } this.space(); this.word("from"); this.space(); } this.print(node.source, node); this.printAssertions(node); // todo(Babel 8): remove this if branch // `module-attributes` support is discontinued, use `import-assertions` instead. if (node.attributes?.length) { this.space(); this.word("with"); this.space(); this.printList(node.attributes, node); } this.semicolon(); } export function ImportAttribute(node: Object) { this.print(node.key); this.token(":"); this.space(); this.print(node.value); } export function ImportNamespaceSpecifier(node: Object) { this.token("*"); this.space(); this.word("as"); this.space(); this.print(node.local, node); } babel-7.12.12/packages/babel-generator/src/generators/statements.js000066400000000000000000000151671377064615700252570ustar00rootroot00000000000000import * as t from "@babel/types"; export function WithStatement(node: Object) { this.word("with"); this.space(); this.token("("); this.print(node.object, node); this.token(")"); this.printBlock(node); } export function IfStatement(node: Object) { this.word("if"); this.space(); this.token("("); this.print(node.test, node); this.token(")"); this.space(); const needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent)); if (needsBlock) { this.token("{"); this.newline(); this.indent(); } this.printAndIndentOnComments(node.consequent, node); if (needsBlock) { this.dedent(); this.newline(); this.token("}"); } if (node.alternate) { if (this.endsWith("}")) this.space(); this.word("else"); this.space(); this.printAndIndentOnComments(node.alternate, node); } } // Recursively get the last statement. function getLastStatement(statement) { if (!t.isStatement(statement.body)) return statement; return getLastStatement(statement.body); } export function ForStatement(node: Object) { this.word("for"); this.space(); this.token("("); this.inForStatementInitCounter++; this.print(node.init, node); this.inForStatementInitCounter--; this.token(";"); if (node.test) { this.space(); this.print(node.test, node); } this.token(";"); if (node.update) { this.space(); this.print(node.update, node); } this.token(")"); this.printBlock(node); } export function WhileStatement(node: Object) { this.word("while"); this.space(); this.token("("); this.print(node.test, node); this.token(")"); this.printBlock(node); } const buildForXStatement = function (op) { return function (node: Object) { this.word("for"); this.space(); if (op === "of" && node.await) { this.word("await"); this.space(); } this.token("("); this.print(node.left, node); this.space(); this.word(op); this.space(); this.print(node.right, node); this.token(")"); this.printBlock(node); }; }; export const ForInStatement = buildForXStatement("in"); export const ForOfStatement = buildForXStatement("of"); export function DoWhileStatement(node: Object) { this.word("do"); this.space(); this.print(node.body, node); this.space(); this.word("while"); this.space(); this.token("("); this.print(node.test, node); this.token(")"); this.semicolon(); } function buildLabelStatement(prefix, key = "label") { return function (node: Object) { this.word(prefix); const label = node[key]; if (label) { this.space(); const isLabel = key == "label"; const terminatorState = this.startTerminatorless(isLabel); this.print(label, node); this.endTerminatorless(terminatorState); } this.semicolon(); }; } export const ContinueStatement = buildLabelStatement("continue"); export const ReturnStatement = buildLabelStatement("return", "argument"); export const BreakStatement = buildLabelStatement("break"); export const ThrowStatement = buildLabelStatement("throw", "argument"); export function LabeledStatement(node: Object) { this.print(node.label, node); this.token(":"); this.space(); this.print(node.body, node); } export function TryStatement(node: Object) { this.word("try"); this.space(); this.print(node.block, node); this.space(); // Esprima bug puts the catch clause in a `handlers` array. // see https://code.google.com/p/esprima/issues/detail?id=433 // We run into this from regenerator generated ast. if (node.handlers) { this.print(node.handlers[0], node); } else { this.print(node.handler, node); } if (node.finalizer) { this.space(); this.word("finally"); this.space(); this.print(node.finalizer, node); } } export function CatchClause(node: Object) { this.word("catch"); this.space(); if (node.param) { this.token("("); this.print(node.param, node); this.print(node.param.typeAnnotation, node); this.token(")"); this.space(); } this.print(node.body, node); } export function SwitchStatement(node: Object) { this.word("switch"); this.space(); this.token("("); this.print(node.discriminant, node); this.token(")"); this.space(); this.token("{"); this.printSequence(node.cases, node, { indent: true, addNewlines(leading, cas) { if (!leading && node.cases[node.cases.length - 1] === cas) return -1; }, }); this.token("}"); } export function SwitchCase(node: Object) { if (node.test) { this.word("case"); this.space(); this.print(node.test, node); this.token(":"); } else { this.word("default"); this.token(":"); } if (node.consequent.length) { this.newline(); this.printSequence(node.consequent, node, { indent: true }); } } export function DebuggerStatement() { this.word("debugger"); this.semicolon(); } function variableDeclarationIndent() { // "let " or "var " indentation. this.token(","); this.newline(); if (this.endsWith("\n")) for (let i = 0; i < 4; i++) this.space(true); } function constDeclarationIndent() { // "const " indentation. this.token(","); this.newline(); if (this.endsWith("\n")) for (let i = 0; i < 6; i++) this.space(true); } export function VariableDeclaration(node: Object, parent: Object) { if (node.declare) { // TS this.word("declare"); this.space(); } this.word(node.kind); this.space(); let hasInits = false; // don't add whitespace to loop heads if (!t.isFor(parent)) { for (const declar of (node.declarations: Array)) { if (declar.init) { // has an init so let's split it up over multiple lines hasInits = true; } } } // // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on // this will format declarations like: // // let foo = "bar", bar = "foo"; // // into // // let foo = "bar", // bar = "foo"; // let separator; if (hasInits) { separator = node.kind === "const" ? constDeclarationIndent : variableDeclarationIndent; } // this.printList(node.declarations, node, { separator }); if (t.isFor(parent)) { // don't give semicolons to these nodes since they'll be inserted in the parent generator if (parent.left === node || parent.init === node) return; } this.semicolon(); } export function VariableDeclarator(node: Object) { this.print(node.id, node); if (node.definite) this.token("!"); // TS this.print(node.id.typeAnnotation, node); if (node.init) { this.space(); this.token("="); this.space(); this.print(node.init, node); } } babel-7.12.12/packages/babel-generator/src/generators/template-literals.js000066400000000000000000000012721377064615700265100ustar00rootroot00000000000000export function TaggedTemplateExpression(node: Object) { this.print(node.tag, node); this.print(node.typeParameters, node); // TS this.print(node.quasi, node); } export function TemplateElement(node: Object, parent: Object) { const isFirst = parent.quasis[0] === node; const isLast = parent.quasis[parent.quasis.length - 1] === node; const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); this.token(value); } export function TemplateLiteral(node: Object) { const quasis = node.quasis; for (let i = 0; i < quasis.length; i++) { this.print(quasis[i], node); if (i + 1 < quasis.length) { this.print(node.expressions[i], node); } } } babel-7.12.12/packages/babel-generator/src/generators/types.js000066400000000000000000000131271377064615700242260ustar00rootroot00000000000000import * as t from "@babel/types"; import jsesc from "jsesc"; export function Identifier(node: Object) { this.exactSource(node.loc, () => { this.word(node.name); }); } export function ArgumentPlaceholder() { this.token("?"); } export function RestElement(node: Object) { this.token("..."); this.print(node.argument, node); } export { RestElement as SpreadElement }; export function ObjectExpression(node: Object) { const props = node.properties; this.token("{"); this.printInnerComments(node); if (props.length) { this.space(); this.printList(props, node, { indent: true, statement: true }); this.space(); } this.token("}"); } export { ObjectExpression as ObjectPattern }; export function ObjectMethod(node: Object) { this.printJoin(node.decorators, node); this._methodHead(node); this.space(); this.print(node.body, node); } export function ObjectProperty(node: Object) { this.printJoin(node.decorators, node); if (node.computed) { this.token("["); this.print(node.key, node); this.token("]"); } else { // print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});` if ( t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name ) { this.print(node.value, node); return; } this.print(node.key, node); // shorthand! if ( node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name ) { return; } } this.token(":"); this.space(); this.print(node.value, node); } export function ArrayExpression(node: Object) { const elems = node.elements; const len = elems.length; this.token("["); 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(","); } else { // If the array expression ends with a hole, that hole // will be ignored by the interpreter, but if it ends with // two (or more) holes, we need to write out two (or more) // commas so that the resulting code is interpreted with // both (all) of the holes. this.token(","); } } this.token("]"); } 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}`); } export function BooleanLiteral(node: Object) { this.word(node.value ? "true" : "false"); } export function NullLiteral() { this.word("null"); } export function NumericLiteral(node: Object) { const raw = this.getPossibleRaw(node); const opts = this.format.jsescOption; const value = node.value + ""; 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); } else { this.number(raw); } } export function StringLiteral(node: Object) { const raw = this.getPossibleRaw(node); if (!this.format.minified && raw != null) { this.token(raw); return; } // ensure the output is ASCII-safe const val = jsesc( node.value, process.env.BABEL_8_BREAKING ? this.format.jsescOption : Object.assign( this.format.jsescOption, this.format.jsonCompatibleStrings && { json: true }, ), ); return this.token(val); } export function BigIntLiteral(node: Object) { const raw = this.getPossibleRaw(node); if (!this.format.minified && raw != null) { this.word(raw); return; } this.word(node.value + "n"); } export function DecimalLiteral(node: Object) { const raw = this.getPossibleRaw(node); if (!this.format.minified && raw != null) { this.word(raw); return; } this.word(node.value + "m"); } export function PipelineTopicExpression(node: Object) { this.print(node.expression, node); } export function PipelineBareFunction(node: Object) { this.print(node.callee, node); } export function PipelinePrimaryTopicReference() { this.token("#"); } babel-7.12.12/packages/babel-generator/src/generators/typescript.js000066400000000000000000000303271377064615700252710ustar00rootroot00000000000000export function TSTypeAnnotation(node) { this.token(":"); this.space(); if (node.optional) this.token("?"); this.print(node.typeAnnotation, node); } export function TSTypeParameterInstantiation(node): void { this.token("<"); this.printList(node.params, node, {}); this.token(">"); } export { TSTypeParameterInstantiation as TSTypeParameterDeclaration }; export function TSTypeParameter(node) { this.word(node.name); if (node.constraint) { this.space(); this.word("extends"); this.space(); this.print(node.constraint, node); } if (node.default) { this.space(); this.token("="); this.space(); this.print(node.default, node); } } export function TSParameterProperty(node) { if (node.accessibility) { this.word(node.accessibility); this.space(); } if (node.readonly) { this.word("readonly"); this.space(); } this._param(node.parameter); } export function TSDeclareFunction(node) { if (node.declare) { this.word("declare"); this.space(); } this._functionHead(node); this.token(";"); } export function TSDeclareMethod(node) { this._classMethodHead(node); this.token(";"); } export function TSQualifiedName(node) { this.print(node.left, node); this.token("."); this.print(node.right, 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) { const { readonly, initializer } = node; if (readonly) { this.word("readonly"); this.space(); } this.tsPrintPropertyOrMethodName(node); this.print(node.typeAnnotation, node); if (initializer) { this.space(); this.token("="); this.space(); this.print(initializer, node); } this.token(";"); } export function tsPrintPropertyOrMethodName(node) { if (node.computed) { this.token("["); } this.print(node.key, node); if (node.computed) { this.token("]"); } if (node.optional) { this.token("?"); } } export function TSMethodSignature(node) { this.tsPrintPropertyOrMethodName(node); this.tsPrintSignatureDeclarationBase(node); this.token(";"); } export function TSIndexSignature(node) { const { readonly } = node; if (readonly) { this.word("readonly"); this.space(); } this.token("["); this._parameters(node.parameters, node); this.token("]"); this.print(node.typeAnnotation, node); this.token(";"); } export function TSAnyKeyword() { this.word("any"); } export function TSBigIntKeyword() { this.word("bigint"); } export function TSUnknownKeyword() { this.word("unknown"); } export function TSNumberKeyword() { this.word("number"); } export function TSObjectKeyword() { this.word("object"); } export function TSBooleanKeyword() { this.word("boolean"); } export function TSStringKeyword() { this.word("string"); } export function TSSymbolKeyword() { this.word("symbol"); } export function TSVoidKeyword() { this.word("void"); } export function TSUndefinedKeyword() { this.word("undefined"); } export function TSNullKeyword() { this.word("null"); } export function TSNeverKeyword() { this.word("never"); } export function TSIntrinsicKeyword() { this.word("intrinsic"); } export function TSThisType() { this.word("this"); } export function TSFunctionType(node) { this.tsPrintFunctionOrConstructorType(node); } export function TSConstructorType(node) { this.word("new"); this.space(); this.tsPrintFunctionOrConstructorType(node); } export function tsPrintFunctionOrConstructorType( node: FunctionOrConstructorType, ) { const { typeParameters, parameters } = node; this.print(typeParameters, node); this.token("("); this._parameters(parameters, node); this.token(")"); this.space(); this.token("=>"); this.space(); this.print(node.typeAnnotation.typeAnnotation, node); } export function TSTypeReference(node) { this.print(node.typeName, node); this.print(node.typeParameters, node); } export function TSTypePredicate(node) { if (node.asserts) { this.word("asserts"); this.space(); } this.print(node.parameterName); if (node.typeAnnotation) { this.space(); this.word("is"); this.space(); this.print(node.typeAnnotation.typeAnnotation); } } export function TSTypeQuery(node) { this.word("typeof"); this.space(); this.print(node.exprName); } export function TSTypeLiteral(node) { this.tsPrintTypeLiteralOrInterfaceBody(node.members, node); } export function tsPrintTypeLiteralOrInterfaceBody(members, node) { this.tsPrintBraced(members, node); } export function tsPrintBraced(members, node) { this.token("{"); if (members.length) { this.indent(); this.newline(); for (const member of members) { this.print(member, node); //this.token(sep); this.newline(); } this.dedent(); this.rightBrace(); } else { this.token("}"); } } export function TSArrayType(node) { this.print(node.elementType, node); this.token("[]"); } export function TSTupleType(node) { this.token("["); this.printList(node.elementTypes, node); this.token("]"); } export function TSOptionalType(node) { this.print(node.typeAnnotation, node); this.token("?"); } export function TSRestType(node) { this.token("..."); this.print(node.typeAnnotation, node); } export function TSNamedTupleMember(node) { this.print(node.label, node); if (node.optional) this.token("?"); this.token(":"); this.space(); this.print(node.elementType, node); } export function TSUnionType(node) { this.tsPrintUnionOrIntersectionType(node, "|"); } export function TSIntersectionType(node) { this.tsPrintUnionOrIntersectionType(node, "&"); } export function tsPrintUnionOrIntersectionType(node, sep) { this.printJoin(node.types, node, { separator() { this.space(); this.token(sep); this.space(); }, }); } export function TSConditionalType(node) { this.print(node.checkType); this.space(); this.word("extends"); this.space(); this.print(node.extendsType); this.space(); this.token("?"); this.space(); this.print(node.trueType); this.space(); this.token(":"); this.space(); this.print(node.falseType); } export function TSInferType(node) { this.token("infer"); this.space(); this.print(node.typeParameter); } export function TSParenthesizedType(node) { this.token("("); this.print(node.typeAnnotation, node); this.token(")"); } export function TSTypeOperator(node) { this.word(node.operator); this.space(); this.print(node.typeAnnotation, node); } export function TSIndexedAccessType(node) { this.print(node.objectType, node); this.token("["); this.print(node.indexType, node); this.token("]"); } export function TSMappedType(node) { const { nameType, optional, readonly, typeParameter } = node; this.token("{"); this.space(); if (readonly) { tokenIfPlusMinus(this, readonly); this.word("readonly"); this.space(); } this.token("["); this.word(typeParameter.name); this.space(); this.word("in"); this.space(); this.print(typeParameter.constraint, typeParameter); if (nameType) { this.space(); this.word("as"); this.space(); this.print(nameType, node); } this.token("]"); if (optional) { tokenIfPlusMinus(this, optional); this.token("?"); } this.token(":"); this.space(); this.print(node.typeAnnotation, node); this.space(); this.token("}"); } function tokenIfPlusMinus(self, tok) { if (tok !== true) { self.token(tok); } } export function TSLiteralType(node) { this.print(node.literal, node); } export function TSExpressionWithTypeArguments(node) { this.print(node.expression, node); this.print(node.typeParameters, node); } export function TSInterfaceDeclaration(node) { const { declare, id, typeParameters, extends: extendz, body } = node; if (declare) { this.word("declare"); this.space(); } this.word("interface"); this.space(); this.print(id, node); this.print(typeParameters, node); if (extendz) { this.space(); this.word("extends"); this.space(); this.printList(extendz, node); } this.space(); this.print(body, node); } export function TSInterfaceBody(node) { this.tsPrintTypeLiteralOrInterfaceBody(node.body, node); } export function TSTypeAliasDeclaration(node) { const { declare, id, typeParameters, typeAnnotation } = node; if (declare) { this.word("declare"); this.space(); } this.word("type"); this.space(); this.print(id, node); this.print(typeParameters, node); this.space(); this.token("="); this.space(); this.print(typeAnnotation, node); this.token(";"); } export function TSAsExpression(node) { const { expression, typeAnnotation } = node; this.print(expression, node); this.space(); this.word("as"); this.space(); this.print(typeAnnotation, node); } export function TSTypeAssertion(node) { const { typeAnnotation, expression } = node; this.token("<"); this.print(typeAnnotation, node); this.token(">"); this.space(); this.print(expression, node); } export function TSEnumDeclaration(node) { const { declare, const: isConst, id, members } = node; if (declare) { this.word("declare"); this.space(); } if (isConst) { this.word("const"); this.space(); } this.word("enum"); this.space(); this.print(id, node); this.space(); this.tsPrintBraced(members, node); } export function TSEnumMember(node) { const { id, initializer } = node; this.print(id, node); if (initializer) { this.space(); this.token("="); this.space(); this.print(initializer, node); } this.token(","); } export function TSModuleDeclaration(node) { const { declare, id } = node; if (declare) { this.word("declare"); this.space(); } if (!node.global) { this.word(id.type === "Identifier" ? "namespace" : "module"); this.space(); } this.print(id, node); if (!node.body) { this.token(";"); return; } let body = node.body; while (body.type === "TSModuleDeclaration") { this.token("."); this.print(body.id, body); body = body.body; } this.space(); this.print(body, node); } export function TSModuleBlock(node) { this.tsPrintBraced(node.body, node); } export function TSImportType(node) { const { argument, qualifier, typeParameters } = node; this.word("import"); this.token("("); this.print(argument, node); this.token(")"); if (qualifier) { this.token("."); this.print(qualifier, node); } if (typeParameters) { this.print(typeParameters, node); } } export function TSImportEqualsDeclaration(node) { const { isExport, id, moduleReference } = node; if (isExport) { this.word("export"); this.space(); } this.word("import"); this.space(); this.print(id, node); this.space(); this.token("="); this.space(); this.print(moduleReference, node); this.token(";"); } export function TSExternalModuleReference(node) { this.token("require("); this.print(node.expression, node); this.token(")"); } export function TSNonNullExpression(node) { this.print(node.expression, node); this.token("!"); } export function TSExportAssignment(node) { this.word("export"); this.space(); this.token("="); this.space(); this.print(node.expression, node); this.token(";"); } export function TSNamespaceExportDeclaration(node) { this.word("export"); this.space(); this.word("as"); this.space(); this.word("namespace"); this.space(); this.print(node.id, node); } export function tsPrintSignatureDeclarationBase(node) { const { typeParameters, parameters } = node; this.print(typeParameters, node); this.token("("); this._parameters(parameters, 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(); } } babel-7.12.12/packages/babel-generator/src/index.js000066400000000000000000000057771377064615700220340ustar00rootroot00000000000000import SourceMap from "./source-map"; import Printer, { type Format } from "./printer"; /** * Babel's code generator, turns an ast into code, maintaining sourcemaps, * user preferences, and valid output. */ class Generator extends Printer { constructor(ast, opts = {}, code) { const format = normalizeOptions(code, opts); const map = opts.sourceMaps ? new SourceMap(opts, code) : null; super(format, map); this.ast = ast; } ast: Object; /** * Generate code and sourcemap from ast. * * Appends comments that weren't attached to any node to the end of the generated output. */ generate() { return super.generate(this.ast); } } /** * Normalize generator options, setting defaults. * * - Detects code indentation. * - If `opts.compact = "auto"` and the code is over 500KB, `compact` will be set to `true`. */ function normalizeOptions(code, opts): Format { const format = { auxiliaryCommentBefore: opts.auxiliaryCommentBefore, auxiliaryCommentAfter: opts.auxiliaryCommentAfter, shouldPrintComment: opts.shouldPrintComment, retainLines: opts.retainLines, retainFunctionParens: opts.retainFunctionParens, comments: opts.comments == null || opts.comments, compact: opts.compact, minified: opts.minified, concise: opts.concise, indent: { adjustMultilineComment: true, style: " ", base: 0, }, decoratorsBeforeExport: !!opts.decoratorsBeforeExport, jsescOption: { quotes: "double", wrap: true, ...opts.jsescOption, }, recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType, }; if (!process.env.BABEL_8_BREAKING) { format.jsonCompatibleStrings = opts.jsonCompatibleStrings; } if (format.minified) { format.compact = true; format.shouldPrintComment = format.shouldPrintComment || (() => format.comments); } else { format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0); } if (format.compact === "auto") { format.compact = code.length > 500_000; // 500KB if (format.compact) { console.error( "[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`, ); } } if (format.compact) { format.indent.adjustMultilineComment = false; } return format; } /** * We originally exported the Generator class above, but to make it extra clear that it is a private API, * we have moved that to an internal class instance and simplified the interface to the two public methods * that we wish to support. */ export class CodeGenerator { constructor(ast, opts, code) { this._generator = new Generator(ast, opts, code); } generate() { return this._generator.generate(); } } export default function (ast: Object, opts: Object, code: string): Object { const gen = new Generator(ast, opts, code); return gen.generate(); } babel-7.12.12/packages/babel-generator/src/node/000077500000000000000000000000001377064615700212745ustar00rootroot00000000000000babel-7.12.12/packages/babel-generator/src/node/index.js000066400000000000000000000045361377064615700227510ustar00rootroot00000000000000import * as whitespace from "./whitespace"; import * as parens from "./parentheses"; import * as t from "@babel/types"; function expandAliases(obj) { const newObj = {}; function add(type, func) { const fn = newObj[type]; newObj[type] = fn ? function (node, parent, stack) { const result = fn(node, parent, stack); return result == null ? func(node, parent, stack) : result; } : func; } for (const type of Object.keys(obj)) { const aliases = t.FLIPPED_ALIAS_KEYS[type]; if (aliases) { for (const alias of aliases) { add(alias, obj[type]); } } else { add(type, obj[type]); } } return newObj; } // Rather than using `t.is` on each object property, we pre-expand any type aliases // into concrete types so that the 'find' call below can be as fast as possible. const expandedParens = expandAliases(parens); const expandedWhitespaceNodes = expandAliases(whitespace.nodes); const expandedWhitespaceList = expandAliases(whitespace.list); function find(obj, node, parent, printStack) { const fn = obj[node.type]; return fn ? fn(node, parent, printStack) : null; } function isOrHasCallExpression(node) { if (t.isCallExpression(node)) { return true; } return t.isMemberExpression(node) && isOrHasCallExpression(node.object); } export function needsWhitespace(node, parent, type) { if (!node) return 0; if (t.isExpressionStatement(node)) { node = node.expression; } let linesInfo = find(expandedWhitespaceNodes, node, parent); if (!linesInfo) { const items = find(expandedWhitespaceList, node, parent); if (items) { for (let i = 0; i < items.length; i++) { linesInfo = needsWhitespace(items[i], node, type); if (linesInfo) break; } } } if (typeof linesInfo === "object" && linesInfo !== null) { return linesInfo[type] || 0; } return 0; } export function needsWhitespaceBefore(node, parent) { return needsWhitespace(node, parent, "before"); } export function needsWhitespaceAfter(node, parent) { return needsWhitespace(node, parent, "after"); } export function needsParens(node, parent, printStack) { if (!parent) return false; if (t.isNewExpression(parent) && parent.callee === node) { if (isOrHasCallExpression(node)) return true; } return find(expandedParens, node, parent, printStack); } babel-7.12.12/packages/babel-generator/src/node/parentheses.js000066400000000000000000000202521377064615700241540ustar00rootroot00000000000000import * as t from "@babel/types"; const PRECEDENCE = { "||": 0, "??": 0, "&&": 1, "|": 2, "^": 3, "&": 4, "==": 5, "===": 5, "!=": 5, "!==": 5, "<": 6, ">": 6, "<=": 6, ">=": 6, in: 6, instanceof: 6, ">>": 7, "<<": 7, ">>>": 7, "+": 8, "-": 8, "*": 9, "/": 9, "%": 9, "**": 10, }; 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, printStack: Array, ): boolean { return ( // (() => A) | (() => B) t.isUnionTypeAnnotation(parent) || // (() => A) & (() => B) t.isIntersectionTypeAnnotation(parent) || // (() => A)[] 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 hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); } export function ObjectExpression( node: Object, parent: Object, printStack: Array, ): boolean { return isFirstInStatement(printStack, { considerArrow: true }); } export function DoExpression( node: Object, parent: Object, printStack: Array, ): boolean { return isFirstInStatement(printStack); } export function Binary(node: Object, parent: Object): boolean { if ( node.operator === "**" && t.isBinaryExpression(parent, { operator: "**" }) ) { return parent.left === node; } if (isClassExtendsClause(node, parent)) { return true; } if ( hasPostfixPart(node, parent) || t.isUnaryLike(parent) || t.isAwaitExpression(parent) ) { return true; } if (t.isBinary(parent)) { const parentOp = parent.operator; const parentPos = PRECEDENCE[parentOp]; const nodeOp = node.operator; const nodePos = PRECEDENCE[nodeOp]; if ( // Logical expressions with the same precedence don't need parens. (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) || parentPos > nodePos ) { return true; } } } export function UnionTypeAnnotation(node: Object, parent: Object): boolean { return ( t.isArrayTypeAnnotation(parent) || t.isNullableTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isUnionTypeAnnotation(parent) ); } export { UnionTypeAnnotation as IntersectionTypeAnnotation }; export function TSAsExpression() { return true; } export function TSTypeAssertion() { return true; } export function TSUnionType(node: Object, parent: Object): boolean { return ( t.isTSArrayType(parent) || t.isTSOptionalType(parent) || t.isTSIntersectionType(parent) || t.isTSUnionType(parent) || t.isTSRestType(parent) ); } 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 []);;); return ( node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent)) ); } export function SequenceExpression(node: Object, parent: Object): boolean { if ( // Although parentheses wouldn"t hurt around sequence // expressions in the head of for loops, traditional style // dictates that e.g. i++, j++ should not be wrapped with // parentheses. t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || (t.isIfStatement(parent) && parent.test === node) || (t.isWhileStatement(parent) && parent.test === node) || (t.isForInStatement(parent) && parent.right === node) || (t.isSwitchStatement(parent) && parent.discriminant === node) || (t.isExpressionStatement(parent) && parent.expression === node) ) { return false; } // Otherwise err on the side of overparenthesization, adding // explicit exceptions above if this proves overzealous. return true; } export function YieldExpression(node: Object, parent: Object): boolean { return ( t.isBinary(parent) || t.isUnaryLike(parent) || hasPostfixPart(node, parent) || (t.isAwaitExpression(parent) && t.isYieldExpression(node)) || (t.isConditionalExpression(parent) && node === parent.test) || isClassExtendsClause(node, parent) ); } export { YieldExpression as AwaitExpression }; export function ClassExpression( node: Object, parent: Object, printStack: Array, ): boolean { return isFirstInStatement(printStack, { considerDefaultExports: true }); } export function UnaryLike(node: Object, parent: Object): boolean { return ( hasPostfixPart(node, parent) || t.isBinaryExpression(parent, { operator: "**", left: node }) || isClassExtendsClause(node, parent) ); } export function FunctionExpression( node: Object, parent: Object, printStack: Array, ): boolean { return isFirstInStatement(printStack, { considerDefaultExports: true }); } export function ArrowFunctionExpression(node: Object, parent: Object): boolean { return t.isExportDeclaration(parent) || ConditionalExpression(node, parent); } export function ConditionalExpression(node: Object, parent: Object): boolean { if ( t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, { test: node }) || t.isAwaitExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent) ) { return true; } return UnaryLike(node, parent); } export function OptionalMemberExpression( node: Object, parent: Object, ): boolean { return ( t.isCallExpression(parent, { callee: node }) || t.isMemberExpression(parent, { object: node }) ); } export { OptionalMemberExpression as OptionalCallExpression }; export function AssignmentExpression( node: Object, parent: Object, printStack: Array, ): boolean { if (t.isObjectPattern(node.left)) { return true; } else { return ConditionalExpression(node, parent, printStack); } } 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 // in statement. function isFirstInStatement( printStack: Array, { considerArrow = false, considerDefaultExports = false } = {}, ): boolean { let i = printStack.length - 1; let node = printStack[i]; i--; let parent = printStack[i]; while (i >= 0) { if ( t.isExpressionStatement(parent, { expression: node }) || (considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node })) || (considerArrow && t.isArrowFunctionExpression(parent, { body: node })) ) { return true; } if ( (hasPostfixPart(node, parent) && !t.isNewExpression(parent)) || (t.isSequenceExpression(parent) && parent.expressions[0] === node) || t.isConditional(parent, { test: node }) || t.isBinary(parent, { left: node }) || t.isAssignmentExpression(parent, { left: node }) ) { node = parent; i--; parent = printStack[i]; } else { return false; } } return false; } babel-7.12.12/packages/babel-generator/src/node/whitespace.js000066400000000000000000000137001377064615700237670ustar00rootroot00000000000000import * as t from "@babel/types"; type WhitespaceObject = { before?: boolean, after?: boolean, }; /** * Crawl a node to test if it contains a CallExpression, a Function, or a Helper. * * @example * crawl(node) * // { hasCall: false, hasFunction: true, hasHelper: false } */ function crawl(node, state = {}) { 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) || t.isOptionalCallExpression(node)) { state.hasCall = true; crawl(node.callee, state); } else if (t.isFunction(node)) { state.hasFunction = true; } else if (t.isIdentifier(node)) { state.hasHelper = state.hasHelper || isHelper(node.callee); } return state; } /** * Test if a node is or has a helper. */ function isHelper(node) { if (t.isMemberExpression(node)) { return isHelper(node.object) || isHelper(node.property); } else if (t.isIdentifier(node)) { return node.name === "require" || node.name[0] === "_"; } else if (t.isCallExpression(node)) { return isHelper(node.callee); } else if (t.isBinary(node) || t.isAssignmentExpression(node)) { return ( (t.isIdentifier(node.left) && isHelper(node.left)) || isHelper(node.right) ); } else { return false; } } function isType(node) { return ( t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node) ); } /** * Tests for node types that need whitespace. */ export const nodes = { /** * Test if AssignmentExpression needs whitespace. */ AssignmentExpression(node: Object): ?WhitespaceObject { const state = crawl(node.right); if ((state.hasCall && state.hasHelper) || state.hasFunction) { return { before: state.hasFunction, after: true, }; } }, /** * Test if SwitchCase needs whitespace. */ SwitchCase(node: Object, parent: Object): WhitespaceObject { return { before: node.consequent.length || parent.cases[0] === node, after: !node.consequent.length && parent.cases[parent.cases.length - 1] === node, }; }, /** * Test if LogicalExpression needs whitespace. */ LogicalExpression(node: Object): ?WhitespaceObject { if (t.isFunction(node.left) || t.isFunction(node.right)) { return { after: true, }; } }, /** * Test if Literal needs whitespace. */ Literal(node: Object): ?WhitespaceObject { if (node.value === "use strict") { return { after: true, }; } }, /** * Test if CallExpressionish needs whitespace. */ CallExpression(node: Object): ?WhitespaceObject { if (t.isFunction(node.callee) || isHelper(node)) { return { before: true, after: true, }; } }, OptionalCallExpression(node: Object): ?WhitespaceObject { if (t.isFunction(node.callee)) { return { before: true, after: true, }; } }, /** * Test if VariableDeclaration needs whitespace. */ VariableDeclaration(node: Object): ?WhitespaceObject { for (let i = 0; i < node.declarations.length; i++) { const declar = node.declarations[i]; let enabled = isHelper(declar.id) && !isType(declar.init); if (!enabled) { const state = crawl(declar.init); enabled = (isHelper(declar.init) && state.hasCall) || state.hasFunction; } if (enabled) { return { before: true, after: true, }; } } }, /** * Test if IfStatement needs whitespace. */ IfStatement(node: Object): ?WhitespaceObject { if (t.isBlockStatement(node.consequent)) { return { before: true, after: true, }; } }, }; /** * Test if Property needs whitespace. */ nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function ( node: Object, parent, ): ?WhitespaceObject { if (parent.properties[0] === node) { return { before: true, }; } }; nodes.ObjectTypeCallProperty = function ( node: Object, parent, ): ?WhitespaceObject { if (parent.callProperties[0] === node && !parent.properties?.length) { return { before: true, }; } }; nodes.ObjectTypeIndexer = function (node: Object, parent): ?WhitespaceObject { if ( parent.indexers[0] === node && !parent.properties?.length && !parent.callProperties?.length ) { return { before: true, }; } }; nodes.ObjectTypeInternalSlot = function ( node: Object, parent, ): ?WhitespaceObject { if ( parent.internalSlots[0] === node && !parent.properties?.length && !parent.callProperties?.length && !parent.indexers?.length ) { return { before: true, }; } }; /** * Returns lists from node types that need whitespace. */ export const list = { /** * Return VariableDeclaration declarations init properties. */ VariableDeclaration(node: Object): Array { return node.declarations.map(decl => decl.init); }, /** * Return VariableDeclaration elements. */ ArrayExpression(node: Object): Array { return node.elements; }, /** * Return VariableDeclaration properties. */ ObjectExpression(node: Object): Array { return node.properties; }, }; /** * Add whitespace tests for nodes and their aliases. */ [ ["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true], ].forEach(function ([type, amounts]) { if (typeof amounts === "boolean") { amounts = { after: amounts, before: amounts }; } [type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { nodes[type] = function () { return amounts; }; }); }); babel-7.12.12/packages/babel-generator/src/printer.js000066400000000000000000000407021377064615700223730ustar00rootroot00000000000000import Buffer from "./buffer"; import * as n from "./node"; import * as t from "@babel/types"; 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, retainLines: boolean, retainFunctionParens: boolean, comments: boolean, auxiliaryCommentBefore: string, auxiliaryCommentAfter: string, compact: boolean | "auto", minified: boolean, concise: boolean, indent: { adjustMultilineComment: boolean, style: string, base: number, }, decoratorsBeforeExport: boolean, }; export default class Printer { constructor(format, map) { this.format = format || {}; this._buf = new Buffer(map); } declare format: Format; inForStatementInitCounter: number = 0; declare _buf: Buffer; _printStack: Array = []; _indent: number = 0; _insideAux: boolean = false; _printedCommentStarts: Object = {}; _parenPushNewlineState: ?Object = null; _noLineTerminator: boolean = false; _printAuxAfterOnNextUserNode: boolean = false; _printedComments: WeakSet = new WeakSet(); _endsWithInteger = false; _endsWithWord = false; generate(ast) { this.print(ast); this._maybeAddAuxComment(); return this._buf.get(); } /** * Increment indent size. */ indent(): void { if (this.format.compact || this.format.concise) return; this._indent++; } /** * Decrement indent size. */ dedent(): void { if (this.format.compact || this.format.concise) return; this._indent--; } /** * Add a semicolon to the buffer. */ semicolon(force: boolean = false): void { this._maybeAddAuxComment(); this._append(";", !force /* queue */); } /** * Add a right brace to the buffer. */ rightBrace(): void { if (this.format.minified) { this._buf.removeLastSemicolon(); } this.token("}"); } /** * Add a space to the buffer unless it is compact. */ space(force: boolean = false): void { if (this.format.compact) return; if ( (this._buf.hasContent() && !this.endsWith(" ") && !this.endsWith("\n")) || force ) { this._space(); } } /** * Writes a token that can't be safely parsed without taking whitespace into account. */ word(str: string): void { // prevent concatenating words and creating // comment out of division and regex if (this._endsWithWord || (this.endsWith("/") && str.indexOf("/") === 0)) { this._space(); } this._maybeAddAuxComment(); this._append(str); this._endsWithWord = true; } /** * Writes a number token so that we can validate if it is an integer. */ number(str: string): void { this.word(str); // Integer tokens need special handling because they cannot have '.'s inserted // immediately after them. this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== "."; } /** * Writes a simple token. */ token(str: string): void { // space is mandatory to avoid outputting // class Foo {} export { Foo as default } splitExportDeclaration(path); } else { // Annyms class declarations can be // transformed as if they were expressions decl.node.type = "ClassExpression"; } } }, }, }; } babel-7.12.12/packages/babel-helper-create-class-features-plugin/src/misc.js000066400000000000000000000066611377064615700266160ustar00rootroot00000000000000import { template, traverse, types as t } from "@babel/core"; import { environmentVisitor } from "@babel/helper-replace-supers"; const findBareSupers = traverse.visitors.merge([ { Super(path) { const { node, parentPath } = path; if (parentPath.isCallExpression({ callee: node })) { this.push(parentPath); } }, }, environmentVisitor, ]); const referenceVisitor = { "TSTypeAnnotation|TypeAnnotation"(path) { path.skip(); }, ReferencedIdentifier(path) { if (this.scope.hasOwnBinding(path.node.name)) { this.scope.rename(path.node.name); path.skip(); } }, }; 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 = { ReferencedIdentifier: handleClassTDZ, }; export function injectInitialization(path, constructor, nodes, renamer) { if (!nodes.length) return; const isDerived = !!path.node.superClass; if (!constructor) { const newConstructor = t.classMethod( "constructor", t.identifier("constructor"), [], t.blockStatement([]), ); if (isDerived) { newConstructor.params = [t.restElement(t.identifier("args"))]; newConstructor.body.body.push(template.statement.ast`super(...args)`); } [constructor] = path.get("body").unshiftContainer("body", newConstructor); } if (renamer) { renamer(referenceVisitor, { scope: constructor.scope }); } if (isDerived) { const bareSupers = []; constructor.traverse(findBareSupers, bareSupers); let isFirst = true; for (const bareSuper of bareSupers) { if (isFirst) { bareSuper.insertAfter(nodes); isFirst = false; } else { bareSuper.insertAfter(nodes.map(n => t.cloneNode(n))); } } } else { constructor.get("body").unshiftContainer("body", nodes); } } 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) { 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 (!computedKey.isConstantExpression()) { const ident = path.scope.generateUidIdentifierBasedOnNode( computedNode.key, ); // Declaring in the same block scope // Ref: https://github.com/babel/babel/pull/10029/files#diff-fbbdd83e7a9c998721c1484529c2ce92 path.scope.push({ id: ident, kind: "let", }); declarations.push( t.expressionStatement( t.assignmentExpression("=", t.cloneNode(ident), computedNode.key), ), ); computedNode.key = t.cloneNode(ident); } } return declarations; } babel-7.12.12/packages/babel-helper-create-class-features-plugin/src/typescript.js000066400000000000000000000012771377064615700300670ustar00rootroot00000000000000// @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`, ); } } babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/000077500000000000000000000000001377064615700255045ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/000077500000000000000000000000001377064615700273555ustar00rootroot00000000000000plugin-proposal-class-properties/000077500000000000000000000000001377064615700357265ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixturesloose-not-overwritten/000077500000000000000000000000001377064615700422335ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-propertiesinput.js000066400000000000000000000000231377064615700437230ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/loose-not-overwrittenclass A { foo; } options.json000066400000000000000000000002271377064615700446220ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/loose-not-overwritten{ "plugins": [ ["proposal-class-properties", { "loose": true }, "name 1"], ["proposal-class-properties", { "loose": false }, "name 2"] ] } output.js000066400000000000000000000000721377064615700441300ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/loose-not-overwrittenclass A { constructor() { this.foo = void 0; } } recursive-class-property-type-challenge/000077500000000000000000000000001377064615700456215ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-propertiesinput.js000066400000000000000000000001341377064615700473140ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challengeconst sym = Symbol(); const sym1 = Symbol(); class A { [sym]: A.B; [sym1]: Array; } options.json000066400000000000000000000001061377064615700502040ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge{ "presets": ["flow"], "plugins": ["proposal-class-properties"] } output.js000066400000000000000000000005661377064615700475260ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challengefunction _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; } const sym = Symbol(); const sym1 = Symbol(); class A { constructor() { _defineProperty(this, sym, void 0); _defineProperty(this, sym1, void 0); } } recursive-class-property-type/000077500000000000000000000000001377064615700437015ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-propertiesinput.js000066400000000000000000000000571377064615700454000ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-typeconst sym = Symbol(); class A { [sym]: A; } options.json000066400000000000000000000001061377064615700462640ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type{ "presets": ["flow"], "plugins": ["proposal-class-properties"] } output.js000066400000000000000000000004651377064615700456040ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-typefunction _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; } const sym = Symbol(); class A { constructor() { _defineProperty(this, sym, void 0); } } plugin-proposal-decorators/000077500000000000000000000000001377064615700345745ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixturesignore-abstract-methods/000077500000000000000000000000001377064615700413215ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decoratorsexec.ts000066400000000000000000000006211377064615700426140ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methodsfunction 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); input.ts000066400000000000000000000005461377064615700430350ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methodsfunction 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(); options.json000066400000000000000000000002311377064615700437030ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods{ "presets": [["typescript"]], "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": true }], ["proposal-class-properties"] ] } output.js000066400000000000000000000312631377064615700432240ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methodsfunction _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(); plugin-proposal-private-methods/000077500000000000000000000000001377064615700355425ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixturesloose-false/000077500000000000000000000000001377064615700377535ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methodsinput.js000066400000000000000000000000641377064615700414500ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-falseclass X { #privateMethod() { return 42; } } options.json000066400000000000000000000001041377064615700423340ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false{ "plugins": [["proposal-private-methods", { "loose": false }]] } output.js000066400000000000000000000002521377064615700416500ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-falsevar _privateMethod = new WeakSet(); class X { constructor() { _privateMethod.add(this); } } var _privateMethod2 = function _privateMethod2() { return 42; }; loose-true/000077500000000000000000000000001377064615700376405ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methodsinput.js000066400000000000000000000000641377064615700413350ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-trueclass X { #privateMethod() { return 42; } } options.json000066400000000000000000000001031377064615700422200ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true{ "plugins": [["proposal-private-methods", { "loose": true }]] } output.js000066400000000000000000000005461377064615700415430ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-truevar id = 0; function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; } var _privateMethod = _classPrivateFieldLooseKey("privateMethod"); class X { constructor() { Object.defineProperty(this, _privateMethod, { value: _privateMethod2 }); } } var _privateMethod2 = function _privateMethod2() { return 42; }; tdz-error-computed-prototypes/000077500000000000000000000000001377064615700352725ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixturesloose-false/000077500000000000000000000000001377064615700375035ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypesinput.js000066400000000000000000000001321377064615700411740ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-falseclass Foo { static nickname = 'Tom'; ['HELLO']() { console.log('>>>>', Foo); } }options.json000066400000000000000000000001551377064615700420720ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-false{ "plugins": [ [ "proposal-class-properties", { "loose": false } ] ] } output.js000066400000000000000000000004761377064615700414100ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-falsefunction _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'); loose-true/000077500000000000000000000000001377064615700373705ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypesinput.js000066400000000000000000000001321377064615700410610ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-trueclass Foo { static nickname = 'Tom'; ['HELLO']() { console.log('>>>>', Foo); } }options.json000066400000000000000000000001541377064615700417560ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-true{ "plugins": [ [ "proposal-class-properties", { "loose": true } ] ] } output.js000066400000000000000000000001301377064615700412600ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/fixtures/tdz-error-computed-prototypes/loose-trueclass Foo { ['HELLO']() { console.log('>>>>', Foo); } } Foo.nickname = 'Tom'; babel-7.12.12/packages/babel-helper-create-class-features-plugin/test/index.js000066400000000000000000000001131377064615700271440ustar00rootroot00000000000000import runner from "@babel/helper-plugin-test-runner"; runner(__dirname); babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/000077500000000000000000000000001377064615700247125ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/.npmignore000066400000000000000000000000171377064615700267070ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/README.md000066400000000000000000000006631377064615700261760ustar00rootroot00000000000000# @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/babel-helper-create-regexp-features-plugin) 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 ``` babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/package.json000066400000000000000000000014351377064615700272030ustar00rootroot00000000000000{ "name": "@babel/helper-create-regexp-features-plugin", "version": "7.12.7", "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.git", "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": "workspace:^7.10.4", "regexpu-core": "^4.7.1" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { "@babel/core": "workspace:*", "@babel/helper-plugin-test-runner": "workspace:*" } } babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/src/000077500000000000000000000000001377064615700255015ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/src/features.js000066400000000000000000000015361377064615700276620ustar00rootroot00000000000000// @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); } babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/src/index.js000066400000000000000000000061771377064615700271610ustar00rootroot00000000000000import 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 annotateAsPure from "@babel/helper-annotate-as-pure"; type RegExpFlags = "i" | "g" | "m" | "s" | "u" | "y"; /** * Remove given flag from given RegExpLiteral node * * @param {RegExpLiteral} node * @param {RegExpFlags} flag * @returns {void} */ function pullFlag(node, flag: RegExpFlags): void { node.flags = node.flags.replace(flag, ""); } // 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" }) ); } babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/src/util.js000066400000000000000000000027741377064615700270260ustar00rootroot00000000000000import { 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, }; } babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/000077500000000000000000000000001377064615700256715ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/000077500000000000000000000000001377064615700275425ustar00rootroot00000000000000plugin-proposal-unicode-property-regex/000077500000000000000000000000001377064615700372345ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixturesuse-unicode-flag-false-not-overwritten/000077500000000000000000000000001377064615700466375ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regexuse-unicode-flag-false-not-overwritten/input.mjs000066400000000000000000000000401377064615700505030ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/\p{Script_Extensions=Wancho}/u use-unicode-flag-false-not-overwritten/options.json000066400000000000000000000002651377064615700512300ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex{ "plugins": [ ["proposal-unicode-property-regex", { "useUnicodeFlag": false }, "name 1"], ["proposal-unicode-property-regex", { "useUnicodeFlag": true }, "name 2"] ] } use-unicode-flag-false-not-overwritten/output.mjs000066400000000000000000000000431377064615700507070ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/(?:\uD838[\uDEC0-\uDEF9\uDEFF])/; plugin-transform-named-capturing-groups-regex/000077500000000000000000000000001377064615700404735ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixturesruntime-false-not-overwritten/000077500000000000000000000000001377064615700464325ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regexruntime-false-not-overwritten/input.mjs000066400000000000000000000000211377064615700502750ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/(?\d{4})/ runtime-false-not-overwritten/options.json000066400000000000000000000002651377064615700510230ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex{ "plugins": [ ["transform-named-capturing-groups-regex", { "runtime": false }, "name 1"], ["transform-named-capturing-groups-regex", { "runtime": true }, "name 2"] ] } runtime-false-not-overwritten/output.mjs000066400000000000000000000000161377064615700505020ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/([0-9]{4})/; babel-7.12.12/packages/babel-helper-create-regexp-features-plugin/test/index.js000066400000000000000000000001131377064615700273310ustar00rootroot00000000000000import runner from "@babel/helper-plugin-test-runner"; runner(__dirname); babel-7.12.12/packages/babel-helper-define-map/000077500000000000000000000000001377064615700210545ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-define-map/.npmignore000066400000000000000000000000171377064615700230510ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-define-map/README.md000066400000000000000000000005121377064615700223310ustar00rootroot00000000000000# @babel/helper-define-map > Helper function to define a map See our website [@babel/helper-define-map](https://babeljs.io/docs/en/babel-helper-define-map) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-define-map ``` or using yarn: ```sh yarn add @babel/helper-define-map --dev ``` babel-7.12.12/packages/babel-helper-define-map/package.json000066400000000000000000000007651377064615700233520ustar00rootroot00000000000000{ "name": "@babel/helper-define-map", "version": "7.10.5", "description": "Helper function to define a map", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-define-map" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/helper-function-name": "workspace:^7.10.4", "@babel/types": "workspace:^7.10.5", "lodash": "^4.17.19" } } babel-7.12.12/packages/babel-helper-define-map/src/000077500000000000000000000000001377064615700216435ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-define-map/src/index.js000066400000000000000000000070671377064615700233220ustar00rootroot00000000000000import nameFunction from "@babel/helper-function-name"; import has from "lodash/has"; import * as t from "@babel/types"; function toKind(node: Object) { if (t.isClassMethod(node) || t.isObjectMethod(node)) { if (node.kind === "get" || node.kind === "set") { return node.kind; } } return "value"; } export function push( mutatorMap: Object, node: Object, kind: string, file, scope?, ): Object { const alias = t.toKeyAlias(node); // let map = {}; if (has(mutatorMap, alias)) map = mutatorMap[alias]; mutatorMap[alias] = map; // map._inherits = map._inherits || []; map._inherits.push(node); map._key = node.key; if (node.computed) { map._computed = true; } if (node.decorators) { const decorators = (map.decorators = map.decorators || t.arrayExpression([])); decorators.elements = decorators.elements.concat( node.decorators.map(dec => dec.expression).reverse(), ); } if (map.value || map.initializer) { throw file.buildCodeFrameError(node, "Key conflict with sibling node"); } let key, value; // save the key so we can possibly do function name inferences if ( t.isObjectProperty(node) || t.isObjectMethod(node) || t.isClassMethod(node) ) { key = t.toComputedKey(node, node.key); } if (t.isProperty(node)) { value = node.value; } else if (t.isObjectMethod(node) || t.isClassMethod(node)) { value = t.functionExpression( null, node.params, node.body, node.generator, node.async, ); value.returnType = node.returnType; } const inheritedKind = toKind(node); if (!kind || inheritedKind !== "value") { kind = inheritedKind; } // infer function name if ( scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && t.isFunctionExpression(value) ) { value = nameFunction({ id: key, node: value, scope }); } if (value) { t.inheritsComments(value, node); map[kind] = value; } return map; } export function hasComputed(mutatorMap: Object): boolean { for (const key of Object.keys(mutatorMap)) { if (mutatorMap[key]._computed) { return true; } } return false; } export function toComputedObjectFromClass(obj: Object): Object { const objExpr = t.arrayExpression([]); for (let i = 0; i < obj.properties.length; i++) { const prop = obj.properties[i]; const val = prop.value; val.properties.unshift( t.objectProperty(t.identifier("key"), t.toComputedKey(prop)), ); objExpr.elements.push(val); } return objExpr; } export function toClassObject(mutatorMap: Object): Object { const objExpr = t.objectExpression([]); Object.keys(mutatorMap).forEach(function (mutatorMapKey) { const map = mutatorMap[mutatorMapKey]; const mapNode = t.objectExpression([]); const propNode = t.objectProperty(map._key, mapNode, map._computed); Object.keys(map).forEach(function (key) { const node = map[key]; if (key[0] === "_") return; const prop = t.objectProperty(t.identifier(key), node); t.inheritsComments(prop, node); t.removeComments(node); mapNode.properties.push(prop); }); objExpr.properties.push(propNode); }); return objExpr; } export function toDefineObject(mutatorMap: Object): Object { Object.keys(mutatorMap).forEach(function (key) { const map = mutatorMap[key]; if (map.value) map.writable = t.booleanLiteral(true); map.configurable = t.booleanLiteral(true); map.enumerable = t.booleanLiteral(true); }); return toClassObject(mutatorMap); } babel-7.12.12/packages/babel-helper-explode-assignable-expression/000077500000000000000000000000001377064615700250125ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-explode-assignable-expression/.npmignore000066400000000000000000000000171377064615700270070ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-explode-assignable-expression/README.md000066400000000000000000000006751377064615700263010ustar00rootroot00000000000000# @babel/helper-explode-assignable-expression > Helper function to explode an assignable expression See our website [@babel/helper-explode-assignable-expression](https://babeljs.io/docs/en/babel-helper-explode-assignable-expression) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-explode-assignable-expression ``` or using yarn: ```sh yarn add @babel/helper-explode-assignable-expression --dev ``` babel-7.12.12/packages/babel-helper-explode-assignable-expression/package.json000066400000000000000000000010361377064615700273000ustar00rootroot00000000000000{ "name": "@babel/helper-explode-assignable-expression", "version": "7.12.1", "description": "Helper function to explode an assignable expression", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-explode-assignable-expression" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/types": "workspace:^7.12.1" }, "devDependencies": { "@babel/traverse": "workspace:*" } } babel-7.12.12/packages/babel-helper-explode-assignable-expression/src/000077500000000000000000000000001377064615700256015ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-explode-assignable-expression/src/index.js000066400000000000000000000045461377064615700272570ustar00rootroot00000000000000import type { Scope } from "@babel/traverse"; import * as t from "@babel/types"; function getObjRef(node, nodes, file, scope) { let ref; if (t.isSuper(node)) { // Super cannot be directly assigned so lets return it directly return node; } else if (t.isIdentifier(node)) { if (scope.hasBinding(node.name)) { // this variable is declared in scope so we can be 100% sure // that evaluating it multiple times wont trigger a getter // or something else return node; } else { // could possibly trigger a getter so we need to only evaluate // it once ref = node; } } else if (t.isMemberExpression(node)) { ref = node.object; if (t.isSuper(ref) || (t.isIdentifier(ref) && scope.hasBinding(ref.name))) { // the object reference that we need to save is locally declared // so as per the previous comment we can be 100% sure evaluating // it multiple times will be safe // Super cannot be directly assigned so lets return it also return ref; } } else { throw new Error(`We can't explode this node type ${node.type}`); } const temp = scope.generateUidIdentifierBasedOnNode(ref); scope.push({ id: temp }); nodes.push(t.assignmentExpression("=", t.cloneNode(temp), t.cloneNode(ref))); return temp; } function getPropRef(node, nodes, file, scope) { const prop = node.property; const key = t.toComputedKey(node, prop); if (t.isLiteral(key) && t.isPureish(key)) return key; const temp = scope.generateUidIdentifierBasedOnNode(prop); scope.push({ id: temp }); nodes.push(t.assignmentExpression("=", t.cloneNode(temp), t.cloneNode(prop))); return temp; } export default function ( node: Object, nodes: Array, file, scope: Scope, allowedSingleIdent?: boolean, ): { uid: Object, ref: Object, } { let obj; if (t.isIdentifier(node) && allowedSingleIdent) { obj = node; } else { obj = getObjRef(node, nodes, file, scope); } let ref, uid; if (t.isIdentifier(node)) { ref = t.cloneNode(node); uid = obj; } else { const prop = getPropRef(node, nodes, file, scope); const computed = node.computed || t.isLiteral(prop); uid = t.memberExpression(t.cloneNode(obj), t.cloneNode(prop), computed); ref = t.memberExpression(t.cloneNode(obj), t.cloneNode(prop), computed); } return { uid: uid, ref: ref, }; } babel-7.12.12/packages/babel-helper-explode-class/000077500000000000000000000000001377064615700216125ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-explode-class/.npmignore000066400000000000000000000000171377064615700236070ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-explode-class/README.md000066400000000000000000000005321377064615700230710ustar00rootroot00000000000000# @babel/helper-explode-class > Helper function to explode class See our website [@babel/helper-explode-class](https://babeljs.io/docs/en/babel-helper-explode-class) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-explode-class ``` or using yarn: ```sh yarn add @babel/helper-explode-class --dev ``` babel-7.12.12/packages/babel-helper-explode-class/package.json000066400000000000000000000010501377064615700240740ustar00rootroot00000000000000{ "name": "@babel/helper-explode-class", "version": "7.12.1", "description": "Helper function to explode class", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-explode-class" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/helper-bindify-decorators": "workspace:^7.12.1", "@babel/types": "workspace:^7.12.1" }, "devDependencies": { "@babel/traverse": "workspace:*" } } babel-7.12.12/packages/babel-helper-explode-class/src/000077500000000000000000000000001377064615700224015ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-explode-class/src/index.js000066400000000000000000000025471377064615700240560ustar00rootroot00000000000000import bindifyDecorators from "@babel/helper-bindify-decorators"; import type { NodePath } from "@babel/traverse"; import * as t from "@babel/types"; export default function (classPath) { classPath.assertClass(); const memoisedExpressions = []; function maybeMemoise(path) { if (!path.node || path.isPure()) return; const uid = classPath.scope.generateDeclaredUidIdentifier(); memoisedExpressions.push(t.assignmentExpression("=", uid, path.node)); path.replaceWith(uid); } function memoiseDecorators(paths: Array) { if (!Array.isArray(paths) || !paths.length) return; // ensure correct evaluation order of decorators paths = paths.reverse(); // bind decorators if they're member expressions bindifyDecorators(paths); for (const path of paths) { maybeMemoise(path); } } maybeMemoise(classPath.get("superClass")); memoiseDecorators(classPath.get("decorators"), true); const methods: Array = classPath.get("body.body"); for (const methodPath of methods) { if (methodPath.is("computed")) { maybeMemoise(methodPath.get("key")); } if (methodPath.has("decorators")) { memoiseDecorators(classPath.get("decorators")); } } if (memoisedExpressions) { classPath.insertBefore( memoisedExpressions.map(expr => t.expressionStatement(expr)), ); } } babel-7.12.12/packages/babel-helper-fixtures/000077500000000000000000000000001377064615700207205ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-fixtures/.npmignore000066400000000000000000000000171377064615700227150ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-fixtures/README.md000066400000000000000000000005041377064615700221760ustar00rootroot00000000000000# @babel/helper-fixtures > Helper function to support fixtures See our website [@babel/helper-fixtures](https://babeljs.io/docs/en/babel-helper-fixtures) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-fixtures ``` or using yarn: ```sh yarn add @babel/helper-fixtures --dev ``` babel-7.12.12/packages/babel-helper-fixtures/package.json000066400000000000000000000007421377064615700232110ustar00rootroot00000000000000{ "name": "@babel/helper-fixtures", "version": "7.12.12", "description": "Helper function to support fixtures", "author": "Sebastian McKenzie ", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-fixtures" }, "main": "lib/index.js", "dependencies": { "lodash": "^4.17.19", "semver": "^5.3.0" } } babel-7.12.12/packages/babel-helper-fixtures/src/000077500000000000000000000000001377064615700215075ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-fixtures/src/index.js000066400000000000000000000223241377064615700231570ustar00rootroot00000000000000import cloneDeep from "lodash/cloneDeep"; import semver from "semver"; import path from "path"; import fs from "fs"; const nodeVersion = semver.clean(process.version.slice(1)); function humanize(val, noext) { if (noext) val = path.basename(val, path.extname(val)); return val.replace(/-/g, " "); } type TestFile = { loc: string, code: string, filename: string, }; type Test = { title: string, disabled: boolean, options: Object, exec: TestFile, actual: TestFile, expected: TestFile, }; type Suite = { options: Object, tests: Array, title: string, 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.`); } } function shouldIgnore(name, ignore?: Array) { if (ignore && ignore.indexOf(name) >= 0) { return true; } const ext = path.extname(name); const base = path.basename(name, ext); return ( name[0] === "." || ext === ".md" || base === "LICENSE" || base === "options" ); } const EXTENSIONS = [".js", ".mjs", ".ts", ".tsx"]; function findFile(filepath: string, allowJSON: boolean) { const matches = []; for (const ext of EXTENSIONS.concat(allowJSON ? ".json" : [])) { const name = filepath + ext; if (fs.existsSync(name)) matches.push(name); } if (matches.length > 1) { throw new Error(`Found conflicting file matches: ${matches.join(", ")}`); } 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) Object.assign(taskOpts, require(taskOptsLoc)); const test = { optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null, title: humanize(taskName, true), disabled: taskName[0] === "." || (process.env.BABEL_8_BREAKING ? taskOpts.BABEL_8_BREAKING === false : taskOpts.BABEL_8_BREAKING === true), 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, }, }; delete taskOpts.BABEL_8_BREAKING; // 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; } function wrapPackagesArray(type, names, optionsDir) { return names.map(function (val) { if (typeof val === "string") val = [val]; // relative path (outside of monorepo) if (val[0][0] === ".") { if (!optionsDir) { throw new Error( "Please provide an options.json in test dir when using a " + "relative plugin path.", ); } val[0] = path.resolve(optionsDir, val[0]); } else { const monorepoPath = __dirname + "/../../babel-" + type + "-" + val[0]; if (fs.existsSync(monorepoPath)) { val[0] = monorepoPath; } } return val; }); } /** * Resolve plugins/presets defined in options.json * * @export * @param {{}} options the imported options.json * @param {string} optionsDir the direcotry where options.json is placed * @returns {{}} options whose plugins/presets are resolved */ export function resolveOptionPluginOrPreset( options: {}, optionsDir: string, ): {} { if (options.plugins) { options.plugins = wrapPackagesArray("plugin", options.plugins, optionsDir); } if (options.presets) { options.presets = wrapPackagesArray( "preset", options.presets, optionsDir, ).map(function (val) { if (val.length > 3) { throw new Error( "Unexpected extra options " + JSON.stringify(val.slice(3)) + " passed to preset.", ); } return val; }); } return options; } export default function get(entryLoc): Array { const suites = []; let rootOpts = {}; const rootOptsLoc = tryResolve(entryLoc + "/options"); if (rootOptsLoc) rootOpts = require(rootOptsLoc); for (const suiteName of fs.readdirSync(entryLoc)) { if (shouldIgnore(suiteName)) continue; const suite = { options: { ...rootOpts }, tests: [], title: humanize(suiteName), filename: entryLoc + "/" + suiteName, }; assertDirectory(suite.filename); suites.push(suite); const suiteOptsLoc = tryResolve(suite.filename + "/options"); if (suiteOptsLoc) { suite.options = resolveOptionPluginOrPreset( require(suiteOptsLoc), suite.filename, ); } for (const taskName of fs.readdirSync(suite.filename)) { pushTask(taskName, suite.filename + "/" + taskName, suite, suiteName); } } return suites; } export function multiple(entryLoc, ignore?: Array) { const categories = {}; for (const name of fs.readdirSync(entryLoc)) { if (shouldIgnore(name, ignore)) continue; const loc = path.join(entryLoc, name); assertDirectory(loc); categories[name] = get(loc); } return categories; } export function readFile(filename) { if (fs.existsSync(filename)) { let file = fs.readFileSync(filename, "utf8").trimRight(); file = file.replace(/\r\n/g, "\n"); return file; } else { return ""; } } babel-7.12.12/packages/babel-helper-function-name/000077500000000000000000000000001377064615700216125ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-function-name/.npmignore000066400000000000000000000000171377064615700236070ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-function-name/README.md000066400000000000000000000005711377064615700230740ustar00rootroot00000000000000# @babel/helper-function-name > Helper function to change the property 'name' of every function See our website [@babel/helper-function-name](https://babeljs.io/docs/en/babel-helper-function-name) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-function-name ``` or using yarn: ```sh yarn add @babel/helper-function-name --dev ``` babel-7.12.12/packages/babel-helper-function-name/package.json000066400000000000000000000010651377064615700241020ustar00rootroot00000000000000{ "name": "@babel/helper-function-name", "version": "7.12.11", "description": "Helper function to change the property 'name' of every function", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-function-name" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/helper-get-function-arity": "workspace:^7.12.10", "@babel/template": "workspace:^7.12.7", "@babel/types": "workspace:^7.12.11" } } babel-7.12.12/packages/babel-helper-function-name/src/000077500000000000000000000000001377064615700224015ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-function-name/src/index.ts000066400000000000000000000135621377064615700240670ustar00rootroot00000000000000import getFunctionArity from "@babel/helper-get-function-arity"; import template from "@babel/template"; import * as t from "@babel/types"; const buildPropertyMethodAssignmentWrapper = template(` (function (FUNCTION_KEY) { function FUNCTION_ID() { return FUNCTION_KEY.apply(this, arguments); } FUNCTION_ID.toString = function () { return FUNCTION_KEY.toString(); } return FUNCTION_ID; })(FUNCTION) `); const buildGeneratorPropertyMethodAssignmentWrapper = template(` (function (FUNCTION_KEY) { function* FUNCTION_ID() { return yield* FUNCTION_KEY.apply(this, arguments); } FUNCTION_ID.toString = function () { return FUNCTION_KEY.toString(); }; return FUNCTION_ID; })(FUNCTION) `); const visitor = { "ReferencedIdentifier|BindingIdentifier"(path, state) { // check if this node matches our function id if (path.node.name !== state.name) return; // check that we don't have a local variable declared as that removes the need // for the wrapper const localDeclar = path.scope.getBindingIdentifier(state.name); if (localDeclar !== state.outerDeclar) return; state.selfReference = true; path.stop(); }, }; function getNameFromLiteralId(id) { if (t.isNullLiteral(id)) { return "null"; } if (t.isRegExpLiteral(id)) { return `_${id.pattern}_${id.flags}`; } if (t.isTemplateLiteral(id)) { return id.quasis.map(quasi => quasi.value.raw).join(""); } if (id.value !== undefined) { return id.value + ""; } return ""; } function wrap(state, method, id, scope) { if (state.selfReference) { if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) { // we can just munge the local binding scope.rename(id.name); } else { // we don't currently support wrapping class expressions if (!t.isFunction(method)) return; // need to add a wrapper since we can't change the references let build = buildPropertyMethodAssignmentWrapper; if (method.generator) { build = buildGeneratorPropertyMethodAssignmentWrapper; } const template = (build({ FUNCTION: method, FUNCTION_ID: id, FUNCTION_KEY: scope.generateUidIdentifier(id.name), }) as t.ExpressionStatement).expression as t.CallExpression; // shim in dummy params to retain function arity, if you try to read the // source then you'll get the original since it's proxied so it's all good const params = (((template.callee as t.FunctionExpression).body .body[0] as any) as t.FunctionExpression).params; for (let i = 0, len = getFunctionArity(method); i < len; i++) { params.push(scope.generateUidIdentifier("x")); } return template; } } method.id = id; scope.getProgramParent().references[id.name] = true; } function visit(node, name, scope) { const state = { selfAssignment: false, selfReference: false, outerDeclar: scope.getBindingIdentifier(name), references: [], name: name, }; // check to see if we have a local binding of the id we're setting inside of // the function, this is important as there are caveats associated const binding = scope.getOwnBinding(name); if (binding) { if (binding.kind === "param") { // safari will blow up in strict mode with code like: // // let t = function t(t) {}; // // with the error: // // Cannot declare a parameter named 't' as it shadows the name of a // strict mode function. // // this isn't to the spec and they've invented this behaviour which is // **extremely** annoying so we avoid setting the name if it has a param // with the same id state.selfReference = true; } else { // otherwise it's defined somewhere in scope like: // // let t = function () { // let t = 2; // }; // // so we can safely just set the id and move along as it shadows the // bound function id } } else if (state.outerDeclar || scope.hasGlobal(name)) { scope.traverse(node, visitor, state); } return state; } /** * @param {NodePath} param0 * @param {Boolean} localBinding whether a name could shadow a self-reference (e.g. converting arrow function) */ export default function ( { node, parent, scope, id }: { node: any; parent: any; scope: any; id: any }, localBinding = false, ) { // has an `id` so we don't need to infer one if (node.id) return; if ( (t.isObjectProperty(parent) || t.isObjectMethod(parent, { kind: "method" })) && (!parent.computed || t.isLiteral(parent.key)) ) { // { foo() {} }; id = parent.key; } else if (t.isVariableDeclarator(parent)) { // let foo = function () {}; id = parent.id; // but not "let foo = () => {};" being converted to function expression if (t.isIdentifier(id) && !localBinding) { const binding = scope.parent.getBinding(id.name); if ( binding && binding.constant && scope.getBinding(id.name) === binding ) { // always going to reference this method node.id = t.cloneNode(id); node.id[t.NOT_LOCAL_BINDING] = true; return; } } } else if (t.isAssignmentExpression(parent, { operator: "=" })) { // foo = function () {}; id = parent.left; } else if (!id) { return; } let name; if (id && t.isLiteral(id)) { name = getNameFromLiteralId(id); } else if (id && t.isIdentifier(id)) { name = id.name; } if (name === undefined) { return; } name = t.toBindingIdentifierName(name); id = t.identifier(name); // The id shouldn't be considered a local binding to the function because // we are simply trying to set the function name and not actually create // a local binding. id[t.NOT_LOCAL_BINDING] = true; const state = visit(node, name, scope); return wrap(state, node, id, scope) || node; } babel-7.12.12/packages/babel-helper-get-function-arity/000077500000000000000000000000001377064615700225775ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-get-function-arity/.npmignore000066400000000000000000000000171377064615700245740ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-get-function-arity/README.md000066400000000000000000000005701377064615700240600ustar00rootroot00000000000000# @babel/helper-get-function-arity > Helper function to get function arity See our website [@babel/helper-get-function-arity](https://babeljs.io/docs/en/babel-helper-get-function-arity) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-get-function-arity ``` or using yarn: ```sh yarn add @babel/helper-get-function-arity --dev ``` babel-7.12.12/packages/babel-helper-get-function-arity/package.json000066400000000000000000000006731377064615700250730ustar00rootroot00000000000000{ "name": "@babel/helper-get-function-arity", "version": "7.12.10", "description": "Helper function to get function arity", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-get-function-arity" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/types": "workspace:^7.12.10" } } babel-7.12.12/packages/babel-helper-get-function-arity/src/000077500000000000000000000000001377064615700233665ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-get-function-arity/src/index.ts000066400000000000000000000004661377064615700250530ustar00rootroot00000000000000import * as t from "@babel/types"; export default function (node: t.Function): number { const params = node.params; for (let i = 0; i < params.length; i++) { const param = params[i]; if (t.isAssignmentPattern(param) || t.isRestElement(param)) { return i; } } return params.length; } babel-7.12.12/packages/babel-helper-hoist-variables/000077500000000000000000000000001377064615700221435ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-hoist-variables/.npmignore000066400000000000000000000000171377064615700241400ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-hoist-variables/README.md000066400000000000000000000005461377064615700234270ustar00rootroot00000000000000# @babel/helper-hoist-variables > Helper function to hoist variables See our website [@babel/helper-hoist-variables](https://babeljs.io/docs/en/babel-helper-hoist-variables) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-hoist-variables ``` or using yarn: ```sh yarn add @babel/helper-hoist-variables --dev ``` babel-7.12.12/packages/babel-helper-hoist-variables/package.json000066400000000000000000000006601377064615700244330ustar00rootroot00000000000000{ "name": "@babel/helper-hoist-variables", "version": "7.10.4", "description": "Helper function to hoist variables", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-hoist-variables" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/types": "workspace:^7.10.4" } } babel-7.12.12/packages/babel-helper-hoist-variables/src/000077500000000000000000000000001377064615700227325ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-hoist-variables/src/index.js000066400000000000000000000021161377064615700243770ustar00rootroot00000000000000import * as t from "@babel/types"; const visitor = { Scope(path, state) { if (state.kind === "let") path.skip(); }, Function(path) { path.skip(); }, VariableDeclaration(path, state) { if (state.kind && path.node.kind !== state.kind) return; const nodes = []; const declarations: Array = path.get("declarations"); let firstId; for (const declar of declarations) { firstId = declar.node.id; if (declar.node.init) { nodes.push( t.expressionStatement( t.assignmentExpression("=", declar.node.id, declar.node.init), ), ); } for (const name of Object.keys(declar.getBindingIdentifiers())) { state.emit(t.identifier(name), name, declar.node.init !== null); } } // for (var i in test) if (path.parentPath.isFor({ left: path.node })) { path.replaceWith(firstId); } else { path.replaceWithMultiple(nodes); } }, }; export default function (path, emit: Function, kind: "var" | "let" = "var") { path.traverse(visitor, { kind, emit }); } babel-7.12.12/packages/babel-helper-member-expression-to-functions/000077500000000000000000000000001377064615700251415ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-member-expression-to-functions/.npmignore000066400000000000000000000000171377064615700271360ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-member-expression-to-functions/README.md000066400000000000000000000007301377064615700264200ustar00rootroot00000000000000# @babel/helper-member-expression-to-functions > Helper function to replace certain member expressions with function calls See our website [@babel/helper-member-expression-to-functions](https://babeljs.io/docs/en/babel-helper-member-expression-to-functions) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-member-expression-to-functions ``` or using yarn: ```sh yarn add @babel/helper-member-expression-to-functions --dev ``` babel-7.12.12/packages/babel-helper-member-expression-to-functions/package.json000066400000000000000000000010551377064615700274300ustar00rootroot00000000000000{ "name": "@babel/helper-member-expression-to-functions", "version": "7.12.7", "description": "Helper function to replace certain member expressions with function calls", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-member-expression-to-functions" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "author": "Justin Ridgewell ", "dependencies": { "@babel/types": "workspace:^7.12.7" } } babel-7.12.12/packages/babel-helper-member-expression-to-functions/src/000077500000000000000000000000001377064615700257305ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-member-expression-to-functions/src/index.js000066400000000000000000000374141377064615700274060ustar00rootroot00000000000000import * as t from "@babel/types"; import { willPathCastToBoolean } from "./util.js"; class AssignmentMemoiser { constructor() { this._map = new WeakMap(); } has(key) { return this._map.has(key); } get(key) { if (!this.has(key)) return; const record = this._map.get(key); const { value } = record; record.count--; if (record.count === 0) { // The `count` access is the outermost function call (hopefully), so it // does the assignment. return t.assignmentExpression("=", value, key); } return value; } set(key, value, count) { return this._map.set(key, { count, value }); } } function toNonOptional(path, base) { const { node } = path; if (path.isOptionalMemberExpression()) { return t.memberExpression(base, node.property, node.computed); } if (path.isOptionalCallExpression()) { const callee = path.get("callee"); if (path.node.optional && callee.isOptionalMemberExpression()) { const { object } = callee.node; const context = path.scope.maybeGenerateMemoised(object) || object; callee .get("object") .replaceWith(t.assignmentExpression("=", context, object)); return t.callExpression(t.memberExpression(base, t.identifier("call")), [ context, ...node.arguments, ]); } return t.callExpression(base, node.arguments); } return path.node; } // Determines if the current path is in a detached tree. This can happen when // we are iterating on a path, and replace an ancestor with a new node. Babel // doesn't always stop traversing the old node tree, and that can cause // inconsistencies. function isInDetachedTree(path) { while (path) { if (path.isProgram()) break; const { parentPath, container, listKey } = path; const parentNode = parentPath.node; if (listKey) { if (container !== parentNode[listKey]) return true; } else { if (container !== parentNode) return true; } path = parentPath; } return false; } const handle = { memoise() { // noop. }, handle(member) { const { node, parent, parentPath, scope } = member; if (member.isOptionalMemberExpression()) { // Transforming optional chaining requires we replace ancestors. if (isInDetachedTree(member)) return; // We're looking for the end of _this_ optional chain, which is actually // the "rightmost" property access of the chain. This is because // everything up to that property access is "optional". // // Let's take the case of `FOO?.BAR.baz?.qux`, with `FOO?.BAR` being our // member. The "end" to most users would be `qux` property access. // Everything up to it could be skipped if it `FOO` were nullish. But // actually, we can consider the `baz` access to be the end. So we're // looking for the nearest optional chain that is `optional: true`. const endPath = member.find(({ node, parent, parentPath }) => { if (parentPath.isOptionalMemberExpression()) { // We need to check `parent.object` since we could be inside the // computed expression of a `bad?.[FOO?.BAR]`. In this case, the // endPath is the `FOO?.BAR` member itself. return parent.optional || parent.object !== node; } if (parentPath.isOptionalCallExpression()) { // Checking `parent.callee` since we could be in the arguments, eg // `bad?.(FOO?.BAR)`. // Also skip `FOO?.BAR` in `FOO?.BAR?.()` since we need to transform the optional call to ensure proper this return ( // In FOO?.#BAR?.(), endPath points the optional call expression so we skip FOO?.#BAR (node !== member.node && parent.optional) || parent.callee !== node ); } return true; }); // Replace `function (a, x = a.b?.#c) {}` to `function (a, x = (() => a.b?.#c)() ){}` // so the temporary variable can be injected in correct scope // This can be further optimized to avoid unecessary IIFE if (scope.path.isPattern()) { endPath.replaceWith( // The injected member will be queued and eventually transformed when visited t.callExpression(t.arrowFunctionExpression([], endPath.node), []), ); return; } const willEndPathCastToBoolean = willPathCastToBoolean(endPath); const rootParentPath = endPath.parentPath; if ( rootParentPath.isUpdateExpression({ argument: node }) || rootParentPath.isAssignmentExpression({ left: node }) ) { throw member.buildCodeFrameError(`can't handle assignment`); } const isDeleteOperation = rootParentPath.isUnaryExpression({ operator: "delete", }); if ( isDeleteOperation && endPath.isOptionalMemberExpression() && endPath.get("property").isPrivateName() ) { // @babel/parser will throw error on `delete obj?.#x`. // This error serves as fallback when `delete obj?.#x` is constructed from babel types throw member.buildCodeFrameError( `can't delete a private class element`, ); } // Now, we're looking for the start of this optional chain, which is // optional to the left of this member. // // Let's take the case of `foo?.bar?.baz.QUX?.BAM`, with `QUX?.BAM` being // our member. The "start" to most users would be `foo` object access. // But actually, we can consider the `bar` access to be the start. So // we're looking for the nearest optional chain that is `optional: true`, // which is guaranteed to be somewhere in the object/callee tree. let startingOptional = member; for (;;) { if (startingOptional.isOptionalMemberExpression()) { if (startingOptional.node.optional) break; startingOptional = startingOptional.get("object"); continue; } else if (startingOptional.isOptionalCallExpression()) { if (startingOptional.node.optional) break; startingOptional = startingOptional.get("callee"); continue; } // prevent infinite loop: unreachable if the AST is well-formed throw new Error( `Internal error: unexpected ${startingOptional.node.type}`, ); } const startingProp = startingOptional.isOptionalMemberExpression() ? "object" : "callee"; const startingNode = startingOptional.node[startingProp]; const baseNeedsMemoised = scope.maybeGenerateMemoised(startingNode); const baseRef = baseNeedsMemoised ?? startingNode; // Compute parentIsOptionalCall before `startingOptional` is replaced // as `node` may refer to `startingOptional.node` before replaced. const parentIsOptionalCall = parentPath.isOptionalCallExpression({ callee: node, }); // if parentIsCall is true, it implies that node.extra.parenthesized is always true const parentIsCall = parentPath.isCallExpression({ callee: node }); startingOptional.replaceWith(toNonOptional(startingOptional, baseRef)); if (parentIsOptionalCall) { if (parent.optional) { parentPath.replaceWith(this.optionalCall(member, parent.arguments)); } else { parentPath.replaceWith(this.call(member, parent.arguments)); } } else if (parentIsCall) { // `(a?.#b)()` to `(a == null ? void 0 : a.#b.bind(a))()` member.replaceWith(this.boundGet(member)); } else { member.replaceWith(this.get(member)); } let regular = member.node; for (let current = member; current !== endPath; ) { const { parentPath } = current; // skip transforming `Foo.#BAR?.call(FOO)` if (parentPath === endPath && parentIsOptionalCall && parent.optional) { regular = parentPath.node; break; } regular = toNonOptional(parentPath, regular); current = parentPath; } let context; const endParentPath = endPath.parentPath; if ( t.isMemberExpression(regular) && endParentPath.isOptionalCallExpression({ callee: endPath.node, optional: true, }) ) { const { object } = regular; context = member.scope.maybeGenerateMemoised(object); if (context) { regular.object = t.assignmentExpression("=", context, object); } } let replacementPath = endPath; if (isDeleteOperation) { replacementPath = endParentPath; regular = endParentPath.node; } if (willEndPathCastToBoolean) { const nonNullishCheck = t.logicalExpression( "&&", t.binaryExpression( "!==", baseNeedsMemoised ? t.assignmentExpression( "=", t.cloneNode(baseRef), t.cloneNode(startingNode), ) : t.cloneNode(baseRef), t.nullLiteral(), ), t.binaryExpression( "!==", t.cloneNode(baseRef), scope.buildUndefinedNode(), ), ); replacementPath.replaceWith( t.logicalExpression("&&", nonNullishCheck, regular), ); } else { // todo: respect assumptions.noDocumentAll when assumptions are implemented const nullishCheck = t.logicalExpression( "||", t.binaryExpression( "===", baseNeedsMemoised ? t.assignmentExpression( "=", t.cloneNode(baseRef), t.cloneNode(startingNode), ) : t.cloneNode(baseRef), t.nullLiteral(), ), t.binaryExpression( "===", t.cloneNode(baseRef), scope.buildUndefinedNode(), ), ); replacementPath.replaceWith( t.conditionalExpression( nullishCheck, isDeleteOperation ? t.booleanLiteral(true) : scope.buildUndefinedNode(), regular, ), ); } // context and isDeleteOperation can not be both truthy if (context) { const endParent = endParentPath.node; endParentPath.replaceWith( t.optionalCallExpression( t.optionalMemberExpression( endParent.callee, t.identifier("call"), false, true, ), [t.cloneNode(context), ...endParent.arguments], false, ), ); } return; } // MEMBER++ -> _set(MEMBER, (_ref = (+_get(MEMBER))) + 1), _ref // ++MEMBER -> _set(MEMBER, (+_get(MEMBER)) + 1) if (parentPath.isUpdateExpression({ argument: node })) { if (this.simpleSet) { member.replaceWith(this.simpleSet(member)); return; } const { operator, prefix } = parent; // Give the state handler a chance to memoise the member, since we'll // reference it twice. The second access (the set) should do the memo // assignment. this.memoise(member, 2); const value = t.binaryExpression( operator[0], t.unaryExpression("+", this.get(member)), t.numericLiteral(1), ); if (prefix) { parentPath.replaceWith(this.set(member, value)); } else { const { scope } = member; const ref = scope.generateUidIdentifierBasedOnNode(node); scope.push({ id: ref }); value.left = t.assignmentExpression("=", t.cloneNode(ref), value.left); parentPath.replaceWith( t.sequenceExpression([this.set(member, value), t.cloneNode(ref)]), ); } return; } // MEMBER = VALUE -> _set(MEMBER, VALUE) // MEMBER += VALUE -> _set(MEMBER, _get(MEMBER) + VALUE) // MEMBER ??= VALUE -> _get(MEMBER) ?? _set(MEMBER, VALUE) if (parentPath.isAssignmentExpression({ left: node })) { if (this.simpleSet) { member.replaceWith(this.simpleSet(member)); return; } const { operator, right: value } = parent; if (operator === "=") { parentPath.replaceWith(this.set(member, value)); } else { const operatorTrunc = operator.slice(0, -1); if (t.LOGICAL_OPERATORS.includes(operatorTrunc)) { // Give the state handler a chance to memoise the member, since we'll // reference it twice. The first access (the get) should do the memo // assignment. this.memoise(member, 1); parentPath.replaceWith( t.logicalExpression( operatorTrunc, this.get(member), this.set(member, value), ), ); } else { // Here, the second access (the set) is evaluated first. this.memoise(member, 2); parentPath.replaceWith( this.set( member, t.binaryExpression(operatorTrunc, this.get(member), value), ), ); } } return; } // MEMBER(ARGS) -> _call(MEMBER, ARGS) if (parentPath.isCallExpression({ callee: node })) { parentPath.replaceWith(this.call(member, parent.arguments)); return; } // MEMBER?.(ARGS) -> _optionalCall(MEMBER, ARGS) if (parentPath.isOptionalCallExpression({ callee: node })) { // Replace `function (a, x = a.b.#c?.()) {}` to `function (a, x = (() => a.b.#c?.())() ){}` // so the temporary variable can be injected in correct scope // This can be further optimized to avoid unecessary IIFE if (scope.path.isPattern()) { parentPath.replaceWith( // The injected member will be queued and eventually transformed when visited t.callExpression(t.arrowFunctionExpression([], parentPath.node), []), ); return; } parentPath.replaceWith(this.optionalCall(member, parent.arguments)); return; } // for (MEMBER of ARR) // for (MEMBER in ARR) // { KEY: MEMBER } = OBJ -> { KEY: _destructureSet(MEMBER) } = OBJ // { KEY: MEMBER = _VALUE } = OBJ -> { KEY: _destructureSet(MEMBER) = _VALUE } = OBJ // {...MEMBER} -> {..._destructureSet(MEMBER)} // // [MEMBER] = ARR -> [_destructureSet(MEMBER)] = ARR // [MEMBER = _VALUE] = ARR -> [_destructureSet(MEMBER) = _VALUE] = ARR // [...MEMBER] -> [..._destructureSet(MEMBER)] if ( // for (MEMBER of ARR) // for (MEMBER in ARR) parentPath.isForXStatement({ left: node }) || // { KEY: MEMBER } = OBJ (parentPath.isObjectProperty({ value: node }) && parentPath.parentPath.isObjectPattern()) || // { KEY: MEMBER = _VALUE } = OBJ (parentPath.isAssignmentPattern({ left: node }) && parentPath.parentPath.isObjectProperty({ value: parent }) && parentPath.parentPath.parentPath.isObjectPattern()) || // [MEMBER] = ARR parentPath.isArrayPattern() || // [MEMBER = _VALUE] = ARR (parentPath.isAssignmentPattern({ left: node }) && parentPath.parentPath.isArrayPattern()) || // {...MEMBER} // [...MEMBER] parentPath.isRestElement() ) { member.replaceWith(this.destructureSet(member)); return; } // MEMBER -> _get(MEMBER) member.replaceWith(this.get(member)); }, }; // We do not provide a default traversal visitor // Instead, caller passes one, and must call `state.handle` on the members // it wishes to be transformed. // Additionally, the caller must pass in a state object with at least // get, set, and call methods. // Optionally, a memoise method may be defined on the state, which will be // called when the member is a self-referential update. export default function memberExpressionToFunctions(path, visitor, state) { path.traverse(visitor, { ...handle, ...state, memoiser: new AssignmentMemoiser(), }); } babel-7.12.12/packages/babel-helper-member-expression-to-functions/src/util.js000066400000000000000000000026071377064615700272500ustar00rootroot00000000000000/** * Test if a NodePath will be cast to boolean when evaluated. * * @example * // returns true * const nodePathAQDotB = NodePath("if (a?.#b) {}").get("test"); // a?.#b * willPathCastToBoolean(nodePathAQDotB) * @example * // returns false * willPathCastToBoolean(NodePath("a?.#b")) * @todo Respect transparent expression wrappers * @see {@link packages/babel-plugin-proposal-optional-chaining/src/util.js} * @param {NodePath} path * @returns {boolean} */ export function willPathCastToBoolean(path: NodePath): boolean { const maybeWrapped = path; const { node, parentPath } = maybeWrapped; if (parentPath.isLogicalExpression()) { const { operator, right } = parentPath.node; if ( operator === "&&" || operator === "||" || (operator === "??" && node === right) ) { return willPathCastToBoolean(parentPath); } } if (parentPath.isSequenceExpression()) { const { expressions } = parentPath.node; if (expressions[expressions.length - 1] === node) { return willPathCastToBoolean(parentPath); } else { // if it is in the middle of a sequence expression, we don't // care the return value so just cast to boolean for smaller // output return true; } } return ( parentPath.isConditional({ test: node }) || parentPath.isUnaryExpression({ operator: "!" }) || parentPath.isLoop({ test: node }) ); } babel-7.12.12/packages/babel-helper-module-imports/000077500000000000000000000000001377064615700220275ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-module-imports/.npmignore000066400000000000000000000000171377064615700240240ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-module-imports/README.md000066400000000000000000000005601377064615700233070ustar00rootroot00000000000000# @babel/helper-module-imports > Babel helper functions for inserting module loads See our website [@babel/helper-module-imports](https://babeljs.io/docs/en/babel-helper-module-imports) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-module-imports ``` or using yarn: ```sh yarn add @babel/helper-module-imports --dev ``` babel-7.12.12/packages/babel-helper-module-imports/package.json000066400000000000000000000011221377064615700243110ustar00rootroot00000000000000{ "name": "@babel/helper-module-imports", "version": "7.12.5", "description": "Babel helper functions for inserting module loads", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-module-imports" }, "main": "lib/index.js", "dependencies": { "@babel/types": "workspace:^7.12.5" }, "devDependencies": { "@babel/core": "workspace:*" } } babel-7.12.12/packages/babel-helper-module-imports/src/000077500000000000000000000000001377064615700226165ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-module-imports/src/import-builder.js000066400000000000000000000077511377064615700261240ustar00rootroot00000000000000import assert from "assert"; import * as t from "@babel/types"; /** * A class to track and accumulate mutations to the AST that will eventually * output a new require/import statement list. */ export default class ImportBuilder { _statements = []; _resultName = null; _scope = null; _hub = null; constructor(importedSource, scope, hub) { this._scope = scope; this._hub = hub; this._importedSource = importedSource; } done() { return { statements: this._statements, resultName: this._resultName, }; } import() { this._statements.push( t.importDeclaration([], t.stringLiteral(this._importedSource)), ); return this; } require() { this._statements.push( t.expressionStatement( t.callExpression(t.identifier("require"), [ t.stringLiteral(this._importedSource), ]), ), ); return this; } namespace(name = "namespace") { name = this._scope.generateUidIdentifier(name); const statement = this._statements[this._statements.length - 1]; assert(statement.type === "ImportDeclaration"); assert(statement.specifiers.length === 0); statement.specifiers = [t.importNamespaceSpecifier(name)]; this._resultName = t.cloneNode(name); return this; } default(name) { name = this._scope.generateUidIdentifier(name); const statement = this._statements[this._statements.length - 1]; assert(statement.type === "ImportDeclaration"); assert(statement.specifiers.length === 0); statement.specifiers = [t.importDefaultSpecifier(name)]; this._resultName = t.cloneNode(name); return this; } named(name, importName) { if (importName === "default") return this.default(name); name = this._scope.generateUidIdentifier(name); const statement = this._statements[this._statements.length - 1]; assert(statement.type === "ImportDeclaration"); assert(statement.specifiers.length === 0); statement.specifiers = [t.importSpecifier(name, t.identifier(importName))]; this._resultName = t.cloneNode(name); return this; } var(name) { name = this._scope.generateUidIdentifier(name); let statement = this._statements[this._statements.length - 1]; if (statement.type !== "ExpressionStatement") { assert(this._resultName); statement = t.expressionStatement(this._resultName); this._statements.push(statement); } this._statements[this._statements.length - 1] = t.variableDeclaration( "var", [t.variableDeclarator(name, statement.expression)], ); this._resultName = t.cloneNode(name); return this; } defaultInterop() { return this._interop(this._hub.addHelper("interopRequireDefault")); } wildcardInterop() { return this._interop(this._hub.addHelper("interopRequireWildcard")); } _interop(callee) { const statement = this._statements[this._statements.length - 1]; if (statement.type === "ExpressionStatement") { statement.expression = t.callExpression(callee, [statement.expression]); } else if (statement.type === "VariableDeclaration") { assert(statement.declarations.length === 1); statement.declarations[0].init = t.callExpression(callee, [ statement.declarations[0].init, ]); } else { assert.fail("Unexpected type."); } return this; } prop(name) { const statement = this._statements[this._statements.length - 1]; if (statement.type === "ExpressionStatement") { statement.expression = t.memberExpression( statement.expression, t.identifier(name), ); } else if (statement.type === "VariableDeclaration") { assert(statement.declarations.length === 1); statement.declarations[0].init = t.memberExpression( statement.declarations[0].init, t.identifier(name), ); } else { assert.fail("Unexpected type:" + statement.type); } return this; } read(name) { this._resultName = t.memberExpression(this._resultName, t.identifier(name)); } } babel-7.12.12/packages/babel-helper-module-imports/src/import-injector.js000066400000000000000000000320771377064615700263120ustar00rootroot00000000000000import assert from "assert"; import * as t from "@babel/types"; import ImportBuilder from "./import-builder"; import isModule from "./is-module"; export type ImportOptions = { /** * The module being referenced. */ importedSource: string | null, /** * The type of module being imported: * * * 'es6' - An ES6 module. * * 'commonjs' - A CommonJS module. (Default) */ importedType: "es6" | "commonjs", /** * The type of interop behavior for namespace/default/named when loading * CommonJS modules. * * ## 'babel' (Default) * * Load using Babel's interop. * * If '.__esModule' is true, treat as 'compiled', else: * * * Namespace: A copy of the module.exports with .default * populated by the module.exports object. * * Default: The module.exports value. * * Named: The .named property of module.exports. * * The 'ensureLiveReference' has no effect on the liveness of these. * * ## 'compiled' * * Assume the module is ES6 compiled to CommonJS. Useful to avoid injecting * interop logic if you are confident that the module is a certain format. * * * Namespace: The root module.exports object. * * Default: The .default property of the namespace. * * Named: The .named property of the namespace. * * Will return erroneous results if the imported module is _not_ compiled * from ES6 with Babel. * * ## 'uncompiled' * * Assume the module is _not_ ES6 compiled to CommonJS. Used a simplified * access pattern that doesn't require additional function calls. * * Will return erroneous results if the imported module _is_ compiled * from ES6 with Babel. * * * Namespace: The module.exports object. * * Default: The module.exports object. * * Named: The .named property of module.exports. */ importedInterop: "babel" | "node" | "compiled" | "uncompiled", /** * The type of CommonJS interop included in the environment that will be * loading the output code. * * * 'babel' - CommonJS modules load with Babel's interop. (Default) * * 'node' - CommonJS modules load with Node's interop. * * See descriptions in 'importedInterop' for more details. */ importingInterop: "babel" | "node", /** * Define whether we explicitly care that the import be a live reference. * Only applies when importing default and named imports, not the namespace. * * * true - Force imported values to be live references. * * false - No particular requirements. Keeps the code simplest. (Default) */ ensureLiveReference: boolean, /** * Define if we explicitly care that the result not be a property reference. * * * true - Force calls to exclude context. Useful if the value is going to * be used as function callee. * * false - No particular requirements for context of the access. (Default) */ ensureNoContext: boolean, }; /** * A general helper classes add imports via transforms. See README for usage. */ export default class ImportInjector { /** * The path used for manipulation. */ declare _programPath: NodePath; /** * The scope used to generate unique variable names. */ declare _programScope; /** * The file used to inject helpers and resolve paths. */ declare _hub; /** * The default options to use with this instance when imports are added. */ _defaultOpts: ImportOptions = { importedSource: null, importedType: "commonjs", importedInterop: "babel", importingInterop: "babel", ensureLiveReference: false, ensureNoContext: false, }; constructor(path, importedSource, opts) { const programPath = path.find(p => p.isProgram()); this._programPath = programPath; this._programScope = programPath.scope; this._hub = programPath.hub; this._defaultOpts = this._applyDefaults(importedSource, opts, true); } addDefault(importedSourceIn, opts) { return this.addNamed("default", importedSourceIn, opts); } addNamed(importName, importedSourceIn, opts) { assert(typeof importName === "string"); return this._generateImport( this._applyDefaults(importedSourceIn, opts), importName, ); } addNamespace(importedSourceIn, opts) { return this._generateImport( this._applyDefaults(importedSourceIn, opts), null, ); } addSideEffect(importedSourceIn, opts) { return this._generateImport( this._applyDefaults(importedSourceIn, opts), false, ); } _applyDefaults(importedSource, opts, isInit = false) { const optsList = []; if (typeof importedSource === "string") { optsList.push({ importedSource }); optsList.push(opts); } else { assert(!opts, "Unexpected secondary arguments."); optsList.push(importedSource); } const newOpts = { ...this._defaultOpts, }; for (const opts of optsList) { if (!opts) continue; Object.keys(newOpts).forEach(key => { if (opts[key] !== undefined) newOpts[key] = opts[key]; }); if (!isInit) { if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint; if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist; } } return newOpts; } _generateImport(opts, importName) { const isDefault = importName === "default"; const isNamed = !!importName && !isDefault; const isNamespace = importName === null; const { importedSource, importedType, importedInterop, importingInterop, ensureLiveReference, ensureNoContext, nameHint, // Not meant for public usage. Allows code that absolutely must control // ordering to set a specific hoist value on the import nodes. blockHoist, } = opts; // Provide a hint for generateUidIdentifier for the local variable name // to use for the import, if the code will generate a simple assignment // to a variable. let name = nameHint || importName; const isMod = isModule(this._programPath); const isModuleForNode = isMod && importingInterop === "node"; const isModuleForBabel = isMod && importingInterop === "babel"; const builder = new ImportBuilder( importedSource, this._programScope, this._hub, ); if (importedType === "es6") { if (!isModuleForNode && !isModuleForBabel) { throw new Error("Cannot import an ES6 module from CommonJS"); } // import * as namespace from ''; namespace // import def from ''; def // import { named } from ''; named builder.import(); if (isNamespace) { builder.namespace(nameHint || importedSource); } else if (isDefault || isNamed) { builder.named(name, importName); } } else if (importedType !== "commonjs") { throw new Error(`Unexpected interopType "${importedType}"`); } else if (importedInterop === "babel") { if (isModuleForNode) { // import _tmp from ''; var namespace = interopRequireWildcard(_tmp); namespace // import _tmp from ''; var def = interopRequireDefault(_tmp).default; def // import _tmp from ''; _tmp.named name = name !== "default" ? name : importedSource; const es6Default = `${importedSource}$es6Default`; builder.import(); if (isNamespace) { builder .default(es6Default) .var(name || importedSource) .wildcardInterop(); } else if (isDefault) { if (ensureLiveReference) { builder .default(es6Default) .var(name || importedSource) .defaultInterop() .read("default"); } else { builder .default(es6Default) .var(name) .defaultInterop() .prop(importName); } } else if (isNamed) { builder.default(es6Default).read(importName); } } else if (isModuleForBabel) { // import * as namespace from ''; namespace // import def from ''; def // import { named } from ''; named builder.import(); if (isNamespace) { builder.namespace(name || importedSource); } else if (isDefault || isNamed) { builder.named(name, importName); } } else { // var namespace = interopRequireWildcard(require('')); // var def = interopRequireDefault(require('')).default; def // var named = require('').named; named builder.require(); if (isNamespace) { builder.var(name || importedSource).wildcardInterop(); } else if ((isDefault || isNamed) && ensureLiveReference) { if (isDefault) { name = name !== "default" ? name : importedSource; builder.var(name).read(importName); builder.defaultInterop(); } else { builder.var(importedSource).read(importName); } } else if (isDefault) { builder.var(name).defaultInterop().prop(importName); } else if (isNamed) { builder.var(name).prop(importName); } } } else if (importedInterop === "compiled") { if (isModuleForNode) { // import namespace from ''; namespace // import namespace from ''; namespace.default // import namespace from ''; namespace.named builder.import(); if (isNamespace) { builder.default(name || importedSource); } else if (isDefault || isNamed) { builder.default(importedSource).read(name); } } else if (isModuleForBabel) { // import * as namespace from ''; namespace // import def from ''; def // import { named } from ''; named // Note: These lookups will break if the module has no __esModule set, // hence the warning that 'compiled' will not work on standard CommonJS. builder.import(); if (isNamespace) { builder.namespace(name || importedSource); } else if (isDefault || isNamed) { builder.named(name, importName); } } else { // var namespace = require(''); namespace // var namespace = require(''); namespace.default // var namespace = require(''); namespace.named // var named = require('').named; builder.require(); if (isNamespace) { builder.var(name || importedSource); } else if (isDefault || isNamed) { if (ensureLiveReference) { builder.var(importedSource).read(name); } else { builder.prop(importName).var(name); } } } } else if (importedInterop === "uncompiled") { if (isDefault && ensureLiveReference) { throw new Error("No live reference for commonjs default"); } if (isModuleForNode) { // import namespace from ''; namespace // import def from ''; def; // import namespace from ''; namespace.named builder.import(); if (isNamespace) { builder.default(name || importedSource); } else if (isDefault) { builder.default(name); } else if (isNamed) { builder.default(importedSource).read(name); } } else if (isModuleForBabel) { // import namespace from ''; // import def from ''; // import { named } from ''; named; // Note: These lookups will break if the module has __esModule set, // hence the warning that 'uncompiled' will not work on ES6 transpiled // to CommonJS. builder.import(); if (isNamespace) { builder.default(name || importedSource); } else if (isDefault) { builder.default(name); } else if (isNamed) { builder.named(name, importName); } } else { // var namespace = require(''); namespace // var def = require(''); def // var namespace = require(''); namespace.named // var named = require('').named; builder.require(); if (isNamespace) { builder.var(name || importedSource); } else if (isDefault) { builder.var(name); } else if (isNamed) { if (ensureLiveReference) { builder.var(importedSource).read(name); } else { builder.var(name).prop(importName); } } } } else { throw new Error(`Unknown importedInterop "${importedInterop}".`); } const { statements, resultName } = builder.done(); this._insertStatements(statements, blockHoist); if ( (isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier" ) { return t.sequenceExpression([t.numericLiteral(0), resultName]); } return resultName; } _insertStatements(statements, blockHoist = 3) { statements.forEach(node => { node._blockHoist = blockHoist; }); const targetPath = this._programPath.get("body").find(p => { const val = p.node._blockHoist; return Number.isFinite(val) && val < 4; }); if (targetPath) { targetPath.insertBefore(statements); } else { this._programPath.unshiftContainer("body", statements); } } } babel-7.12.12/packages/babel-helper-module-imports/src/index.js000066400000000000000000000012221377064615700242600ustar00rootroot00000000000000import ImportInjector from "./import-injector"; export { ImportInjector }; export { default as isModule } from "./is-module"; export function addDefault(path, importedSource, opts) { return new ImportInjector(path).addDefault(importedSource, opts); } export function addNamed(path, name, importedSource, opts) { return new ImportInjector(path).addNamed(name, importedSource, opts); } export function addNamespace(path, importedSource, opts) { return new ImportInjector(path).addNamespace(importedSource, opts); } export function addSideEffect(path, importedSource, opts) { return new ImportInjector(path).addSideEffect(importedSource, opts); } babel-7.12.12/packages/babel-helper-module-imports/src/is-module.js000066400000000000000000000005651377064615700250600ustar00rootroot00000000000000/** * A small utility to check if a file qualifies as a module. */ export default function isModule(path: NodePath) { const { sourceType } = path.node; if (sourceType !== "module" && sourceType !== "script") { throw path.buildCodeFrameError( `Unknown sourceType "${sourceType}", cannot transform.`, ); } return path.node.sourceType === "module"; } babel-7.12.12/packages/babel-helper-module-imports/test/000077500000000000000000000000001377064615700230065ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-module-imports/test/index.js000066400000000000000000000700121377064615700244530ustar00rootroot00000000000000import * as babel from "@babel/core"; import { ImportInjector } from "../"; function test(sourceType, opts, initializer, expectedCode) { if (typeof opts === "function") { expectedCode = initializer; initializer = opts; opts = null; } const result = babel.transform("", { cwd: __dirname, sourceType, filename: "example" + (sourceType === "module" ? ".mjs" : ".js"), babelrc: false, plugins: [ function ({ types: t }) { return { pre(file) { file.set("helperGenerator", name => t.memberExpression( t.identifier("babelHelpers"), t.identifier(name), ), ); }, visitor: { Program(path) { const manager = new ImportInjector(path, opts); const ref = initializer(manager); if (ref) path.pushContainer("body", t.expressionStatement(ref)); }, }, }; }, ], }); expect(result.code.replace(/\s+/g, " ").trim()).toBe( (expectedCode || "").replace(/\s+/g, " ").trim(), ); } const testScript = test.bind(undefined, "script"); const testModule = test.bind(undefined, "module"); describe("@babel/helper-module-imports", () => { describe("namespace import", () => { const addNamespace = opts => m => m.addNamespace("source", opts); describe("loading an ES6 module", () => { const importedType = "es6"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedType }, addNamespace(), ` import * as _source from "source"; _source; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedType }, addNamespace({ nameHint: "hintedName" }), ` import * as _hintedName from "source"; _hintedName; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedType }, addNamespace(), ` import * as _source from "source"; _source; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { expect(() => { testScript({ importedType }, addNamespace()); }).toThrow("Cannot import an ES6 module from CommonJS"); }); }); }); describe("loading CommonJS with 'uncompiled'", () => { const importedInterop = "uncompiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamespace(), ` import _source from "source"; _source; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamespace(), ` import _source from "source"; _source; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addNamespace(), ` var _source = require("source"); _source; `, ); }); }); }); describe("loading CommonJS with 'compiled'", () => { const importedInterop = "compiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamespace(), ` import _source from "source"; _source; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamespace(), ` import * as _source from "source"; _source; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addNamespace(), ` var _source = require("source"); _source; `, ); }); }); }); describe("loading CommonJS with 'babel'", () => { const importedInterop = "babel"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamespace(), ` import _source$es6Default from "source"; var _source = babelHelpers.interopRequireWildcard(_source$es6Default); _source; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamespace(), ` import * as _source from "source"; _source; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addNamespace(), ` var _source = babelHelpers.interopRequireWildcard(require("source")); _source; `, ); }); }); }); }); describe("default imports", () => { const addDefault = opts => m => m.addDefault("source", opts); describe("loading an ES6 module", () => { const importedType = "es6"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedType }, addDefault(), ` import _default from "source"; _default; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedType }, addDefault({ nameHint: "hintedName" }), ` import _hintedName from "source"; _hintedName; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedType }, addDefault(), ` import _default from "source"; _default; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedType }, addDefault({ nameHint: "hintedName" }), ` import _hintedName from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { expect(() => { testScript({ importedType }, addDefault()); }).toThrow("Cannot import an ES6 module from CommonJS"); }); }); }); describe("loading CommonJS with 'uncompiled'", () => { const importedInterop = "uncompiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addDefault(), ` import _default from "source"; _default; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addDefault({ nameHint: "hintedName" }), ` import _hintedName from "source"; _hintedName; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addDefault(), ` import _default from "source"; _default; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addDefault({ nameHint: "hintedName" }), ` import _hintedName from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addDefault(), ` var _default = require("source"); _default; `, ); }); it("should import with a name hint", () => { testScript( { importedInterop }, addDefault({ nameHint: "hintedName" }), ` var _hintedName = require("source"); _hintedName; `, ); }); it("should fail to import with force-enabled liveness", () => { expect(() => { testScript( { importedInterop, ensureLiveReference: true }, addDefault(), ); }).toThrow("No live reference for commonjs default"); }); }); }); describe("loading CommonJS with 'compiled'", () => { const importedInterop = "compiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addDefault(), ` import _source from "source"; _source.default; `, ); }); it("should import with a force-disabled context", () => { testModule( { importingInterop, importedInterop, ensureNoContext: true }, addDefault(), ` import _source from "source"; 0, _source.default; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addDefault(), ` import _default from "source"; _default; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addDefault({ nameHint: "hintedName" }), ` import _hintedName from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addDefault(), ` var _default = require("source").default; _default; `, ); }); it("should import with a name hint", () => { testScript( { importedInterop }, addDefault({ nameHint: "hintedName" }), ` var _hintedName = require("source").default; _hintedName; `, ); }); it("should import with force-enabled liveness", () => { testScript( { importedInterop, ensureLiveReference: true }, addDefault(), ` var _source = require("source"); _source.default; `, ); }); }); }); describe("loading CommonJS with 'babel'", () => { const importedInterop = "babel"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addDefault(), ` import _source$es6Default from "source"; var _source = babelHelpers.interopRequireDefault(_source$es6Default).default; _source; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addDefault({ nameHint: "hintedName" }), ` import _source$es6Default from "source"; var _hintedName = babelHelpers.interopRequireDefault(_source$es6Default).default; _hintedName; `, ); }); it("should import with force-enabled liveness", () => { testModule( { importingInterop, importedInterop, ensureLiveReference: true }, addDefault(), ` import _source$es6Default from "source"; var _source = babelHelpers.interopRequireDefault(_source$es6Default); _source.default; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addDefault(), ` import _default from "source"; _default; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addDefault({ nameHint: "hintedName" }), ` import _hintedName from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addDefault(), ` var _default = babelHelpers.interopRequireDefault(require("source")).default; _default; `, ); }); it("should import with a name hint", () => { testScript( { importedInterop }, addDefault({ nameHint: "hintedName" }), ` var _hintedName = babelHelpers.interopRequireDefault(require("source")).default; _hintedName; `, ); }); it("should import with force-enabled liveness", () => { testScript( { importedInterop, ensureLiveReference: true }, addDefault(), ` var _source = babelHelpers.interopRequireDefault(require("source")); _source.default; `, ); }); }); }); }); describe("named imports", () => { const addNamed = opts => m => m.addNamed("read", "source", opts); describe("loading an ES6 module", () => { const importedType = "es6"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedType }, addNamed(), ` import { read as _read } from "source"; _read; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedType }, addNamed({ nameHint: "hintedName" }), ` import { read as _hintedName } from "source"; _hintedName; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedType }, addNamed(), ` import { read as _read } from "source"; _read; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedType }, addNamed({ nameHint: "hintedName" }), ` import { read as _hintedName } from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { expect(() => { testScript({ importedType }, addNamed()); }).toThrow("Cannot import an ES6 module from CommonJS"); }); }); }); describe("loading CommonJS with 'uncompiled'", () => { const importedInterop = "uncompiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamed(), ` import _source from "source"; _source.read; `, ); }); it("should import with a force-disabled context", () => { testModule( { importingInterop, importedInterop, ensureNoContext: true }, addNamed(), ` import _source from "source"; 0, _source.read; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamed(), ` import { read as _read } from "source"; _read; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addNamed({ nameHint: "hintedName" }), ` import { read as _hintedName } from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addNamed(), ` var _read = require("source").read; _read; `, ); }); it("should import with a name hint", () => { testScript( { importedInterop }, addNamed({ nameHint: "hintedName" }), ` var _hintedName = require("source").read; _hintedName; `, ); }); it("should import with force-enabled liveness", () => { testScript( { importedInterop, ensureLiveReference: true }, addNamed(), ` var _source = require("source"); _source.read; `, ); }); }); }); describe("loading CommonJS with 'compiled'", () => { const importedInterop = "compiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamed(), ` import _source from "source"; _source.read; `, ); }); it("should import with a force-disabled context", () => { testModule( { importingInterop, importedInterop, ensureNoContext: true }, addNamed(), ` import _source from "source"; 0, _source.read; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamed(), ` import { read as _read } from "source"; _read; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addNamed({ nameHint: "hintedName" }), ` import { read as _hintedName } from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addNamed(), ` var _read = require("source").read; _read; `, ); }); it("should import with a name hint", () => { testScript( { importedInterop }, addNamed({ nameHint: "hintedName" }), ` var _hintedName = require("source").read; _hintedName; `, ); }); it("should import with force-enabled liveness", () => { testScript( { importedInterop, ensureLiveReference: true }, addNamed(), ` var _source = require("source"); _source.read; `, ); }); }); }); describe("loading CommonJS with 'babel'", () => { const importedInterop = "babel"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamed(), ` import _source$es6Default from "source"; _source$es6Default.read; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addNamed(), ` import { read as _read } from "source"; _read; `, ); }); it("should import with a name hint", () => { testModule( { importingInterop, importedInterop }, addNamed({ nameHint: "hintedName" }), ` import { read as _hintedName } from "source"; _hintedName; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addNamed(), ` var _read = require("source").read; _read; `, ); }); it("should import with a name hint", () => { testScript( { importedInterop }, addNamed({ nameHint: "hintedName" }), ` var _hintedName = require("source").read; _hintedName; `, ); }); it("should import with force-enabled liveness", () => { testScript( { importedInterop, ensureLiveReference: true }, addNamed(), ` var _source = require("source"); _source.read; `, ); }); }); }); }); describe("side-effectful imports", () => { const addSideEffect = opts => m => m.addSideEffect("source", opts); describe("loading an ES6 module", () => { const importedType = "es6"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedType }, addSideEffect(), ` import "source"; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedType }, addSideEffect(), ` import "source"; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { expect(() => { testScript({ importedType }, addSideEffect()); }).toThrow("Cannot import an ES6 module from CommonJS"); }); }); }); describe("loading CommonJS with 'uncompiled'", () => { const importedInterop = "uncompiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addSideEffect(), ` import "source"; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addSideEffect(), ` import "source"; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addSideEffect(), ` require("source"); `, ); }); }); }); describe("loading CommonJS with 'compiled'", () => { const importedInterop = "compiled"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addSideEffect(), ` import "source"; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addSideEffect(), ` import "source"; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addSideEffect(), ` require("source"); `, ); }); }); }); describe("loading CommonJS with 'babel'", () => { const importedInterop = "babel"; describe("using Node's interop", () => { const importingInterop = "node"; it("should import", () => { testModule( { importingInterop, importedInterop }, addSideEffect(), ` import "source"; `, ); }); }); describe("using Babel's interop", () => { const importingInterop = "babel"; it("should import", () => { testModule( { importingInterop, importedInterop }, addSideEffect(), ` import "source"; `, ); }); }); describe("using a CommonJS loader", () => { it("should import", () => { testScript( { importedInterop }, addSideEffect(), ` require("source"); `, ); }); }); }); }); }); babel-7.12.12/packages/babel-helper-module-transforms/000077500000000000000000000000001377064615700225305ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-module-transforms/.npmignore000066400000000000000000000000171377064615700245250ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-module-transforms/README.md000066400000000000000000000006201377064615700240050ustar00rootroot00000000000000# @babel/helper-module-transforms > Babel helper functions for implementing ES6 module transformations See our website [@babel/helper-module-transforms](https://babeljs.io/docs/en/babel-helper-module-transforms) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-module-transforms ``` or using yarn: ```sh yarn add @babel/helper-module-transforms --dev ``` babel-7.12.12/packages/babel-helper-module-transforms/package.json000066400000000000000000000017121377064615700250170ustar00rootroot00000000000000{ "name": "@babel/helper-module-transforms", "version": "7.12.1", "description": "Babel helper functions for implementing ES6 module transformations", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-module-transforms" }, "main": "lib/index.js", "dependencies": { "@babel/helper-module-imports": "workspace:^7.12.1", "@babel/helper-replace-supers": "workspace:^7.12.1", "@babel/helper-simple-access": "workspace:^7.12.1", "@babel/helper-split-export-declaration": "workspace:^7.11.0", "@babel/helper-validator-identifier": "workspace:^7.10.4", "@babel/template": "workspace:^7.10.4", "@babel/traverse": "workspace:^7.12.1", "@babel/types": "workspace:^7.12.1", "lodash": "^4.17.19" } } babel-7.12.12/packages/babel-helper-module-transforms/src/000077500000000000000000000000001377064615700233175ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-module-transforms/src/get-module-name.js000066400000000000000000000023341377064615700266370ustar00rootroot00000000000000// @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; } } babel-7.12.12/packages/babel-helper-module-transforms/src/index.js000066400000000000000000000265101377064615700247700ustar00rootroot00000000000000import assert from "assert"; import * as t from "@babel/types"; import template from "@babel/template"; import chunk from "lodash/chunk"; import { isModule } from "@babel/helper-module-imports"; import rewriteThis from "./rewrite-this"; import rewriteLiveReferences from "./rewrite-live-references"; import normalizeAndLoadModuleMetadata, { hasExports, isSideEffectImport, type ModuleMetadata, type SourceModuleMetadata, } from "./normalize-and-load-metadata"; 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 * module processing. This function will rewrite the majority of the given * program to reference the modules described by the returned metadata, * and returns a list of statements for use when initializing the module. */ export function rewriteModuleStatementsAndPrepareHeader( path: NodePath, { exportName, strict, allowTopLevelThis, strictMode, loose, noInterop, lazy, esNamespaceOnly, }, ) { assert(isModule(path), "Cannot process module statements in a script"); path.node.sourceType = "script"; const meta = normalizeAndLoadModuleMetadata(path, exportName, { noInterop, loose, lazy, esNamespaceOnly, }); if (!allowTopLevelThis) { rewriteThis(path); } rewriteLiveReferences(path, meta); if (strictMode !== false) { const hasStrict = path.node.directives.some(directive => { return directive.value.value === "use strict"; }); if (!hasStrict) { path.unshiftContainer( "directives", t.directive(t.directiveLiteral("use strict")), ); } } const headers = []; if (hasExports(meta) && !strict) { headers.push(buildESModuleHeader(meta, loose /* enumerable */)); } const nameList = buildExportNameListDeclaration(path, meta); if (nameList) { meta.exportNameListName = nameList.name; headers.push(nameList.statement); } // Create all of the statically known named exports. headers.push(...buildExportInitializationStatements(path, meta, loose)); return { meta, headers }; } /** * Flag a set of statements as hoisted above all else so that module init * statements all run before user code. */ export function ensureStatementsHoisted(statements) { // Force all of the header fields to be at the top of the file. statements.forEach(header => { header._blockHoist = 3; }); } /** * Given an expression for a standard import object, like "require('foo')", * wrap it in a call to the interop helpers based on the type. */ export function wrapInterop( programPath: NodePath, expr: Node, type: InteropType, ): Node { if (type === "none") { return null; } let helper; if (type === "default") { helper = "interopRequireDefault"; } else if (type === "namespace") { helper = "interopRequireWildcard"; } else { throw new Error(`Unknown interop: ${type}`); } return t.callExpression(programPath.hub.addHelper(helper), [expr]); } /** * Create the runtime initialization statements for a given requested source. * These will initialize all of the runtime import/export logic that * can't be handled statically by the statements created by * buildExportInitializationStatements(). */ export function buildNamespaceInitStatements( metadata: ModuleMetadata, sourceMetadata: SourceModuleMetadata, loose: boolean = false, ) { const statements = []; let srcNamespace = t.identifier(sourceMetadata.name); if (sourceMetadata.lazy) srcNamespace = t.callExpression(srcNamespace, []); for (const localName of sourceMetadata.importsNamespace) { if (localName === sourceMetadata.name) continue; // Create and assign binding to namespace object statements.push( template.statement`var NAME = SOURCE;`({ NAME: localName, SOURCE: t.cloneNode(srcNamespace), }), ); } if (loose) { statements.push(...buildReexportsFromMeta(metadata, sourceMetadata, loose)); } for (const exportName of sourceMetadata.reexportNamespace) { // Assign export to namespace object. statements.push( (sourceMetadata.lazy ? template.statement` Object.defineProperty(EXPORTS, "NAME", { enumerable: true, get: function() { return NAMESPACE; } }); ` : template.statement`EXPORTS.NAME = NAMESPACE;`)({ EXPORTS: metadata.exportName, NAME: exportName, NAMESPACE: t.cloneNode(srcNamespace), }), ); } if (sourceMetadata.reexportAll) { const statement = buildNamespaceReexport( metadata, t.cloneNode(srcNamespace), loose, ); statement.loc = sourceMetadata.reexportAll.loc; // Iterate props creating getter for each prop. statements.push(statement); } return statements; } const ReexportTemplate = { loose: template.statement`EXPORTS.EXPORT_NAME = NAMESPACE_IMPORT;`, looseComputed: template.statement`EXPORTS["EXPORT_NAME"] = NAMESPACE_IMPORT;`, spec: template` Object.defineProperty(EXPORTS, "EXPORT_NAME", { enumerable: true, get: function() { return NAMESPACE_IMPORT; }, }); `, }; const buildReexportsFromMeta = ( meta: ModuleMetadata, metadata: SourceModuleMetadata, loose, ) => { const namespace = metadata.lazy ? t.callExpression(t.identifier(metadata.name), []) : t.identifier(metadata.name); const { stringSpecifiers } = meta; return Array.from(metadata.reexports, ([exportName, importName]) => { let NAMESPACE_IMPORT; if (stringSpecifiers.has(importName)) { NAMESPACE_IMPORT = t.memberExpression( t.cloneNode(namespace), t.stringLiteral(importName), true, ); } else { NAMESPACE_IMPORT = NAMESPACE_IMPORT = t.memberExpression( t.cloneNode(namespace), t.identifier(importName), ); } const astNodes = { EXPORTS: meta.exportName, EXPORT_NAME: exportName, NAMESPACE_IMPORT, }; if (loose) { if (stringSpecifiers.has(exportName)) { return ReexportTemplate.looseComputed(astNodes); } else { return ReexportTemplate.loose(astNodes); } } else { return ReexportTemplate.spec(astNodes); } }); }; /** * Build an "__esModule" header statement setting the property on a given object. */ function buildESModuleHeader( metadata: ModuleMetadata, enumerable: boolean = false, ) { return (enumerable ? template.statement` EXPORTS.__esModule = true; ` : template.statement` Object.defineProperty(EXPORTS, "__esModule", { value: true, }); `)({ EXPORTS: metadata.exportName }); } /** * Create a re-export initialization loop for a specific imported namespace. */ function buildNamespaceReexport(metadata, namespace, loose) { return (loose ? template.statement` Object.keys(NAMESPACE).forEach(function(key) { if (key === "default" || key === "__esModule") return; VERIFY_NAME_LIST; if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return; EXPORTS[key] = NAMESPACE[key]; }); ` : // Also skip already assigned bindings if they are strictly equal // to be somewhat more spec-compliant when a file has multiple // namespace re-exports that would cause a binding to be exported // multiple times. However, multiple bindings of the same name that // export the same primitive value are silently skipped // (the spec requires an "ambigous bindings" early error here). template.statement` Object.keys(NAMESPACE).forEach(function(key) { if (key === "default" || key === "__esModule") return; VERIFY_NAME_LIST; if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return; Object.defineProperty(EXPORTS, key, { enumerable: true, get: function() { return NAMESPACE[key]; }, }); }); `)({ NAMESPACE: namespace, EXPORTS: metadata.exportName, VERIFY_NAME_LIST: metadata.exportNameListName ? template` if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; `({ EXPORTS_LIST: metadata.exportNameListName }) : null, }); } /** * Build a statement declaring a variable that contains all of the exported * variable names in an object so they can easily be referenced from an * export * from statement to check for conflicts. */ function buildExportNameListDeclaration( programPath: NodePath, metadata: ModuleMetadata, ) { const exportedVars = Object.create(null); for (const data of metadata.local.values()) { for (const name of data.names) { exportedVars[name] = true; } } let hasReexport = false; for (const data of metadata.source.values()) { for (const exportName of data.reexports.keys()) { exportedVars[exportName] = true; } for (const exportName of data.reexportNamespace) { exportedVars[exportName] = true; } hasReexport = hasReexport || data.reexportAll; } if (!hasReexport || Object.keys(exportedVars).length === 0) return null; const name = programPath.scope.generateUidIdentifier("exportNames"); delete exportedVars.default; return { name: name.name, statement: t.variableDeclaration("var", [ t.variableDeclarator(name, t.valueToNode(exportedVars)), ]), }; } /** * Create a set of statements that will initialize all of the statically-known * export names with their expected values. */ function buildExportInitializationStatements( programPath: NodePath, metadata: ModuleMetadata, loose: boolean = false, ) { const initStatements = []; const exportNames = []; for (const [localName, data] of metadata.local) { if (data.kind === "import") { // No-open since these are explicitly set with the "reexports" block. } else if (data.kind === "hoisted") { initStatements.push( buildInitStatement(metadata, data.names, t.identifier(localName)), ); } else { exportNames.push(...data.names); } } for (const data of metadata.source.values()) { if (!loose) { initStatements.push(...buildReexportsFromMeta(metadata, data, loose)); } for (const exportName of data.reexportNamespace) { exportNames.push(exportName); } } initStatements.push( ...chunk(exportNames, 100).map(members => { return buildInitStatement( metadata, members, programPath.scope.buildUndefinedNode(), ); }), ); return initStatements; } /** * Given a set of export names, create a set of nested assignments to * initialize them all to a given expression. */ const InitTemplate = { computed: template.expression`EXPORTS["NAME"] = VALUE`, default: template.expression`EXPORTS.NAME = VALUE`, }; function buildInitStatement(metadata: ModuleMetadata, exportNames, initExpr) { const { stringSpecifiers, exportName: EXPORTS } = metadata; return t.expressionStatement( exportNames.reduce((acc, exportName) => { const params = { EXPORTS, NAME: exportName, VALUE: acc, }; if (stringSpecifiers.has(exportName)) { return InitTemplate.computed(params); } else { return InitTemplate.default(params); } }, initExpr), ); } babel-7.12.12/packages/babel-helper-module-transforms/src/normalize-and-load-metadata.js000066400000000000000000000354171377064615700311220ustar00rootroot00000000000000import { basename, extname } from "path"; import { isIdentifierName } from "@babel/helper-validator-identifier"; import splitExportDeclaration from "@babel/helper-split-export-declaration"; export type ModuleMetadata = { exportName: string, // The name of the variable that will reference an object containing export names. exportNameListName: null | string, hasExports: boolean, // Lookup from local binding to export information. local: Map, // Lookup of source file to source file metadata. source: Map, // List of names that should only be printed as string literals. // i.e. `import { "any unicode" as foo } from "some-module"` // `stringSpecifiers` is Set(1) ["any unicode"] // In most cases `stringSpecifiers` is an empty Set stringSpecifiers: Set, }; export type InteropType = "default" | "namespace" | "none"; export type SourceModuleMetadata = { // A unique variable name to use for this namespace object. Centralized for simplicity. name: string, loc: ?BabelNodeSourceLocation, interop: InteropType, // Local binding to reference from this source namespace. Key: Local name, value: Import name imports: Map, // Local names that reference namespace object. importsNamespace: Set, // Reexports to create for namespace. Key: Export name, value: Import name reexports: Map, // List of names to re-export namespace as. reexportNamespace: Set, // Tracks if the source should be re-exported. reexportAll: null | { loc: ?BabelNodeSourceLocation, }, }; export type LocalExportMetadata = { name: Array, // names of exports kind: "import" | "hoisted" | "block" | "var", }; /** * Check if the module has any exports that need handling. */ export function hasExports(metadata: ModuleMetadata) { return metadata.hasExports; } /** * Check if a given source is an anonymous import, e.g. "import 'foo';" */ export function isSideEffectImport(source: SourceModuleMetadata) { return ( source.imports.size === 0 && source.importsNamespace.size === 0 && source.reexports.size === 0 && source.reexportNamespace.size === 0 && !source.reexportAll ); } /** * Remove all imports and exports from the file, and return all metadata * needed to reconstruct the module's behavior. */ export default function normalizeModuleAndLoadMetadata( programPath: NodePath, exportName?: string, { noInterop = false, loose = false, lazy = false, esNamespaceOnly = false, } = {}, ): ModuleMetadata { if (!exportName) { exportName = programPath.scope.generateUidIdentifier("exports").name; } const stringSpecifiers = new Set(); nameAnonymousExports(programPath); const { local, source, hasExports } = getModuleMetadata( programPath, { loose, lazy, }, stringSpecifiers, ); removeModuleDeclarations(programPath); // Reuse the imported namespace name if there is one. for (const [, metadata] of source) { if (metadata.importsNamespace.size > 0) { // This is kind of gross. If we stop using `loose: true` we should // just make this destructuring assignment. metadata.name = metadata.importsNamespace.values().next().value; } if (noInterop) metadata.interop = "none"; else if (esNamespaceOnly) { // Both the default and namespace interops pass through __esModule // objects, but the namespace interop is used to enable Babel's // destructuring-like interop behavior for normal CommonJS. // Since some tooling has started to remove that behavior, we expose // it as the `esNamespace` option. if (metadata.interop === "namespace") { metadata.interop = "default"; } } } return { exportName, exportNameListName: null, hasExports, local, source, stringSpecifiers, }; } function getExportSpecifierName( path: NodePath, stringSpecifiers: Set, ): string { if (path.isIdentifier()) { return path.node.name; } else if (path.isStringLiteral()) { const stringValue = path.node.value; // add specifier value to `stringSpecifiers` only when it can not be converted to an identifier name // i.e In `import { "foo" as bar }` // we do not consider `"foo"` to be a `stringSpecifier` because we can treat it as // `import { foo as bar }` // This helps minimize the size of `stringSpecifiers` and reduce overhead of checking valid identifier names // when building transpiled code from metadata if (!isIdentifierName(stringValue)) { stringSpecifiers.add(stringValue); } return stringValue; } else { throw new Error( `Expected export specifier to be either Identifier or StringLiteral, got ${path.node.type}`, ); } } /** * Get metadata about the imports and exports present in this module. */ function getModuleMetadata( programPath: NodePath, { loose, lazy }: { loose: boolean, lazy: boolean }, stringSpecifiers: Set, ) { const localData = getLocalExportMetadata( programPath, loose, stringSpecifiers, ); const sourceData = new Map(); const getData = sourceNode => { const source = sourceNode.value; let data = sourceData.get(source); if (!data) { data = { name: programPath.scope.generateUidIdentifier( basename(source, extname(source)), ).name, interop: "none", loc: null, // Data about the requested sources and names. imports: new Map(), importsNamespace: new Set(), // Metadata about data that is passed directly from source to export. reexports: new Map(), reexportNamespace: new Set(), reexportAll: null, lazy: false, }; sourceData.set(source, data); } return data; }; let hasExports = false; programPath.get("body").forEach(child => { if (child.isImportDeclaration()) { const data = getData(child.node.source); if (!data.loc) data.loc = child.node.loc; child.get("specifiers").forEach(spec => { if (spec.isImportDefaultSpecifier()) { const localName = spec.get("local").node.name; data.imports.set(localName, "default"); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexports.set(name, "default"); }); } } else if (spec.isImportNamespaceSpecifier()) { const localName = spec.get("local").node.name; data.importsNamespace.add(localName); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexportNamespace.add(name); }); } } else if (spec.isImportSpecifier()) { const importName = getExportSpecifierName( spec.get("imported"), stringSpecifiers, ); const localName = spec.get("local").node.name; data.imports.set(localName, importName); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexports.set(name, importName); }); } } }); } else if (child.isExportAllDeclaration()) { hasExports = true; const data = getData(child.node.source); if (!data.loc) data.loc = child.node.loc; data.reexportAll = { loc: child.node.loc, }; } else if (child.isExportNamedDeclaration() && child.node.source) { hasExports = true; const data = getData(child.node.source); if (!data.loc) data.loc = child.node.loc; child.get("specifiers").forEach(spec => { if (!spec.isExportSpecifier()) { throw spec.buildCodeFrameError("Unexpected export specifier type"); } const importName = getExportSpecifierName( spec.get("local"), stringSpecifiers, ); const exportName = getExportSpecifierName( spec.get("exported"), stringSpecifiers, ); data.reexports.set(exportName, importName); if (exportName === "__esModule") { throw exportName.buildCodeFrameError('Illegal export "__esModule".'); } }); } else if ( child.isExportNamedDeclaration() || child.isExportDefaultDeclaration() ) { hasExports = true; } }); for (const metadata of sourceData.values()) { let needsDefault = false; let needsNamed = false; if (metadata.importsNamespace.size > 0) { needsDefault = true; needsNamed = true; } if (metadata.reexportAll) { needsNamed = true; } for (const importName of metadata.imports.values()) { if (importName === "default") needsDefault = true; else needsNamed = true; } for (const importName of metadata.reexports.values()) { if (importName === "default") needsDefault = true; else needsNamed = true; } if (needsDefault && needsNamed) { // TODO(logan): Using the namespace interop here is unfortunate. Revisit. metadata.interop = "namespace"; } else if (needsDefault) { metadata.interop = "default"; } } for (const [source, metadata] of sourceData) { if ( lazy !== false && !(isSideEffectImport(metadata) || metadata.reexportAll) ) { if (lazy === true) { // 'true' means that local relative files are eagerly loaded and // dependency modules are loaded lazily. metadata.lazy = !/\./.test(source); } else if (Array.isArray(lazy)) { metadata.lazy = lazy.indexOf(source) !== -1; } else if (typeof lazy === "function") { metadata.lazy = lazy(source); } else { throw new Error(`.lazy must be a boolean, string array, or function`); } } } return { hasExports, local: localData, source: sourceData, }; } /** * Get metadata about local variables that are exported. */ function getLocalExportMetadata( programPath: NodePath, loose: boolean, stringSpecifiers: Set, ): Map { const bindingKindLookup = new Map(); programPath.get("body").forEach(child => { let kind; if (child.isImportDeclaration()) { kind = "import"; } else { if (child.isExportDefaultDeclaration()) child = child.get("declaration"); if (child.isExportNamedDeclaration()) { if (child.node.declaration) { child = child.get("declaration"); } else if ( loose && child.node.source && child.get("source").isStringLiteral() ) { child.node.specifiers.forEach(specifier => { bindingKindLookup.set(specifier.local.name, "block"); }); return; } } if (child.isFunctionDeclaration()) { kind = "hoisted"; } else if (child.isClassDeclaration()) { kind = "block"; } else if (child.isVariableDeclaration({ kind: "var" })) { kind = "var"; } else if (child.isVariableDeclaration()) { kind = "block"; } else { return; } } Object.keys(child.getOuterBindingIdentifiers()).forEach(name => { bindingKindLookup.set(name, kind); }); }); const localMetadata = new Map(); const getLocalMetadata = idPath => { const localName = idPath.node.name; let metadata = localMetadata.get(localName); if (!metadata) { const kind = bindingKindLookup.get(localName); if (kind === undefined) { throw idPath.buildCodeFrameError( `Exporting local "${localName}", which is not declared.`, ); } metadata = { names: [], kind, }; localMetadata.set(localName, metadata); } return metadata; }; programPath.get("body").forEach(child => { if (child.isExportNamedDeclaration() && (loose || !child.node.source)) { if (child.node.declaration) { const declaration = child.get("declaration"); const ids = declaration.getOuterBindingIdentifierPaths(); Object.keys(ids).forEach(name => { if (name === "__esModule") { throw declaration.buildCodeFrameError( 'Illegal export "__esModule".', ); } getLocalMetadata(ids[name]).names.push(name); }); } else { child.get("specifiers").forEach(spec => { const local = spec.get("local"); const exported = spec.get("exported"); const localMetadata = getLocalMetadata(local); const exportName = getExportSpecifierName(exported, stringSpecifiers); if (exportName === "__esModule") { throw exported.buildCodeFrameError('Illegal export "__esModule".'); } localMetadata.names.push(exportName); }); } } else if (child.isExportDefaultDeclaration()) { const declaration = child.get("declaration"); if ( declaration.isFunctionDeclaration() || declaration.isClassDeclaration() ) { getLocalMetadata(declaration.get("id")).names.push("default"); } else { // These should have been removed by the nameAnonymousExports() call. throw declaration.buildCodeFrameError( "Unexpected default expression export.", ); } } }); return localMetadata; } /** * Ensure that all exported values have local binding names. */ function nameAnonymousExports(programPath: NodePath) { // Name anonymous exported locals. programPath.get("body").forEach(child => { if (!child.isExportDefaultDeclaration()) return; splitExportDeclaration(child); }); } function removeModuleDeclarations(programPath: NodePath) { programPath.get("body").forEach(child => { if (child.isImportDeclaration()) { child.remove(); } else if (child.isExportNamedDeclaration()) { if (child.node.declaration) { child.node.declaration._blockHoist = child.node._blockHoist; child.replaceWith(child.node.declaration); } else { child.remove(); } } else if (child.isExportDefaultDeclaration()) { // export default foo; const declaration = child.get("declaration"); if ( declaration.isFunctionDeclaration() || declaration.isClassDeclaration() ) { declaration._blockHoist = child.node._blockHoist; child.replaceWith(declaration); } else { // These should have been removed by the nameAnonymousExports() call. throw declaration.buildCodeFrameError( "Unexpected default expression export.", ); } } else if (child.isExportAllDeclaration()) { child.remove(); } }); } babel-7.12.12/packages/babel-helper-module-transforms/src/rewrite-live-references.js000066400000000000000000000242401377064615700304140ustar00rootroot00000000000000import assert from "assert"; import * as t from "@babel/types"; import template from "@babel/template"; import simplifyAccess from "@babel/helper-simple-access"; import type { ModuleMetadata } from "./normalize-and-load-metadata"; export default function rewriteLiveReferences( programPath: NodePath, metadata: ModuleMetadata, ) { const imported = new Map(); const exported = new Map(); const requeueInParent = path => { // Manually re-queue `exports.default =` expressions so that the ES3 // transform has an opportunity to convert them. Ideally this would // happen automatically from the replaceWith above. See #4140 for // more info. programPath.requeue(path); }; for (const [source, data] of metadata.source) { for (const [localName, importName] of data.imports) { imported.set(localName, [source, importName, null]); } for (const localName of data.importsNamespace) { imported.set(localName, [source, null, localName]); } } for (const [local, data] of metadata.local) { let exportMeta = exported.get(local); if (!exportMeta) { exportMeta = []; exported.set(local, exportMeta); } exportMeta.push(...data.names); } // Rewrite initialization of bindings to update exports. programPath.traverse(rewriteBindingInitVisitor, { metadata, requeueInParent, scope: programPath.scope, exported, // local name => exported name list }); simplifyAccess( programPath, // NOTE(logan): The 'Array.from' calls are to make this code with in loose mode. new Set([...Array.from(imported.keys()), ...Array.from(exported.keys())]), ); // Rewrite reads/writes from imports and exports to have the correct behavior. programPath.traverse(rewriteReferencesVisitor, { seen: new WeakSet(), metadata, requeueInParent, scope: programPath.scope, imported, // local / import exported, // local name => exported name list buildImportReference: ([source, importName, localName], identNode) => { const meta = metadata.source.get(source); if (localName) { if (meta.lazy) identNode = t.callExpression(identNode, []); return identNode; } let namespace = t.identifier(meta.name); if (meta.lazy) namespace = t.callExpression(namespace, []); const computed = metadata.stringSpecifiers.has(importName); return t.memberExpression( namespace, computed ? t.stringLiteral(importName) : t.identifier(importName), computed, ); }, }); } /** * A visitor to inject export update statements during binding initialization. */ const rewriteBindingInitVisitor = { Scope(path) { path.skip(); }, ClassDeclaration(path) { const { requeueInParent, exported, metadata } = this; const { id } = path.node; if (!id) throw new Error("Expected class to have a name"); const localName = id.name; const exportNames = exported.get(localName) || []; if (exportNames.length > 0) { const statement = t.expressionStatement( buildBindingExportAssignmentExpression( metadata, exportNames, t.identifier(localName), ), ); statement._blockHoist = path.node._blockHoist; requeueInParent(path.insertAfter(statement)[0]); } }, VariableDeclaration(path) { const { requeueInParent, exported, metadata } = this; Object.keys(path.getOuterBindingIdentifiers()).forEach(localName => { const exportNames = exported.get(localName) || []; if (exportNames.length > 0) { const statement = t.expressionStatement( buildBindingExportAssignmentExpression( metadata, exportNames, t.identifier(localName), ), ); statement._blockHoist = path.node._blockHoist; requeueInParent(path.insertAfter(statement)[0]); } }); }, }; const buildBindingExportAssignmentExpression = ( metadata, exportNames, localExpr, ) => { return (exportNames || []).reduce((expr, exportName) => { // class Foo {} export { Foo, Foo as Bar }; // as // class Foo {} exports.Foo = exports.Bar = Foo; const { stringSpecifiers } = metadata; const computed = stringSpecifiers.has(exportName); return t.assignmentExpression( "=", t.memberExpression( t.identifier(metadata.exportName), computed ? t.stringLiteral(exportName) : t.identifier(exportName), /* computed */ computed, ), expr, ); }, localExpr); }; const buildImportThrow = localName => { return template.expression.ast` (function() { throw new Error('"' + '${localName}' + '" is read-only.'); })() `; }; const rewriteReferencesVisitor = { ReferencedIdentifier(path) { const { seen, buildImportReference, scope, imported, requeueInParent, } = this; if (seen.has(path.node)) return; seen.add(path.node); const localName = path.node.name; const localBinding = path.scope.getBinding(localName); const rootBinding = scope.getBinding(localName); // redeclared in this scope if (rootBinding !== localBinding) return; const importData = imported.get(localName); if (importData) { const ref = buildImportReference(importData, path.node); // Preserve the binding location so that sourcemaps are nicer. ref.loc = path.node.loc; if ( (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])); } else if (path.isJSXIdentifier() && t.isMemberExpression(ref)) { const { object, property } = ref; path.replaceWith( t.JSXMemberExpression( t.JSXIdentifier(object.name), t.JSXIdentifier(property.name), ), ); } else { path.replaceWith(ref); } requeueInParent(path); // The path could have been replaced with an identifier that would // otherwise be re-visited, so we skip processing its children. path.skip(); } }, AssignmentExpression: { exit(path) { const { scope, seen, imported, exported, requeueInParent, buildImportReference, } = this; if (seen.has(path.node)) return; 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); const localName = left.node.name; // redeclared in this scope if (scope.getBinding(localName) !== path.scope.getBinding(localName)) { return; } const exportedNames = exported.get(localName); const importData = imported.get(localName); if (exportedNames?.length > 0 || importData) { assert(path.node.operator === "=", "Path was not simplified"); const assignment = path.node; if (importData) { assignment.left = buildImportReference(importData, assignment.left); assignment.right = t.sequenceExpression([ assignment.right, buildImportThrow(localName), ]); } path.replaceWith( buildBindingExportAssignmentExpression( this.metadata, exportedNames, assignment, ), ); requeueInParent(path); } } else { const ids = left.getOuterBindingIdentifiers(); 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, buildImportThrow(id), ]); } // Complex ({a, b, c} = {}); export { a, c }; // => ({a, b, c} = {}), (exports.a = a, exports.c = c); const items = []; programScopeIds.forEach(localName => { const exportedNames = exported.get(localName) || []; if (exportedNames.length > 0) { items.push( buildBindingExportAssignmentExpression( this.metadata, exportedNames, t.identifier(localName), ), ); } }); if (items.length > 0) { let node = t.sequenceExpression(items); if (path.parentPath.isExpressionStatement()) { node = t.expressionStatement(node); node._blockHoist = path.parentPath.node._blockHoist; } const statement = path.insertAfter(node)[0]; requeueInParent(statement); } } }, }, "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(t.cloneNode(newLoopId)), ]), ); scope.registerDeclaration(path.get("left")); } }, }; babel-7.12.12/packages/babel-helper-module-transforms/src/rewrite-this.js000066400000000000000000000012031377064615700262770ustar00rootroot00000000000000import { environmentVisitor } from "@babel/helper-replace-supers"; import traverse from "@babel/traverse"; import * as t from "@babel/types"; export default function rewriteThis(programPath: NodePath) { // Rewrite "this" to be "undefined". traverse(programPath.node, { ...rewriteThisVisitor, noScope: true }); } /** * A visitor to walk the tree, rewriting all `this` references in the top-level scope to be * `void 0` (undefined). */ const rewriteThisVisitor = traverse.visitors.merge([ environmentVisitor, { ThisExpression(path) { path.replaceWith(t.unaryExpression("void", t.numericLiteral(0), true)); }, }, ]); babel-7.12.12/packages/babel-helper-optimise-call-expression/000077500000000000000000000000001377064615700240065ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-optimise-call-expression/.npmignore000066400000000000000000000000171377064615700260030ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-optimise-call-expression/README.md000066400000000000000000000006341377064615700252700ustar00rootroot00000000000000# @babel/helper-optimise-call-expression > Helper function to optimise call expression See our website [@babel/helper-optimise-call-expression](https://babeljs.io/docs/en/babel-helper-optimise-call-expression) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-optimise-call-expression ``` or using yarn: ```sh yarn add @babel/helper-optimise-call-expression --dev ``` babel-7.12.12/packages/babel-helper-optimise-call-expression/package.json000066400000000000000000000010631377064615700262740ustar00rootroot00000000000000{ "name": "@babel/helper-optimise-call-expression", "version": "7.12.10", "description": "Helper function to optimise call expression", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-optimise-call-expression" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/types": "workspace:^7.12.10" }, "devDependencies": { "@babel/generator": "workspace:*", "@babel/parser": "workspace:*" } } babel-7.12.12/packages/babel-helper-optimise-call-expression/src/000077500000000000000000000000001377064615700245755ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-optimise-call-expression/src/index.ts000066400000000000000000000034171377064615700262610ustar00rootroot00000000000000import * as t from "@babel/types"; import type { CallExpression, Expression, OptionalCallExpression, SpreadElement, } from "@babel/types"; /** * A helper function that generates a new call expression with given thisNode. It will also optimize `(...arguments)` to `.apply(arguments)` * * @export * @param {Expression} callee The callee of call expression * @param {Expression} thisNode The desired this of call expression * @param {Readonly>} args The arguments of call expression * @param {boolean} optional Whether the call expression is optional * @returns {CallExpression | OptionalCallExpression} The generated new call expression */ export default function optimiseCallExpression( callee: Expression, thisNode: Expression, args: Readonly>, optional: boolean, ): CallExpression | OptionalCallExpression { if ( args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, { name: "arguments" }) ) { // a.b?.(...arguments); if (optional) { return t.optionalCallExpression( t.optionalMemberExpression(callee, t.identifier("apply"), false, true), [thisNode, args[0].argument], false, ); } // a.b(...arguments); return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [ thisNode, args[0].argument, ]); } else { // a.b?.(arg1, arg2) if (optional) { return t.optionalCallExpression( t.optionalMemberExpression(callee, t.identifier("call"), false, true), [thisNode, ...args], false, ); } // a.b(arg1, arg2) return t.callExpression(t.memberExpression(callee, t.identifier("call")), [ thisNode, ...args, ]); } } babel-7.12.12/packages/babel-helper-optimise-call-expression/test/000077500000000000000000000000001377064615700247655ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-optimise-call-expression/test/index.js000066400000000000000000000067721377064615700264460ustar00rootroot00000000000000import { parse } from "@babel/parser"; import generator from "@babel/generator"; import * as t from "@babel/types"; import optimizeCallExpression from ".."; function transformInput(input, thisIdentifier) { const ast = parse(input); const callExpression = ast.program.body[0].expression; return generator( optimizeCallExpression( callExpression.callee, thisIdentifier ? t.identifier(thisIdentifier) : callExpression.callee.object, callExpression.arguments, callExpression.type === "OptionalCallExpression", ), ).code; } describe("@babel/helper-optimise-call-expression", () => { test("optimizeCallExpression should work when thisNode is implied from callee", () => { expect(transformInput("a.b(...arguments)")).toMatchInlineSnapshot( `"a.b.apply(a, arguments)"`, ); expect(transformInput("a[b](...arguments)")).toMatchInlineSnapshot( `"a[b].apply(a, arguments)"`, ); expect(transformInput("a.b?.(...arguments)")).toMatchInlineSnapshot( `"a.b?.apply(a, arguments)"`, ); expect(transformInput("a[b]?.(...arguments)")).toMatchInlineSnapshot( `"a[b]?.apply(a, arguments)"`, ); expect(transformInput("a.b(...args)")).toMatchInlineSnapshot( `"a.b.call(a, ...args)"`, ); expect(transformInput("a[b](...args)")).toMatchInlineSnapshot( `"a[b].call(a, ...args)"`, ); expect(transformInput("a.b?.(...args)")).toMatchInlineSnapshot( `"a.b?.call(a, ...args)"`, ); expect(transformInput("a[b]?.(...args)")).toMatchInlineSnapshot( `"a[b]?.call(a, ...args)"`, ); expect(transformInput("a.b(arg1, arg2)")).toMatchInlineSnapshot( `"a.b.call(a, arg1, arg2)"`, ); expect(transformInput("a[b](arg1, arg2)")).toMatchInlineSnapshot( `"a[b].call(a, arg1, arg2)"`, ); expect(transformInput("a.b?.(arg1, arg2)")).toMatchInlineSnapshot( `"a.b?.call(a, arg1, arg2)"`, ); expect(transformInput("a[b]?.(arg1, arg2)")).toMatchInlineSnapshot( `"a[b]?.call(a, arg1, arg2)"`, ); }); test("optimizeCallExpression should work when thisNode is provided", () => { expect(transformInput("a.b(...arguments)", "c")).toMatchInlineSnapshot( `"a.b.apply(c, arguments)"`, ); expect(transformInput("a[b](...arguments)", "c")).toMatchInlineSnapshot( `"a[b].apply(c, arguments)"`, ); expect(transformInput("a.b?.(...arguments)", "c")).toMatchInlineSnapshot( `"a.b?.apply(c, arguments)"`, ); expect(transformInput("a[b]?.(...arguments)", "c")).toMatchInlineSnapshot( `"a[b]?.apply(c, arguments)"`, ); expect(transformInput("a.b(...args)", "c")).toMatchInlineSnapshot( `"a.b.call(c, ...args)"`, ); expect(transformInput("a[b](...args)", "c")).toMatchInlineSnapshot( `"a[b].call(c, ...args)"`, ); expect(transformInput("a.b?.(...args)", "c")).toMatchInlineSnapshot( `"a.b?.call(c, ...args)"`, ); expect(transformInput("a[b]?.(...args)", "c")).toMatchInlineSnapshot( `"a[b]?.call(c, ...args)"`, ); expect(transformInput("a.b(arg1, arg2)", "c")).toMatchInlineSnapshot( `"a.b.call(c, arg1, arg2)"`, ); expect(transformInput("a[b](arg1, arg2)", "c")).toMatchInlineSnapshot( `"a[b].call(c, arg1, arg2)"`, ); expect(transformInput("a.b?.(arg1, arg2)", "c")).toMatchInlineSnapshot( `"a.b?.call(c, arg1, arg2)"`, ); expect(transformInput("a[b]?.(arg1, arg2)", "c")).toMatchInlineSnapshot( `"a[b]?.call(c, arg1, arg2)"`, ); }); }); babel-7.12.12/packages/babel-helper-plugin-test-runner/000077500000000000000000000000001377064615700226315ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-plugin-test-runner/.npmignore000066400000000000000000000000171377064615700246260ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-plugin-test-runner/README.md000066400000000000000000000005711377064615700241130ustar00rootroot00000000000000# @babel/helper-plugin-test-runner > Helper function to support test runner See our website [@babel/helper-plugin-test-runner](https://babeljs.io/docs/en/babel-helper-plugin-test-runner) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-plugin-test-runner ``` or using yarn: ```sh yarn add @babel/helper-plugin-test-runner --dev ``` babel-7.12.12/packages/babel-helper-plugin-test-runner/package.json000066400000000000000000000007311377064615700251200ustar00rootroot00000000000000{ "name": "@babel/helper-plugin-test-runner", "version": "7.10.4", "description": "Helper function to support test runner", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-plugin-test-runner" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/helper-transform-fixture-test-runner": "workspace:^7.10.4" } } babel-7.12.12/packages/babel-helper-plugin-test-runner/src/000077500000000000000000000000001377064615700234205ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-plugin-test-runner/src/index.js000066400000000000000000000003321377064615700250630ustar00rootroot00000000000000import testRunner from "@babel/helper-transform-fixture-test-runner"; import path from "path"; export default function (loc) { const name = path.basename(path.dirname(loc)); testRunner(loc + "/fixtures", name); } babel-7.12.12/packages/babel-helper-plugin-utils/000077500000000000000000000000001377064615700215035ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-plugin-utils/.npmignore000066400000000000000000000000171377064615700235000ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-plugin-utils/README.md000066400000000000000000000005311377064615700227610ustar00rootroot00000000000000# @babel/helper-plugin-utils > General utilities for plugins to use See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/en/babel-helper-plugin-utils) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-plugin-utils ``` or using yarn: ```sh yarn add @babel/helper-plugin-utils --dev ``` babel-7.12.12/packages/babel-helper-plugin-utils/package.json000066400000000000000000000007031377064615700237710ustar00rootroot00000000000000{ "name": "@babel/helper-plugin-utils", "version": "7.10.4", "description": "General utilities for plugins to use", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-plugin-utils" }, "main": "lib/index.js" } babel-7.12.12/packages/babel-helper-plugin-utils/src/000077500000000000000000000000001377064615700222725ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-plugin-utils/src/index.js000066400000000000000000000051641377064615700237450ustar00rootroot00000000000000export function declare(builder) { return (api, options, dirname) => { if (!api.assertVersion) { // Inject a custom version of 'assertVersion' for Babel 6 and early // versions of Babel 7's beta that didn't have it. api = Object.assign(copyApiObject(api), { assertVersion(range) { throwVersionError(range, api.version); }, }); } return builder(api, options || {}, dirname); }; } function copyApiObject(api) { // Babel >= 7 <= beta.41 passed the API as a new object that had // babel/core as the prototype. While slightly faster, it also // means that the Object.assign copy below fails. Rather than // keep complexity, the Babel 6 behavior has been reverted and this // normalizes all that for Babel 7. let proto = null; if (typeof api.version === "string" && /^7\./.test(api.version)) { proto = Object.getPrototypeOf(api); if ( proto && (!has(proto, "version") || !has(proto, "transform") || !has(proto, "template") || !has(proto, "types")) ) { proto = null; } } return { ...proto, ...api, }; } function has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function throwVersionError(range, version) { if (typeof range === "number") { if (!Number.isInteger(range)) { throw new Error("Expected string or integer value."); } range = `^${range}.0.0-0`; } if (typeof range !== "string") { throw new Error("Expected string or integer value."); } const limit = Error.stackTraceLimit; if (typeof limit === "number" && limit < 25) { // Bump up the limit if needed so that users are more likely // to be able to see what is calling Babel. Error.stackTraceLimit = 25; } let err; if (version.slice(0, 2) === "7.") { err = new Error( `Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` + `You'll need to update your @babel/core version.`, ); } else { err = new Error( `Requires Babel "${range}", but was loaded with "${version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`, ); } if (typeof limit === "number") { Error.stackTraceLimit = limit; } throw Object.assign( err, ({ code: "BABEL_VERSION_UNSUPPORTED", version, range, }: any), ); } babel-7.12.12/packages/babel-helper-remap-async-to-generator/000077500000000000000000000000001377064615700236725ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-remap-async-to-generator/.npmignore000066400000000000000000000000171377064615700256670ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-remap-async-to-generator/README.md000066400000000000000000000006471377064615700251600ustar00rootroot00000000000000# @babel/helper-remap-async-to-generator > Helper function to remap async functions to generators See our website [@babel/helper-remap-async-to-generator](https://babeljs.io/docs/en/babel-helper-remap-async-to-generator) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-remap-async-to-generator ``` or using yarn: ```sh yarn add @babel/helper-remap-async-to-generator --dev ``` babel-7.12.12/packages/babel-helper-remap-async-to-generator/package.json000066400000000000000000000012121377064615700261540ustar00rootroot00000000000000{ "name": "@babel/helper-remap-async-to-generator", "version": "7.12.1", "description": "Helper function to remap async functions to generators", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-remap-async-to-generator" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/helper-annotate-as-pure": "workspace:^7.10.4", "@babel/helper-wrap-function": "workspace:^7.10.4", "@babel/types": "workspace:^7.12.1" }, "devDependencies": { "@babel/traverse": "workspace:*" } } babel-7.12.12/packages/babel-helper-remap-async-to-generator/src/000077500000000000000000000000001377064615700244615ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-remap-async-to-generator/src/index.js000066400000000000000000000043131377064615700261270ustar00rootroot00000000000000/* @noflow */ import type { NodePath } from "@babel/traverse"; import wrapFunction from "@babel/helper-wrap-function"; import annotateAsPure from "@babel/helper-annotate-as-pure"; import * as t from "@babel/types"; const awaitVisitor = { Function(path) { path.skip(); }, AwaitExpression(path, { wrapAwait }) { const argument = path.get("argument"); if (path.parentPath.isYieldExpression()) { path.replaceWith(argument.node); return; } path.replaceWith( t.yieldExpression( wrapAwait ? t.callExpression(t.cloneNode(wrapAwait), [argument.node]) : argument.node, ), ); }, }; export default function ( path: NodePath, helpers: { wrapAsync: Object, wrapAwait: Object }, ) { path.traverse(awaitVisitor, { wrapAwait: helpers.wrapAwait, }); const isIIFE = checkIsIIFE(path); path.node.async = false; path.node.generator = true; wrapFunction(path, t.cloneNode(helpers.wrapAsync)); const isProperty = path.isObjectMethod() || path.isClassMethod() || path.parentPath.isObjectProperty() || path.parentPath.isClassProperty(); if (!isProperty && !isIIFE && path.isExpression()) { annotateAsPure(path); } function checkIsIIFE(path: NodePath) { if (path.parentPath.isCallExpression({ callee: path.node })) { return true; } // try to catch calls to Function#bind, as emitted by arrowFunctionToExpression in spec mode // this may also catch .bind(this) written by users, but does it matter? 🤔 const { parentPath } = path; if ( parentPath.isMemberExpression() && t.isIdentifier(parentPath.node.property, { name: "bind" }) ) { const { parentPath: bindCall } = parentPath; // (function () { ... }).bind(this)() return ( // first, check if the .bind is actually being called bindCall.isCallExpression() && // and whether its sole argument is 'this' bindCall.node.arguments.length === 1 && t.isThisExpression(bindCall.node.arguments[0]) && // and whether the result of the .bind(this) is being called bindCall.parentPath.isCallExpression({ callee: bindCall.node }) ); } return false; } } babel-7.12.12/packages/babel-helper-replace-supers/000077500000000000000000000000001377064615700220015ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-replace-supers/.npmignore000066400000000000000000000000171377064615700237760ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-replace-supers/README.md000066400000000000000000000005401377064615700232570ustar00rootroot00000000000000# @babel/helper-replace-supers > Helper function to replace supers See our website [@babel/helper-replace-supers](https://babeljs.io/docs/en/babel-helper-replace-supers) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-replace-supers ``` or using yarn: ```sh yarn add @babel/helper-replace-supers --dev ``` babel-7.12.12/packages/babel-helper-replace-supers/package.json000066400000000000000000000011511377064615700242650ustar00rootroot00000000000000{ "name": "@babel/helper-replace-supers", "version": "7.12.11", "description": "Helper function to replace supers", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-replace-supers" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/helper-member-expression-to-functions": "workspace:^7.12.7", "@babel/helper-optimise-call-expression": "workspace:^7.12.10", "@babel/traverse": "workspace:^7.12.10", "@babel/types": "workspace:^7.12.11" } } babel-7.12.12/packages/babel-helper-replace-supers/src/000077500000000000000000000000001377064615700225705ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-replace-supers/src/index.js000066400000000000000000000174301377064615700242420ustar00rootroot00000000000000// @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"; import * as t from "@babel/types"; /** * Creates an expression which result is the proto of objectRef. * * @example isStatic === true * * helpers.getPrototypeOf(CLASS) * * @example isStatic === false * * helpers.getPrototypeOf(CLASS.prototype) */ function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) { objectRef = t.cloneNode(objectRef); const targetRef = isStatic || isPrivateMethod ? objectRef : t.memberExpression(objectRef, t.identifier("prototype")); return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]); } export function skipAllButComputedKey(path: NodePath) { // If the path isn't computed, just skip everything. if (!path.node.computed) { path.skip(); return; } // So it's got a computed key. Make sure to skip every other key the // traversal would visit. const keys = t.VISITOR_KEYS[path.type]; for (const key of keys) { if (key !== "key") path.skipKey(key); } } // environmentVisitor should be used when traversing the whole class and not for specific class elements/methods. // For perf reasons, the environmentVisitor will be traversed with `{ noScope: true }`, which means `path.scope` is undefined. // Avoid using `path.scope` here export const environmentVisitor = { // todo (Babel 8): remove StaticBlock brand checks [`${t.staticBlock ? "StaticBlock|" : ""}ClassPrivateProperty|TypeAnnotation`]( path: NodePath, ) { path.skip(); }, Function(path: NodePath) { // Methods will be handled by the Method visit if (path.isMethod()) return; // Arrow functions inherit their parent's environment if (path.isArrowFunctionExpression()) return; path.skip(); }, "Method|ClassProperty"(path: NodePath) { skipAllButComputedKey(path); }, }; const visitor = traverse.visitors.merge([ environmentVisitor, { Super(path, state) { const { node, parentPath } = path; if (!parentPath.isMemberExpression({ object: node })) return; state.handle(parentPath); }, }, ]); const specHandlers = { memoise(superMember, count) { const { scope, node } = superMember; const { computed, property } = node; if (!computed) { return; } const memo = scope.maybeGenerateMemoised(property); if (!memo) { return; } this.memoiser.set(property, memo, count); }, prop(superMember) { const { computed, property } = superMember.node; if (this.memoiser.has(property)) { return t.cloneNode(this.memoiser.get(property)); } if (computed) { return t.cloneNode(property); } return t.stringLiteral(property.name); }, 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"), [ thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), 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"), [ thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, t.booleanLiteral(superMember.isInStrictMode()), ]); }, destructureSet(superMember) { throw superMember.buildCodeFrameError( `Destructuring to a super field is not supported yet.`, ); }, call(superMember, args) { const thisRefs = this._getThisRefs(); return optimiseCall( this._get(superMember, thisRefs), t.cloneNode(thisRefs.this), args, false, ); }, optionalCall(superMember, args) { const thisRefs = this._getThisRefs(); return optimiseCall( this._get(superMember, thisRefs), t.cloneNode(thisRefs.this), args, true, ); }, }; const looseHandlers = { ...specHandlers, prop(superMember) { const { property } = superMember.node; if (this.memoiser.has(property)) { return t.cloneNode(this.memoiser.get(property)); } return t.cloneNode(property); }, get(superMember) { const { isStatic, superRef } = this; const { computed } = superMember.node; const prop = this.prop(superMember); let object; if (isStatic) { object = superRef ? t.cloneNode(superRef) : t.memberExpression( t.identifier("Function"), t.identifier("prototype"), ); } else { object = superRef ? t.memberExpression(t.cloneNode(superRef), t.identifier("prototype")) : t.memberExpression(t.identifier("Object"), t.identifier("prototype")); } return t.memberExpression(object, prop, computed); }, set(superMember, value) { const { computed } = superMember.node; const prop = this.prop(superMember); return t.assignmentExpression( "=", t.memberExpression(t.thisExpression(), prop, computed), value, ); }, destructureSet(superMember) { const { computed } = superMember.node; const prop = this.prop(superMember); return t.memberExpression(t.thisExpression(), prop, computed); }, call(superMember, args) { return optimiseCall(this.get(superMember), t.thisExpression(), args, false); }, optionalCall(superMember, args) { return optimiseCall(this.get(superMember), t.thisExpression(), args, true); }, }; type ReplaceSupersOptionsBase = {| methodPath: NodePath, superRef: Object, isLoose: boolean, file: any, |}; type ReplaceSupersOptions = | {| ...ReplaceSupersOptionsBase, getObjectRef: () => BabelNode, |} | {| ...ReplaceSupersOptionsBase, objectRef: BabelNode, |}; export default class ReplaceSupers { 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(); this.file = opts.file; this.superRef = opts.superRef; this.isLoose = opts.isLoose; this.opts = opts; } declare file: HubInterface; declare isDerivedConstructor: boolean; declare isLoose: boolean; declare isPrivateMethod: boolean; declare isStatic: boolean; declare methodPath: NodePath; declare opts: ReplaceSupersOptions; declare superRef: Object; getObjectRef() { return t.cloneNode(this.opts.objectRef || this.opts.getObjectRef()); } replace() { const handler = this.isLoose ? looseHandlers : specHandlers; 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), superRef: this.superRef, ...handler, }); } } babel-7.12.12/packages/babel-helper-simple-access/000077500000000000000000000000001377064615700215775ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-simple-access/.npmignore000066400000000000000000000000171377064615700235740ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-simple-access/README.md000066400000000000000000000006251377064615700230610ustar00rootroot00000000000000# @babel/helper-simple-access > Babel helper for ensuring that access to a given value is performed through simple accesses See our website [@babel/helper-simple-access](https://babeljs.io/docs/en/babel-helper-simple-access) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-simple-access ``` or using yarn: ```sh yarn add @babel/helper-simple-access --dev ``` babel-7.12.12/packages/babel-helper-simple-access/package.json000066400000000000000000000010751377064615700240700ustar00rootroot00000000000000{ "name": "@babel/helper-simple-access", "version": "7.12.1", "description": "Babel helper for ensuring that access to a given value is performed through simple accesses", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-simple-access" }, "main": "lib/index.js", "dependencies": { "@babel/types": "workspace:^7.12.1" } } babel-7.12.12/packages/babel-helper-simple-access/src/000077500000000000000000000000001377064615700223665ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-simple-access/src/index.js000066400000000000000000000055331377064615700240410ustar00rootroot00000000000000import * as t from "@babel/types"; export default function simplifyAccess(path: NodePath, bindingNames) { path.traverse(simpleAssignmentVisitor, { scope: path.scope, bindingNames, seen: new WeakSet(), }); } const simpleAssignmentVisitor = { UpdateExpression: { exit(path) { const { scope, bindingNames } = this; const arg = path.get("argument"); if (!arg.isIdentifier()) return; const localName = arg.node.name; if (!bindingNames.has(localName)) return; // redeclared in this scope if (scope.getBinding(localName) !== path.scope.getBinding(localName)) { return; } if ( path.parentPath.isExpressionStatement() && !path.isCompletionRecord() ) { // ++i => (i += 1); const operator = path.node.operator == "++" ? "+=" : "-="; path.replaceWith( t.assignmentExpression(operator, arg.node, t.numericLiteral(1)), ); } else if (path.node.prefix) { // ++i => (i = (+i) + 1); path.replaceWith( t.assignmentExpression( "=", t.identifier(localName), t.binaryExpression( path.node.operator[0], t.unaryExpression("+", arg.node), t.numericLiteral(1), ), ), ); } else { const old = path.scope.generateUidIdentifierBasedOnNode( arg.node, "old", ); const varName = old.name; path.scope.push({ id: old }); const binary = t.binaryExpression( path.node.operator[0], t.identifier(varName), t.numericLiteral(1), ); // i++ => (_old = (+i), i = _old + 1, _old) path.replaceWith( t.sequenceExpression([ t.assignmentExpression( "=", t.identifier(varName), t.unaryExpression("+", arg.node), ), t.assignmentExpression("=", t.cloneNode(arg.node), binary), t.identifier(varName), ]), ); } }, }, AssignmentExpression: { exit(path) { const { scope, seen, bindingNames } = this; if (path.node.operator === "=") return; if (seen.has(path.node)) return; seen.add(path.node); const left = path.get("left"); if (!left.isIdentifier()) return; // Simple update-assign foo += 1; // => exports.foo = (foo += 1); const localName = left.node.name; if (!bindingNames.has(localName)) return; // redeclared in this scope if (scope.getBinding(localName) !== path.scope.getBinding(localName)) { return; } path.node.right = t.binaryExpression( path.node.operator.slice(0, -1), t.cloneNode(path.node.left), path.node.right, ); path.node.operator = "="; }, }, }; babel-7.12.12/packages/babel-helper-skip-transparent-expression-wrappers/000077500000000000000000000000001377064615700264125ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-skip-transparent-expression-wrappers/.npmignore000066400000000000000000000000171377064615700304070ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-skip-transparent-expression-wrappers/README.md000066400000000000000000000007251377064615700276750ustar00rootroot00000000000000# @babel/helper-skip-transparent-expression-wrappers > Helper which skips types and parentheses See our website [@babel/helper-skip-transparent-expression-wrappers](https://babeljs.io/docs/en/babel-helper-skip-transparent-expression-wrappers) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-skip-transparent-expression-wrappers ``` or using yarn: ```sh yarn add @babel/helper-skip-transparent-expression-wrappers --dev ``` babel-7.12.12/packages/babel-helper-skip-transparent-expression-wrappers/package.json000066400000000000000000000011711377064615700307000ustar00rootroot00000000000000{ "name": "@babel/helper-skip-transparent-expression-wrappers", "version": "7.12.1", "description": "Helper which skips types and parentheses", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-skip-transparent-expression-wrappers" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "./lib/index.js", "exports": { ".": "./lib/index.js", "./package.json": "./package.json" }, "dependencies": { "@babel/types": "workspace:^7.12.1" }, "devDependencies": { "@babel/traverse": "workspace:*" } } babel-7.12.12/packages/babel-helper-skip-transparent-expression-wrappers/src/000077500000000000000000000000001377064615700272015ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-skip-transparent-expression-wrappers/src/index.js000066400000000000000000000015301377064615700306450ustar00rootroot00000000000000// @flow import * as t from "@babel/types"; import type { NodePath } from "@babel/traverse"; // A transparent expression wrapper is an AST node that most plugins will wish // to skip, as its presence does not affect the behaviour of the code. This // includes expressions used for types, and extra parenthesis. For example, in // (a as any)(), this helper can be used to skip the TSAsExpression when // determining the callee. export function isTransparentExprWrapper(node: Node) { return ( t.isTSAsExpression(node) || t.isTSTypeAssertion(node) || t.isTSNonNullExpression(node) || t.isTypeCastExpression(node) || t.isParenthesizedExpression(node) ); } export function skipTransparentExprWrappers(path: NodePath): NodePath { while (isTransparentExprWrapper(path.node)) { path = path.get("expression"); } return path; } babel-7.12.12/packages/babel-helper-split-export-declaration/000077500000000000000000000000001377064615700240045ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-split-export-declaration/.npmignore000066400000000000000000000000171377064615700260010ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-split-export-declaration/README.md000066400000000000000000000005611377064615700252650ustar00rootroot00000000000000# @babel/helper-split-export-declaration > See our website [@babel/helper-split-export-declaration](https://babeljs.io/docs/en/babel-helper-split-export-declaration) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-split-export-declaration ``` or using yarn: ```sh yarn add @babel/helper-split-export-declaration --dev ``` babel-7.12.12/packages/babel-helper-split-export-declaration/package.json000066400000000000000000000006421377064615700262740ustar00rootroot00000000000000{ "name": "@babel/helper-split-export-declaration", "version": "7.12.11", "description": "", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-split-export-declaration" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/types": "workspace:^7.12.11" } } babel-7.12.12/packages/babel-helper-split-export-declaration/src/000077500000000000000000000000001377064615700245735ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-split-export-declaration/src/index.ts000066400000000000000000000042461377064615700262600ustar00rootroot00000000000000import * as t from "@babel/types"; export default function splitExportDeclaration(exportDeclaration) { if (!exportDeclaration.isExportDeclaration()) { throw new Error("Only export declarations can be split."); } // build specifiers that point back to this export declaration const isDefault = exportDeclaration.isExportDefaultDeclaration(); const declaration = exportDeclaration.get("declaration"); const isClassDeclaration = declaration.isClassDeclaration(); if (isDefault) { const standaloneDeclaration = declaration.isFunctionDeclaration() || isClassDeclaration; const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope; let id = declaration.node.id; let needBindingRegistration = false; if (!id) { needBindingRegistration = true; id = scope.generateUidIdentifier("default"); if ( standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression() ) { declaration.node.id = t.cloneNode(id); } } const updatedDeclaration = standaloneDeclaration ? declaration : t.variableDeclaration("var", [ t.variableDeclarator(t.cloneNode(id), declaration.node), ]); const updatedExportDeclaration = t.exportNamedDeclaration(null, [ t.exportSpecifier(t.cloneNode(id), t.identifier("default")), ]); exportDeclaration.insertAfter(updatedExportDeclaration); exportDeclaration.replaceWith(updatedDeclaration); if (needBindingRegistration) { scope.registerDeclaration(exportDeclaration); } return exportDeclaration; } if (exportDeclaration.get("specifiers").length > 0) { throw new Error("It doesn't make sense to split exported specifiers."); } const bindingIdentifiers = declaration.getOuterBindingIdentifiers(); const specifiers = Object.keys(bindingIdentifiers).map(name => { return t.exportSpecifier(t.identifier(name), t.identifier(name)); }); const aliasDeclar = t.exportNamedDeclaration(null, specifiers); exportDeclaration.insertAfter(aliasDeclar); exportDeclaration.replaceWith(declaration.node); return exportDeclaration; } babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/000077500000000000000000000000001377064615700250325ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/.npmignore000066400000000000000000000000171377064615700270270ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/README.md000066400000000000000000000007011377064615700263070ustar00rootroot00000000000000# @babel/helper-transform-fixture-test-runner > Transform test runner for @babel/helper-fixtures module See our website [@babel/helper-transform-fixture-test-runner](https://babeljs.io/docs/en/babel-helper-transform-fixture-test-runner) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-transform-fixture-test-runner ``` or using yarn: ```sh yarn add @babel/helper-transform-fixture-test-runner --dev ``` babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/package.json000066400000000000000000000015371377064615700273260ustar00rootroot00000000000000{ "name": "@babel/helper-transform-fixture-test-runner", "version": "7.12.12", "description": "Transform test runner for @babel/helper-fixtures module", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-transform-fixture-test-runner" }, "main": "lib/index.js", "dependencies": { "@babel/code-frame": "workspace:^7.12.11", "@babel/core": "workspace:^7.12.10", "@babel/helper-fixtures": "workspace:^7.12.12", "babel-check-duplicated-nodes": "^1.0.0", "jest-diff": "^24.8.0", "lodash": "^4.17.19", "quick-lru": "5.1.0", "regenerator-runtime": "^0.13.7", "source-map": "^0.5.0" } } babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/src/000077500000000000000000000000001377064615700256215ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/src/helpers.js000066400000000000000000000002471377064615700276240ustar00rootroot00000000000000export function assertNoOwnProperties(obj) { expect(Object.getOwnPropertyNames(obj)).toHaveLength(0); } export function multiline(arr) { return arr.join("\n"); } babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/src/index.js000066400000000000000000000270101377064615700272660ustar00rootroot00000000000000/* eslint-env jest */ import * as babel from "@babel/core"; import { buildExternalHelpers } from "@babel/core"; import { default as getFixtures, resolveOptionPluginOrPreset, } from "@babel/helper-fixtures"; import sourceMap from "source-map"; import { codeFrameColumns } from "@babel/code-frame"; import escapeRegExp from "lodash/escapeRegExp"; import * as helpers from "./helpers"; import merge from "lodash/merge"; import assert from "assert"; import fs from "fs"; import path from "path"; import vm from "vm"; import checkDuplicatedNodes from "babel-check-duplicated-nodes"; import QuickLRU from "quick-lru"; import diff from "jest-diff"; const cachedScripts = new QuickLRU({ maxSize: 10 }); const contextModuleCache = new WeakMap(); const sharedTestContext = createContext(); function createContext() { const context = vm.createContext({ ...helpers, process: process, transform: babel.transform, setTimeout: setTimeout, setImmediate: setImmediate, expect, }); context.global = context; const moduleCache = Object.create(null); contextModuleCache.set(context, moduleCache); // Initialize the test context with the polyfill, and then freeze the global to prevent implicit // global creation in tests, which could cause things to bleed between tests. runModuleInTestContext( "regenerator-runtime", __filename, context, moduleCache, ); // Populate the "babelHelpers" global with Babel's helper utilities. runCacheableScriptInTestContext( path.join(__dirname, "babel-helpers-in-memory.js"), buildExternalHelpers, context, moduleCache, ); return context; } function runCacheableScriptInTestContext( filename: string, srcFn: () => string, context: Context, moduleCache: Object, ) { let cached = cachedScripts.get(filename); if (!cached) { const code = `(function (exports, require, module, __filename, __dirname) {\n${srcFn()}\n});`; cached = { code, cachedData: undefined, }; cachedScripts.set(filename, cached); } const script = new vm.Script(cached.code, { filename, displayErrors: true, lineOffset: -1, cachedData: cached.cachedData, produceCachedData: true, }); if (script.cachedDataProduced) { cached.cachedData = script.cachedData; } const module = { id: filename, exports: {}, }; const req = id => runModuleInTestContext(id, filename, context, moduleCache); const dirname = path.dirname(filename); script .runInContext(context) .call(module.exports, module.exports, req, module, filename, dirname); return module; } /** * A basic implementation of CommonJS so we can execute `@babel/polyfill` inside our test context. * This allows us to run our unittests */ function runModuleInTestContext( id: string, relativeFilename: string, context: Context, moduleCache: Object, ) { const filename = require.resolve(id, { paths: [path.dirname(relativeFilename)], }); // Expose Node-internal modules if the tests want them. Note, this will not execute inside // the context's global scope. if (filename === id) return require(id); // Modules can only evaluate once per context, so the moduleCache is a // stronger cache guarantee than the LRU's Script cache. if (moduleCache[filename]) return moduleCache[filename].exports; const module = runCacheableScriptInTestContext( filename, () => fs.readFileSync(filename, "utf8"), context, moduleCache, ); moduleCache[filename] = module; return module.exports; } /** * Run the given snippet of code inside a CommonJS module. * * Exposed for unit tests, not for use as an API. */ export function runCodeInTestContext( code: string, opts: { filename: string }, context = sharedTestContext, ) { const filename = opts.filename; const dirname = path.dirname(filename); const moduleCache = contextModuleCache.get(context); const req = id => runModuleInTestContext(id, filename, context, moduleCache); const module = { id: filename, exports: {}, }; const oldCwd = process.cwd(); try { if (opts.filename) process.chdir(path.dirname(opts.filename)); // 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) {\n${code}\n});`; return vm.runInContext(src, context, { filename, displayErrors: true, lineOffset: -1, })(module.exports, req, module, filename, dirname, opts); } finally { process.chdir(oldCwd); } } function run(task) { const { actual, expect: expected, exec, options: opts, optionsDir, validateLogs, ignoreOutput, stdout, stderr, } = task; function getOpts(self) { const newOpts = merge( { ast: true, cwd: path.dirname(self.loc), filename: self.loc, filenameRelative: self.filename, sourceFileName: self.filename, sourceType: "script", babelrc: false, inputSourceMap: task.inputSourceMap || undefined, }, opts, ); return resolveOptionPluginOrPreset(newOpts, optionsDir); } let execCode = exec.code; let result; let resultExec; if (execCode) { const context = createContext(); const execOpts = getOpts(exec); result = babel.transform(execCode, execOpts); checkDuplicatedNodes(babel, result.ast); execCode = result.code; try { resultExec = runCodeInTestContext(execCode, execOpts, context); } catch (err) { // Pass empty location to include the whole file in the output. err.message = `${exec.loc}: ${err.message}\n` + codeFrameColumns(execCode, {}); throw err; } } 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 (!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, `${outputCode}\n`); if (expected.loc !== expectedFile) { try { fs.unlinkSync(expected.loc); } catch (e) {} } } else { validateFile(outputCode, expected.loc, expectedCode); if (inputCode) { 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); } } if (task.sourceMap) { expect(result.map).toEqual(task.sourceMap); } if (task.sourceMappings) { const consumer = new sourceMap.SourceMapConsumer(result.map); task.sourceMappings.forEach(function (mapping) { const actual = mapping.original; const expected = consumer.originalPositionFor(mapping.generated); expect({ line: expected.line, column: expected.column }).toEqual(actual); }); } if (execCode && resultExec) { return resultExec; } } 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; return { pass, message: () => { const diffString = diff(code, actual, { expand: false, }); return ( `Expected ${filename} to match transform output.\n` + `To autogenerate a passing version of this file, delete the file and re-run the tests.\n\n` + `Diff:\n\n${diffString}` ); }, }; }, negativeCompare: () => { throw new Error("Negation unsupported"); }, }); export default function ( fixturesLoc: string, name: string, suiteOpts = {}, taskOpts = {}, dynamicOpts?: Function, ) { const suites = getFixtures(fixturesLoc); for (const testSuite of suites) { if (suiteOpts.ignoreSuites?.includes(testSuite.title)) continue; describe(name + "/" + testSuite.title, function () { jest.addMatchers({ toEqualFile, }); for (const task of testSuite.tests) { if ( suiteOpts.ignoreTasks?.includes(task.title) || suiteOpts.ignoreTasks?.includes(testSuite.title + "/" + task.title) ) { continue; } const testFn = task.disabled ? it.skip : it; testFn( task.title, function () { function runTask() { run(task); } if ("sourceMap" in task.options === false) { task.options.sourceMap = !!( task.sourceMappings || task.sourceMap ); } Object.assign(task.options, taskOpts); if (dynamicOpts) dynamicOpts(task.options, task); const throwMsg = task.options.throws; if (throwMsg) { // internal api doesn't have this option but it's best not to pollute // the options object with useless options delete task.options.throws; assert.throws(runTask, function (err) { return throwMsg === true || err.message.indexOf(throwMsg) >= 0; }); } else { if (task.exec.code) { const result = run(task); if (result && typeof result.then === "function") { return result; } } else { runTask(); } } }, ); } }); } } babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/test/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-transform-fixture-test-runner/test/index.js000066400000000000000000000022501377064615700274550ustar00rootroot00000000000000import { runCodeInTestContext } from ".."; describe("helper-transform-fixture-test-runner", function () { it("should not execute code in Node's global context", function () { try { global.foo = "outer"; runCodeInTestContext( ` expect(global.foo).toBeUndefined(); global.foo = "inner"; `, { filename: `${__filename}.fake1`, }, ); expect(global.foo).toBe("outer"); runCodeInTestContext( ` expect(global.foo).toBe("inner"); `, { filename: `${__filename}.fake2`, }, ); } finally { delete global.foo; runCodeInTestContext( ` delete global.foo; `, { filename: `${__filename}.fake3`, }, ); } }); 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"); }); }); babel-7.12.12/packages/babel-helper-validator-identifier/000077500000000000000000000000001377064615700231545ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-validator-identifier/.npmignore000066400000000000000000000000171377064615700251510ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-validator-identifier/README.md000066400000000000000000000005761377064615700244430ustar00rootroot00000000000000# @babel/helper-validator-identifier > Validate identifier/keywords name See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/babel-helper-validator-identifier) 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 ``` babel-7.12.12/packages/babel-helper-validator-identifier/package.json000066400000000000000000000007601377064615700254450ustar00rootroot00000000000000{ "name": "@babel/helper-validator-identifier", "version": "7.12.11", "description": "Validate identifier/keywords name", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "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" } } babel-7.12.12/packages/babel-helper-validator-identifier/scripts/000077500000000000000000000000001377064615700246435ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-validator-identifier/scripts/generate-identifier-regex.js000066400000000000000000000037511377064615700322310ustar00rootroot00000000000000"use strict"; // Always use the latest available version of Unicode! // https://tc39.github.io/ecma262/#sec-conformance const version = "13.0.0"; const start = require("unicode-" + version + "/Binary_Property/ID_Start/code-points.js").filter(function (ch) { return ch > 0x7f; }); let last = -1; const cont = [0x200c, 0x200d].concat( require("unicode-" + version + "/Binary_Property/ID_Continue/code-points.js").filter(function (ch) { return ch > 0x7f && search(start, ch, last + 1) == -1; }) ); function search(arr, ch, starting) { for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) { if (arr[i] === ch) return i; } return -1; } function pad(str, width) { while (str.length < width) str = "0" + str; return str; } function esc(code) { const hex = code.toString(16); if (hex.length <= 2) return "\\x" + pad(hex, 2); else return "\\u" + pad(hex, 4); } function generate(chars) { const astral = []; let re = ""; for (let i = 0, at = 0x10000; i < chars.length; i++) { const from = chars[i]; let to = from; while (i < chars.length - 1 && chars[i + 1] == to + 1) { i++; to++; } if (to <= 0xffff) { if (from == to) re += esc(from); else if (from + 1 == to) re += esc(from) + esc(to); else re += esc(from) + "-" + esc(to); } else { astral.push(from - at, to - from); at = to; } } return { nonASCII: re, astral: astral }; } const startData = generate(start); const contData = generate(cont); console.log("/* prettier-ignore */"); console.log('let nonASCIIidentifierStartChars = "' + startData.nonASCII + '";'); console.log("/* prettier-ignore */"); console.log('let nonASCIIidentifierChars = "' + contData.nonASCII + '";'); console.log("/* prettier-ignore */"); console.log( "const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";" ); console.log("/* prettier-ignore */"); console.log( "const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";" ); babel-7.12.12/packages/babel-helper-validator-identifier/src/000077500000000000000000000000001377064615700237435ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-validator-identifier/src/identifier.ts000066400000000000000000000275101377064615700264420ustar00rootroot00000000000000import * 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: readonly number[]): 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; } babel-7.12.12/packages/babel-helper-validator-identifier/src/index.ts000066400000000000000000000003551377064615700254250ustar00rootroot00000000000000export { isIdentifierName, isIdentifierChar, isIdentifierStart, } from "./identifier"; export { isReservedWord, isStrictBindOnlyReservedWord, isStrictBindReservedWord, isStrictReservedWord, isKeyword, } from "./keyword"; babel-7.12.12/packages/babel-helper-validator-identifier/src/keyword.ts000066400000000000000000000037211377064615700260020ustar00rootroot00000000000000const 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); } babel-7.12.12/packages/babel-helper-validator-identifier/test/000077500000000000000000000000001377064615700241335ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-validator-identifier/test/identifier.spec.js000066400000000000000000000013371377064615700275500ustar00rootroot00000000000000import { 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); }); }); babel-7.12.12/packages/babel-helper-validator-option/000077500000000000000000000000001377064615700223425ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-validator-option/.npmignore000066400000000000000000000000171377064615700243370ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-validator-option/README.md000066400000000000000000000005471377064615700236270ustar00rootroot00000000000000# @babel/helper-validator-option > Validate plugin/preset options See our website [@babel/helper-validator-option](https://babeljs.io/docs/en/babel-helper-validator-option) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-validator-option ``` or using yarn: ```sh yarn add @babel/helper-validator-option --dev ``` babel-7.12.12/packages/babel-helper-validator-option/package.json000066400000000000000000000006171377064615700246340ustar00rootroot00000000000000{ "name": "@babel/helper-validator-option", "version": "7.12.11", "description": "Validate plugin/preset options", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-validator-option" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "./lib/index.js", "exports": "./lib/index.js" } babel-7.12.12/packages/babel-helper-validator-option/src/000077500000000000000000000000001377064615700231315ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-validator-option/src/find-suggestion.ts000066400000000000000000000023011377064615700266020ustar00rootroot00000000000000const { min } = Math; // a minimal leven distance implementation // balanced maintenability with code size // It is not blazingly fast but should be okay for Babel user case // where it will be run for at most tens of time on strings // that have less than 20 ASCII characters // https://rosettacode.org/wiki/Levenshtein_distance#ES5 function levenshtein(a: string, b: string): number { let t = [], u = [], i, j; const m = a.length, n = b.length; if (!m) { return n; } if (!n) { return m; } for (j = 0; j <= n; j++) { t[j] = j; } for (i = 1; i <= m; i++) { for (u = [i], j = 1; j <= n; j++) { u[j] = a[i - 1] === b[j - 1] ? t[j - 1] : min(t[j - 1], t[j], u[j - 1]) + 1; } t = u; } return u[n]; } /** * Given a string `str` and an array of candidates `arr`, * return the first of elements in candidates that has minimal * Levenshtein distance with `str`. * @export * @param {string} str * @param {string[]} arr * @returns {string} */ export function findSuggestion(str: string, arr: readonly string[]): string { const distances = arr.map(el => levenshtein(el, str)); return arr[distances.indexOf(min(...distances))]; } babel-7.12.12/packages/babel-helper-validator-option/src/index.ts000066400000000000000000000001431377064615700246060ustar00rootroot00000000000000export { OptionValidator } from "./validator"; export { findSuggestion } from "./find-suggestion"; babel-7.12.12/packages/babel-helper-validator-option/src/validator.ts000066400000000000000000000042631377064615700254730ustar00rootroot00000000000000import { findSuggestion } from "./find-suggestion.js"; export class OptionValidator { declare descriptor: string; constructor(descriptor: string) { this.descriptor = descriptor; } /** * Validate if the given `options` follow the name of keys defined in the `TopLevelOptionShape` * * @param {Object} options * @param {Object} TopLevelOptionShape * An object with all the valid key names that `options` should be allowed to have * The property values of `TopLevelOptionShape` can be arbitrary * @memberof OptionValidator */ validateTopLevelOptions(options: Object, TopLevelOptionShape: Object): void { const validOptionNames = Object.keys(TopLevelOptionShape); for (const option of Object.keys(options)) { if (!validOptionNames.includes(option)) { throw new Error( this.formatMessage(`'${option}' is not a valid top-level option. - Did you mean '${findSuggestion(option, validOptionNames)}'?`), ); } } } // note: we do not consider rewrite them to high order functions // until we have to support `validateNumberOption`. validateBooleanOption( name: string, value?: boolean, defaultValue?: T, ): boolean | T { if (value === undefined) { return defaultValue; } else { this.invariant( typeof value === "boolean", `'${name}' option must be a boolean.`, ); } return value; } validateStringOption( name: string, value?: string, defaultValue?: T, ): string | T { if (value === undefined) { return defaultValue; } else { this.invariant( typeof value === "string", `'${name}' option must be a string.`, ); } return value; } /** * A helper interface copied from the `invariant` npm package. * It throws given `message` when `condition` is not met * * @param {boolean} condition * @param {string} message * @memberof OptionValidator */ invariant(condition: boolean, message: string): void { if (!condition) { throw new Error(this.formatMessage(message)); } } formatMessage(message: string): string { return `${this.descriptor}: ${message}`; } } babel-7.12.12/packages/babel-helper-validator-option/test/000077500000000000000000000000001377064615700233215ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-validator-option/test/find-suggestion.spec.js000066400000000000000000000004541377064615700277200ustar00rootroot00000000000000import { findSuggestion } from ".."; describe("findSuggestion", function () { test.each([ ["cat", ["cow", "dog", "pig"], "cow"], ["uglifyjs", [], undefined], ])("findSuggestion(%p, %p) returns %p", (str, arr, expected) => { expect(findSuggestion(str, arr)).toBe(expected); }); }); babel-7.12.12/packages/babel-helper-validator-option/test/validator.spec.js000066400000000000000000000042161377064615700266000ustar00rootroot00000000000000import { OptionValidator } from ".."; describe("OptionValidator", () => { describe("validateTopLevelOptions", () => { let v; beforeAll(() => { v = new OptionValidator("test-descriptor"); }); it("should throw when option key is not found", () => { expect(() => v.validateTopLevelOptions( { unknown: "options" }, { foo: "foo" }, "test", ), ).toThrow(); }); it("should throw when option key is an own property but not found", () => { expect(() => v.validateTopLevelOptions( { hasOwnProperty: "foo" }, { foo: "foo", bar: "bar", aLongPropertyKeyToSeeLevenPerformance: "a", }, "test", ), ).toThrow(); }); }); describe("validateBooleanOption", () => { let v; beforeAll(() => { v = new OptionValidator("test-descriptor"); }); it("`undefined` option returns false", () => { expect(v.validateBooleanOption("test", undefined, false)).toBe(false); }); it("`false` option returns false", () => { expect(v.validateBooleanOption("test", false, false)).toBe(false); }); it("`true` option returns true", () => { expect(v.validateBooleanOption("test", true, false)).toBe(true); }); it("array option is invalid", () => { expect(() => { v.validateBooleanOption("test", [], false); }).toThrow(); }); }); describe("validateStringOption", () => { let v; beforeAll(() => { v = new OptionValidator("test-descriptor"); }); it("`undefined` option default", () => { expect(v.validateStringOption("test", undefined, "default")).toBe( "default", ); }); it("`value` option returns value", () => { expect(v.validateStringOption("test", "value", "default")).toBe("value"); }); it("no default returns undefined", () => { expect(v.validateStringOption("test", undefined)).toBe(undefined); }); it("array option is invalid", () => { expect(() => { v.validateStringOption("test", [], "default"); }).toThrow(); }); }); }); babel-7.12.12/packages/babel-helper-wrap-function/000077500000000000000000000000001377064615700216435ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-wrap-function/.npmignore000066400000000000000000000000171377064615700236400ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helper-wrap-function/README.md000066400000000000000000000005521377064615700231240ustar00rootroot00000000000000# @babel/helper-wrap-function > Helper to wrap functions inside a function call. See our website [@babel/helper-wrap-function](https://babeljs.io/docs/en/babel-helper-wrap-function) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helper-wrap-function ``` or using yarn: ```sh yarn add @babel/helper-wrap-function --dev ``` babel-7.12.12/packages/babel-helper-wrap-function/package.json000066400000000000000000000011121377064615700241240ustar00rootroot00000000000000{ "name": "@babel/helper-wrap-function", "version": "7.12.3", "description": "Helper to wrap functions inside a function call.", "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helper-wrap-function" }, "license": "MIT", "publishConfig": { "access": "public" }, "main": "lib/index.js", "dependencies": { "@babel/helper-function-name": "workspace:^7.10.4", "@babel/template": "workspace:^7.10.4", "@babel/traverse": "workspace:^7.10.4", "@babel/types": "workspace:^7.10.4" } } babel-7.12.12/packages/babel-helper-wrap-function/src/000077500000000000000000000000001377064615700224325ustar00rootroot00000000000000babel-7.12.12/packages/babel-helper-wrap-function/src/index.js000066400000000000000000000064251377064615700241060ustar00rootroot00000000000000import type { NodePath } from "@babel/traverse"; import nameFunction from "@babel/helper-function-name"; import template from "@babel/template"; import * as t from "@babel/types"; const buildAnonymousExpressionWrapper = template.expression(` (function () { var REF = FUNCTION; return function NAME(PARAMS) { return REF.apply(this, arguments); }; })() `); const buildNamedExpressionWrapper = template.expression(` (function () { var REF = FUNCTION; function NAME(PARAMS) { return REF.apply(this, arguments); } return NAME; })() `); const buildDeclarationWrapper = template(` function NAME(PARAMS) { return REF.apply(this, arguments); } function REF() { REF = FUNCTION; return REF.apply(this, arguments); } `); function classOrObjectMethod(path: NodePath, callId: Object) { const node = path.node; const body = node.body; const container = t.functionExpression( null, [], t.blockStatement(body.body), true, ); body.body = [ t.returnStatement( t.callExpression(t.callExpression(callId, [container]), []), ), ]; // Regardless of whether or not the wrapped function is a an async method // or generator the outer function should not be node.async = false; node.generator = false; // Unwrap the wrapper IIFE's environment so super and this and such still work. path .get("body.body.0.argument.callee.arguments.0") .unwrapFunctionEnvironment(); } function plainFunction(path: NodePath, callId: Object) { const node = path.node; const isDeclaration = path.isFunctionDeclaration(); const functionId = node.id; const wrapper = isDeclaration ? buildDeclarationWrapper : functionId ? buildNamedExpressionWrapper : buildAnonymousExpressionWrapper; if (path.isArrowFunctionExpression()) { path.arrowFunctionToExpression(); } node.id = null; if (isDeclaration) { node.type = "FunctionExpression"; } const built = t.callExpression(callId, [node]); const container = wrapper({ NAME: functionId || null, REF: path.scope.generateUidIdentifier(functionId ? functionId.name : "ref"), FUNCTION: built, PARAMS: node.params.reduce( (acc, param) => { acc.done = acc.done || t.isAssignmentPattern(param) || t.isRestElement(param); if (!acc.done) { acc.params.push(path.scope.generateUidIdentifier("x")); } return acc; }, { params: [], done: false, }, ).params, }); if (isDeclaration) { path.replaceWith(container[0]); path.insertAfter(container[1]); } else { const retFunction = container.callee.body.body[1].argument; if (!functionId) { nameFunction({ node: retFunction, parent: path.parent, scope: path.scope, }); } if (!retFunction || retFunction.id || node.params.length) { // we have an inferred function id or params so we need this wrapper path.replaceWith(container); } else { // we can omit this wrapper as the conditions it protects for do not apply path.replaceWith(built); } } } export default function wrapFunction(path: NodePath, callId: Object) { if (path.isMethod()) { classOrObjectMethod(path, callId); } else { plainFunction(path, callId); } } babel-7.12.12/packages/babel-helpers/000077500000000000000000000000001377064615700172345ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/.npmignore000066400000000000000000000000171377064615700212310ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-helpers/README.md000066400000000000000000000004611377064615700205140ustar00rootroot00000000000000# @babel/helpers > Collection of helper functions used by Babel transforms. See our website [@babel/helpers](https://babeljs.io/docs/en/babel-helpers) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/helpers ``` or using yarn: ```sh yarn add @babel/helpers --dev ``` babel-7.12.12/packages/babel-helpers/package.json000066400000000000000000000012541377064615700215240ustar00rootroot00000000000000{ "name": "@babel/helpers", "version": "7.12.5", "description": "Collection of helper functions used by Babel transforms.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-helpers" }, "main": "lib/index.js", "dependencies": { "@babel/template": "workspace:^7.10.4", "@babel/traverse": "workspace:^7.12.5", "@babel/types": "workspace:^7.12.5" }, "devDependencies": { "@babel/helper-plugin-test-runner": "workspace:*" } } babel-7.12.12/packages/babel-helpers/src/000077500000000000000000000000001377064615700200235ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/src/helpers.js000066400000000000000000002002451377064615700220260ustar00rootroot00000000000000// @flow import template from "@babel/template"; const helpers = Object.create(null); export default helpers; const helper = (minVersion: string) => tpl => ({ minVersion, ast: () => template.program.ast(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 { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } `; // "for" is a reserved keyword in ES3 so escaping it here for backward compatibility helpers.jsx = helper("7.0.0-beta.0")` var REACT_ELEMENT_TYPE; export default function _createRawReactElement(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) { // If we're going to assign props.children, we create a new object now // to avoid mutating defaultProps. 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, }; } `; helpers.asyncIterator = helper("7.0.0-beta.0")` export default function _asyncIterator(iterable) { var method if (typeof Symbol !== "undefined") { if (Symbol.asyncIterator) { method = iterable[Symbol.asyncIterator] if (method != null) return method.call(iterable); } if (Symbol.iterator) { method = iterable[Symbol.iterator] if (method != null) return method.call(iterable); } } throw new TypeError("Object is not async iterable"); } `; helpers.AwaitValue = helper("7.0.0-beta.0")` export default function _AwaitValue(value) { this.wrapped = value; } `; helpers.AsyncGenerator = helper("7.0.0-beta.0")` import AwaitValue from "AwaitValue"; export default 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; // Hide "return" method if generator return is not supported if (typeof gen.return !== "function") { this.return = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }; AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); }; AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); }; `; helpers.wrapAsyncGenerator = helper("7.0.0-beta.0")` import AsyncGenerator from "AsyncGenerator"; export default function _wrapAsyncGenerator(fn) { return function () { return new AsyncGenerator(fn.apply(this, arguments)); }; } `; helpers.awaitAsyncGenerator = helper("7.0.0-beta.0")` import AwaitValue from "AwaitValue"; export default function _awaitAsyncGenerator(value) { return new AwaitValue(value); } `; helpers.asyncGeneratorDelegate = helper("7.0.0-beta.0")` export default function _asyncGeneratorDelegate(inner, awaitWrap) { var iter = {}, waiting = false; function pump(key, value) { waiting = true; value = new Promise(function (resolve) { resolve(inner[key](value)); }); return { done: false, value: awaitWrap(value) }; }; if (typeof Symbol === "function" && Symbol.iterator) { iter[Symbol.iterator] = function () { return this; }; } iter.next = function (value) { if (waiting) { waiting = false; return value; } return pump("next", value); }; if (typeof inner.throw === "function") { iter.throw = function (value) { if (waiting) { waiting = false; throw value; } return pump("throw", value); }; } if (typeof inner.return === "function") { iter.return = function (value) { if (waiting) { waiting = false; return value; } return pump("return", value); }; } return iter; } `; helpers.asyncToGenerator = helper("7.0.0-beta.0")` 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); } } export default 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); }); }; } `; helpers.classCallCheck = helper("7.0.0-beta.0")` export default function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } `; helpers.createClass = helper("7.0.0-beta.0")` 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); } } export default function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } `; helpers.defineEnumerableProperties = helper("7.0.0-beta.0")` export default function _defineEnumerableProperties(obj, descs) { for (var key in descs) { var desc = descs[key]; desc.configurable = desc.enumerable = true; if ("value" in desc) desc.writable = true; Object.defineProperty(obj, key, desc); } // Symbols are not enumerated over by for-in loops. If native // Symbols are available, fetch all of the descs object's own // symbol properties and define them on our target object too. if (Object.getOwnPropertySymbols) { var objectSymbols = Object.getOwnPropertySymbols(descs); for (var i = 0; i < objectSymbols.length; i++) { var sym = objectSymbols[i]; var desc = descs[sym]; desc.configurable = desc.enumerable = true; if ("value" in desc) desc.writable = true; Object.defineProperty(obj, sym, desc); } } return obj; } `; helpers.defaults = helper("7.0.0-beta.0")` export default function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } `; helpers.defineProperty = helper("7.0.0-beta.0")` export default function _defineProperty(obj, key, value) { // Shortcircuit the slow defineProperty path when possible. // We are trying to avoid issues where setters defined on the // prototype cause side effects under the fast path of simple // assignment. By checking for existence of the property with // the in operator, we can optimize most of this overhead away. if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } `; helpers.extends = helper("7.0.0-beta.0")` export default 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); } `; // This old helper can be removed in babel v8 helpers.objectSpread = helper("7.0.0-beta.0")` import defineProperty from "defineProperty"; export default function _objectSpread(target) { for (var i = 1; i < arguments.length; 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) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key) { defineProperty(target, key, source[key]); }); } return target; } `; 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 // enumerable. It is good to use in objectSpread. 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; } export default function _objectSpread2(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; } `; helpers.inherits = helper("7.0.0-beta.0")` import setPrototypeOf from "setPrototypeOf"; export default 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); } `; helpers.inheritsLoose = helper("7.0.0-beta.0")` export default function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } `; helpers.getPrototypeOf = helper("7.0.0-beta.0")` export default function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } `; helpers.setPrototypeOf = helper("7.0.0-beta.0")` export default function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } `; helpers.isNativeReflectConstruct = helper("7.9.0")` export default 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; } } `; 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()) { _construct = Reflect.construct; } else { // NOTE: If Parent !== Class, the correct __proto__ is set *after* // calling the constructor. _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; }; } // Avoid issues with Class being present but undefined when it wasn't // present in the original call. return _construct.apply(null, arguments); } `; helpers.isNativeFunction = helper("7.0.0-beta.0")` export default function _isNativeFunction(fn) { // Note: This function returns "true" for core-js functions. return Function.toString.call(fn).indexOf("[native code]") !== -1; } `; // Based on https://github.com/WebReflection/babel-plugin-transform-builtin-classes helpers.wrapNativeSuper = helper("7.0.0-beta.0")` import getPrototypeOf from "getPrototypeOf"; import setPrototypeOf from "setPrototypeOf"; import isNativeFunction from "isNativeFunction"; import construct from "construct"; export default 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) } `; helpers.instanceof = helper("7.0.0-beta.0")` export default function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } `; helpers.interopRequireDefault = helper("7.0.0-beta.0")` export default function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } `; 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; } 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; } `; helpers.newArrowCheck = helper("7.0.0-beta.0")` export default function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError("Cannot instantiate an arrow function"); } } `; helpers.objectDestructuringEmpty = helper("7.0.0-beta.0")` export default function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); } `; helpers.objectWithoutPropertiesLoose = helper("7.0.0-beta.0")` export default 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; } `; helpers.objectWithoutProperties = helper("7.0.0-beta.0")` import objectWithoutPropertiesLoose from "objectWithoutPropertiesLoose"; export default function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } `; helpers.assertThisInitialized = helper("7.0.0-beta.0")` export default function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } `; helpers.possibleConstructorReturn = helper("7.0.0-beta.0")` import assertThisInitialized from "assertThisInitialized"; export default function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return assertThisInitialized(self); } `; // 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 _createSuperInternal() { 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"; export default function _superPropBase(object, property) { // Yes, this throws if object is null to being with, that's on purpose. while (!Object.prototype.hasOwnProperty.call(object, property)) { object = getPrototypeOf(object); if (object === null) break; } return object; } `; helpers.get = helper("7.0.0-beta.0")` import superPropBase from "superPropBase"; export default 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); } `; helpers.set = helper("7.0.0-beta.0")` import superPropBase from "superPropBase"; import defineProperty from "defineProperty"; 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) { // Both getter and non-writable fall into this. return false; } } // Without a super that defines the property, spec boils down to // "define on receiver" for some reason. desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { // Setter, getter, and non-writable fall into this. return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { // Avoid setters that may be defined on Sub's prototype, but not on // the instance. defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); } export default 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; } `; helpers.taggedTemplateLiteral = helper("7.0.0-beta.0")` export default function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } `; helpers.taggedTemplateLiteralLoose = helper("7.0.0-beta.0")` export default function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; } `; helpers.readOnlyError = helper("7.0.0-beta.0")` export default function _readOnlyError(name) { throw new TypeError("\\"" + name + "\\" is read-only"); } `; helpers.classNameTDZError = helper("7.0.0-beta.0")` export default function _classNameTDZError(name) { throw new Error("Class \\"" + name + "\\" cannot be referenced in computed property keys."); } `; helpers.temporalUndefined = helper("7.0.0-beta.0")` // 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) || 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) || 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) || 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) || unsupportedIterableToArray(arr) || nonIterableSpread() ); } `; helpers.arrayWithoutHoles = helper("7.0.0-beta.0")` import arrayLikeToArray from "arrayLikeToArray"; export default function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return arrayLikeToArray(arr); } `; helpers.arrayWithHoles = helper("7.0.0-beta.0")` export default function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } `; helpers.maybeArrayLike = helper("7.9.0")` import arrayLikeToArray from "arrayLikeToArray"; export default function _maybeArrayLike(next, arr, i) { if (arr && !Array.isArray(arr) && typeof arr.length === "number") { var len = arr.length; return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len); } return next(arr, i); } `; helpers.iterableToArray = helper("7.0.0-beta.0")` export default function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } `; 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 compliance is annoying :( // // _n = _iteratorNormalCompletion // _d = _didIteratorError // _e = _iteratorError // _i = _iterator // _s = _step 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; } `; 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); if (i && _arr.length === i) break; } return _arr; } `; 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.\\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.\\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, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { // Fallback for engines without symbol support if ( Array.isArray(o) || (it = unsupportedIterableToArray(o)) || (allowArrayLike && o && typeof o.length === "number") ) { if (it) o = it; 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 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, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { // Fallback for engines without symbol support if ( Array.isArray(o) || (it = unsupportedIterableToArray(o)) || (allowArrayLike && o && typeof o.length === "number") ) { if (it) o = it; var i = 0; 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."); } it = o[Symbol.iterator](); return it.next.bind(it); } `; helpers.skipFirstGeneratorNext = helper("7.0.0-beta.0")` export default function _skipFirstGeneratorNext(fn) { return function () { var it = fn.apply(this, arguments); it.next(); return it; } } `; helpers.toPrimitive = helper("7.1.5")` export default function _toPrimitive( input, hint /*: "default" | "string" | "number" | void */ ) { 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); } `; helpers.toPropertyKey = helper("7.1.5")` import toPrimitive from "toPrimitive"; export default function _toPropertyKey(arg) { var key = toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } `; /** * Add a helper that will throw a useful error if the transform fails to detect the class * property assignment, so users know something failed. */ 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 runs after the decorators transform.' ); } `; /** * Add a helper to call as a replacement for class property definition. */ helpers.initializerDefineProperty = helper("7.0.0-beta.0")` export default 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, }); } `; /** * Add a helper to take an initial descriptor, apply some decorators to it, and optionally * define the property. */ helpers.applyDecoratedDescriptor = helper("7.0.0-beta.0")` export default 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; } `; helpers.classPrivateFieldLooseKey = helper("7.0.0-beta.0")` var id = 0; export default function _classPrivateFieldKey(name) { return "__private_" + (id++) + "_" + name; } `; helpers.classPrivateFieldLooseBase = helper("7.0.0-beta.0")` export default function _classPrivateFieldBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } `; helpers.classPrivateFieldGet = helper("7.0.0-beta.0")` export default function _classPrivateFieldGet(receiver, privateMap) { var descriptor = privateMap.get(receiver); if (!descriptor) { throw new TypeError("attempted to get private field on non-instance"); } if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } `; helpers.classPrivateFieldSet = helper("7.0.0-beta.0")` export default function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = privateMap.get(receiver); if (!descriptor) { throw new TypeError("attempted to set private field on non-instance"); } 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; } return value; } `; helpers.classPrivateFieldDestructureSet = helper("7.4.4")` export default function _classPrivateFieldDestructureSet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } var descriptor = privateMap.get(receiver); if (descriptor.set) { if (!("__destrObj" in descriptor)) { descriptor.__destrObj = { set value(v) { descriptor.set.call(receiver, v) }, }; } return descriptor.__destrObj; } 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"); } return descriptor; } } `; helpers.classStaticPrivateFieldSpecGet = helper("7.0.2")` export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } `; helpers.classStaticPrivateFieldSpecSet = helper("7.0.2")` export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } 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; } return value; } `; helpers.classStaticPrivateMethodGet = helper("7.3.2")` export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } return method; } `; helpers.classStaticPrivateMethodSet = helper("7.3.2")` export default function _classStaticPrivateMethodSet() { throw new TypeError("attempted to set read only static private field"); } `; helpers.decorate = helper("7.1.5")` import toArray from "toArray"; import toPropertyKey from "toPropertyKey"; // These comments are stripped by @babel/template /*:: type PropertyDescriptor = | { value: any, writable: boolean, configurable: boolean, enumerable: boolean, } | { get?: () => any, set?: (v: any) => void, configurable: boolean, enumerable: boolean, }; type FieldDescriptor ={ writable: boolean, configurable: boolean, enumerable: boolean, }; type Placement = "static" | "prototype" | "own"; type Key = string | symbol; // PrivateName is not supported yet. type ElementDescriptor = | { kind: "method", key: Key, placement: Placement, descriptor: PropertyDescriptor } | { kind: "field", key: Key, placement: Placement, descriptor: FieldDescriptor, initializer?: () => any, }; // This is exposed to the user code type ElementObjectInput = ElementDescriptor & { [@@toStringTag]?: "Descriptor" }; // This is exposed to the user code type ElementObjectOutput = ElementDescriptor & { [@@toStringTag]?: "Descriptor" extras?: ElementDescriptor[], finisher?: ClassFinisher, }; // This is exposed to the user code type ClassObject = { [@@toStringTag]?: "Descriptor", kind: "class", elements: ElementDescriptor[], }; type ElementDecorator = (descriptor: ElementObjectInput) => ?ElementObjectOutput; type ClassDecorator = (descriptor: ClassObject) => ?ClassObject; type ClassFinisher = (cl: Class) => Class; // Only used by Babel in the transform output, not part of the spec. type ElementDefinition = | { kind: "method", value: any, key: Key, static?: boolean, decorators?: ElementDecorator[], } | { kind: "field", value: () => any, key: Key, static?: boolean, decorators?: ElementDecorator[], }; declare function ClassFactory(initialize: (instance: C) => void): { F: Class, d: ElementDefinition[] } */ /*:: // Various combinations with/without extras and with one or many finishers type ElementFinisherExtras = { element: ElementDescriptor, finisher?: ClassFinisher, extras?: ElementDescriptor[], }; type ElementFinishersExtras = { element: ElementDescriptor, finishers: ClassFinisher[], extras: ElementDescriptor[], }; type ElementsFinisher = { elements: ElementDescriptor[], finisher?: ClassFinisher, }; type ElementsFinishers = { elements: ElementDescriptor[], finishers: ClassFinisher[], }; */ /*:: type Placements = { static: Key[], prototype: Key[], own: Key[], }; */ // ClassDefinitionEvaluation (Steps 26-*) export default function _decorate( decorators /*: ClassDecorator[] */, factory /*: ClassFactory */, superClass /*: ?Class<*> */, mixins /*: ?Array */, ) /*: Class<*> */ { 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 initializeInstanceElements: function( /*::*/ O /*: C */, elements /*: ElementDescriptor[] */, ) { ["method", "field"].forEach(function(kind) { elements.forEach(function(element /*: ElementDescriptor */) { if (element.kind === kind && element.placement === "own") { this.defineClassElement(O, element); } }, this); }, this); }, // InitializeClassElements initializeClassElements: function( /*::*/ F /*: Class */, elements /*: ElementDescriptor[] */, ) { var proto = F.prototype; ["method", "field"].forEach(function(kind) { elements.forEach(function(element /*: ElementDescriptor */) { 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 defineClassElement: function( /*::*/ receiver /*: C | Class */, element /*: ElementDescriptor */, ) { var descriptor /*: PropertyDescriptor */ = 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 decorateClass: function( elements /*: ElementDescriptor[] */, decorators /*: ClassDecorator[] */, ) /*: ElementsFinishers */ { var newElements /*: ElementDescriptor[] */ = []; var finishers /*: ClassFinisher[] */ = []; var placements /*: Placements */ = { static: [], prototype: [], own: [], }; elements.forEach(function(element /*: ElementDescriptor */) { this.addElementPlacement(element, placements); }, this); elements.forEach(function(element /*: ElementDescriptor */) { if (!_hasDecorators(element)) return newElements.push(element); var elementFinishersExtras /*: 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 /*: ElementsFinishers */ = this.decorateConstructor( newElements, decorators, ); finishers.push.apply(finishers, result.finishers); result.finishers = finishers; return result; }, // AddElementPlacement addElementPlacement: function( element /*: ElementDescriptor */, placements /*: Placements */, silent /*: boolean */, ) { var keys = placements[element.placement]; if (!silent && keys.indexOf(element.key) !== -1) { throw new TypeError("Duplicated element (" + element.key + ")"); } keys.push(element.key); }, // DecorateElement decorateElement: function( element /*: ElementDescriptor */, placements /*: Placements */, ) /*: ElementFinishersExtras */ { var extras /*: ElementDescriptor[] */ = []; var finishers /*: ClassFinisher[] */ = []; for ( var decorators = element.decorators, i = decorators.length - 1; i >= 0; i-- ) { // (inlined) RemoveElementPlacement var keys = placements[element.placement]; keys.splice(keys.indexOf(element.key), 1); var elementObject /*: ElementObjectInput */ = this.fromElementDescriptor( element, ); var elementFinisherExtras /*: ElementFinisherExtras */ = this.toElementFinisherExtras( (0, decorators[i])(elementObject) /*: ElementObjectOutput */ || elementObject, ); element = elementFinisherExtras.element; this.addElementPlacement(element, placements); if (elementFinisherExtras.finisher) { finishers.push(elementFinisherExtras.finisher); } var newExtras /*: ElementDescriptor[] | void */ = 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 decorateConstructor: function( elements /*: ElementDescriptor[] */, decorators /*: ClassDecorator[] */, ) /*: ElementsFinishers */ { var finishers /*: ClassFinisher[] */ = []; for (var i = decorators.length - 1; i >= 0; i--) { var obj /*: ClassObject */ = this.fromClassDescriptor(elements); var elementsAndFinisher /*: ElementsFinisher */ = this.toClassDescriptor( (0, decorators[i])(obj) /*: ClassObject */ || 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 fromElementDescriptor: function( element /*: ElementDescriptor */, ) /*: ElementObject */ { var obj /*: ElementObject */ = { 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 toElementDescriptors: function( elementObjects /*: ElementObject[] */, ) /*: ElementDescriptor[] */ { 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 toElementDescriptor: function( elementObject /*: ElementObject */, ) /*: ElementDescriptor */ { 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 /*: PropertyDescriptor */ = elementObject.descriptor; this.disallowProperty(elementObject, "elements", "An element descriptor"); var element /*: ElementDescriptor */ = { 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 /*: ElementObject */, ) /*: ElementFinisherExtras */ { var element /*: ElementDescriptor */ = this.toElementDescriptor( elementObject, ); var finisher /*: ClassFinisher */ = _optionalCallableProperty( elementObject, "finisher", ); var extras /*: ElementDescriptors[] */ = this.toElementDescriptors( elementObject.extras, ); return { element: element, finisher: finisher, extras: extras }; }, // FromClassDescriptor fromClassDescriptor: function( elements /*: ElementDescriptor[] */, ) /*: ClassObject */ { 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 toClassDescriptor: function( obj /*: ClassObject */, ) /*: ElementsFinisher */ { 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 runClassFinishers: function( constructor /*: Class<*> */, finishers /*: ClassFinisher[] */, ) /*: Class<*> */ { for (var i = 0; i < finishers.length; i++) { var newConstructor /*: ?Class<*> */ = (0, finishers[i])(constructor); if (newConstructor !== undefined) { // NOTE: This should check if IsConstructor(newConstructor) is false. 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; } // ClassElementEvaluation function _createElementDescriptor( def /*: ElementDefinition */, ) /*: ElementDescriptor */ { var key = toPropertyKey(def.key); var descriptor /*: PropertyDescriptor */; 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 /*: ElementDescriptor */ = { 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; } // CoalesceGetterSetter function _coalesceGetterSetter( element /*: ElementDescriptor */, other /*: ElementDescriptor */, ) { if (element.descriptor.get !== undefined) { other.descriptor.get = element.descriptor.get; } else { other.descriptor.set = element.descriptor.set; } } // CoalesceClassElements function _coalesceClassElements( elements /*: ElementDescriptor[] */, ) /*: ElementDescriptor[] */ { var newElements /*: ElementDescriptor[] */ = []; var isSameElement = function( other /*: ElementDescriptor */, ) /*: boolean */ { return ( other.kind === "method" && other.key === element.key && other.placement === element.placement ); }; for (var i = 0; i < elements.length; i++) { var element /*: ElementDescriptor */ = elements[i]; var other /*: ElementDescriptor */; 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 /*: ElementDescriptor */) /*: boolean */ { return element.decorators && element.decorators.length; } function _isDataDescriptor(desc /*: PropertyDescriptor */) /*: boolean */ { return ( desc !== undefined && !(desc.value === undefined && desc.writable === undefined) ); } function _optionalCallableProperty /*::*/( obj /*: T */, name /*: $Keys */, ) /*: ?Function */ { var value = obj[name]; if (value !== undefined && typeof value !== "function") { throw new TypeError("Expected '" + name + "' to be a function"); } return value; } `; helpers.classPrivateMethodGet = helper("7.1.6")` export default function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; } `; helpers.classPrivateMethodSet = helper("7.1.6")` export default function _classPrivateMethodSet() { throw new TypeError("attempted to reassign private method"); } `; helpers.wrapRegExp = helper("7.2.6")` import wrapNativeSuper from "wrapNativeSuper"; import getPrototypeOf from "getPrototypeOf"; import possibleConstructorReturn from "possibleConstructorReturn"; import inherits from "inherits"; export default function _wrapRegExp(re, groups) { _wrapRegExp = function(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _RegExp = wrapNativeSuper(RegExp); var _super = RegExp.prototype; var _groups = new WeakMap(); 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); BabelRegExp.prototype.exec = function(str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function(str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call( this, str, substitution.replace(/\\$<([^>]+)>/g, function(_, name) { return "$" + groups[name]; }) ); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call( this, str, function() { var args = []; args.push.apply(args, arguments); if (typeof args[args.length - 1] !== "object") { // Modern engines already pass result.groups as the last arg. args.push(buildGroups(args, _this)); } return substitution.apply(this, args); } ); } else { return _super[Symbol.replace].call(this, str, substitution); } } function buildGroups(result, re) { // NOTE: This function should return undefined if there are no groups, // but in that case Babel doesn't add the wrapper anyway. var g = _groups.get(re); return Object.keys(g).reduce(function(groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); } `; babel-7.12.12/packages/babel-helpers/src/index.js000066400000000000000000000206711377064615700214760ustar00rootroot00000000000000import traverse from "@babel/traverse"; import * as t from "@babel/types"; import helpers from "./helpers"; function makePath(path) { const parts = []; for (; path.parentPath; path = path.parentPath) { parts.push(path.key); if (path.inList) parts.push(path.listKey); } 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. */ function getHelperMetadata(file) { const globals = new Set(); const localBindingNames = new Set(); // Maps imported identifier -> helper name const dependencies = new Map(); let exportName; let exportPath; const exportBindingAssignments = []; const importPaths = []; const importBindingsReferences = []; const dependencyVisitor = { ImportDeclaration(child) { const name = child.node.source.value; if (!helpers[name]) { throw child.buildCodeFrameError(`Unknown helper ${name}`); } if ( child.get("specifiers").length !== 1 || !child.get("specifiers.0").isImportDefaultSpecifier() ) { throw child.buildCodeFrameError( "Helpers can only import a default value", ); } const bindingIdentifier = child.node.specifiers[0].local; dependencies.set(bindingIdentifier, name); importPaths.push(makePath(child)); }, ExportDefaultDeclaration(child) { const decl = child.get("declaration"); if (decl.isFunctionDeclaration()) { if (!decl.node.id) { throw decl.buildCodeFrameError( "Helpers should give names to their exported func declaration", ); } exportName = decl.node.id.name; } exportPath = makePath(child); }, ExportAllDeclaration(child) { throw child.buildCodeFrameError("Helpers can only export default"); }, ExportNamedDeclaration(child) { throw child.buildCodeFrameError("Helpers can only export default"); }, Statement(child) { if (child.isModuleDeclaration()) return; child.skip(); }, }; const referenceVisitor = { Program(path) { const bindings = path.scope.getAllBindings(); Object.keys(bindings).forEach(name => { if (name === exportName) return; if (dependencies.has(bindings[name].identifier)) return; localBindingNames.add(name); }); }, ReferencedIdentifier(child) { const name = child.node.name; const binding = child.scope.getBinding(name, /* noGlobal */ true); if (!binding) { globals.add(name); } else if (dependencies.has(binding.identifier)) { importBindingsReferences.push(makePath(child)); } }, AssignmentExpression(child) { const left = child.get("left"); if (!(exportName in left.getBindingIdentifiers())) return; if (!left.isIdentifier()) { throw left.buildCodeFrameError( "Only simple assignments to exports are allowed in helpers", ); } const binding = child.scope.getBinding(exportName); if (binding?.scope.path.isProgram()) { 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."); // Process these in reverse so that mutating the references does not invalidate any later paths in // the list. exportBindingAssignments.reverse(); return { globals: Array.from(globals), localBindingNames: Array.from(localBindingNames), dependencies, exportBindingAssignments, exportPath, exportName, importBindingsReferences, importPaths, }; } /** * Given a helper AST and information about how it will be used, update the AST to match the usage. */ function permuteHelperAST(file, metadata, id, localBindings, getDependency) { if (localBindings && !id) { throw new Error("Unexpected local bindings for module-based helpers."); } if (!id) return; const { localBindingNames, dependencies, exportBindingAssignments, exportPath, exportName, importBindingsReferences, importPaths, } = metadata; const dependenciesRefs = {}; dependencies.forEach((name, id) => { dependenciesRefs[id.name] = (typeof getDependency === "function" && getDependency(name)) || id; }); const toRename = {}; const bindings = new Set(localBindings || []); localBindingNames.forEach(name => { let newName = name; while (bindings.has(newName)) newName = "_" + newName; if (newName !== name) toRename[name] = newName; }); if (id.type === "Identifier" && exportName !== id.name) { toRename[exportName] = id.name; } const visitor = { Program(path) { // We need to compute these in advance because removing nodes would // invalidate the paths. const exp = path.get(exportPath); const imps = importPaths.map(p => path.get(p)); const impsBindingRefs = importBindingsReferences.map(p => path.get(p)); const decl = exp.get("declaration"); if (id.type === "Identifier") { if (decl.isFunctionDeclaration()) { exp.replaceWith(decl); } else { exp.replaceWith( t.variableDeclaration("var", [t.variableDeclarator(id, decl.node)]), ); } } else if (id.type === "MemberExpression") { if (decl.isFunctionDeclaration()) { exportBindingAssignments.forEach(assignPath => { const assign = path.get(assignPath); assign.replaceWith(t.assignmentExpression("=", id, assign.node)); }); exp.replaceWith(decl); path.pushContainer( "body", t.expressionStatement( t.assignmentExpression("=", id, t.identifier(exportName)), ), ); } else { exp.replaceWith( t.expressionStatement(t.assignmentExpression("=", id, decl.node)), ); } } else { throw new Error("Unexpected helper format."); } Object.keys(toRename).forEach(name => { path.scope.rename(name, toRename[name]); }); for (const path of imps) path.remove(); for (const path of impsBindingRefs) { const node = t.cloneNode(dependenciesRefs[path.node.name]); path.replaceWith(node); } // We only use "traverse" for all the handy scoping helpers, so we can stop immediately without // actually doing the traversal. path.stop(); }, }; traverse(file.ast, visitor, file.scope); } const helperData = Object.create(null); function loadHelper(name) { if (!helperData[name]) { const helper = helpers[name]; if (!helper) { throw Object.assign(new ReferenceError(`Unknown helper ${name}`), { code: "BABEL_HELPER_UNKNOWN", helper: name, }); } const fn = () => { const file = { ast: t.file(helper.ast()) }; if (fileClass) { return new fileClass( { filename: `babel-helper://${name}`, }, file, ); } return file; }; const metadata = getHelperMetadata(fn()); helperData[name] = { build(getDependency, id, localBindings) { const file = fn(); permuteHelperAST(file, metadata, id, localBindings, getDependency); return { nodes: file.ast.program.body, globals: metadata.globals, }; }, minVersion() { return helper.minVersion; }, dependencies: metadata.dependencies, }; } return helperData[name]; } export function get( name, getDependency?: string => ?t.Expression, id?, localBindings?: string[], ) { return loadHelper(name).build(getDependency, id, localBindings); } export function minVersion(name: string) { return loadHelper(name).minVersion(); } export function getDependencies(name: string): $ReadOnlyArray { return Array.from(loadHelper(name).dependencies.values()); } 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); } export const list = Object.keys(helpers) .map(name => name.replace(/^_/, "")) .filter(name => name !== "__esModule"); export default get; babel-7.12.12/packages/babel-helpers/test/000077500000000000000000000000001377064615700202135ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/000077500000000000000000000000001377064615700220645ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/000077500000000000000000000000001377064615700245125ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/basic/000077500000000000000000000000001377064615700255735ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/basic/input.js000066400000000000000000000000131377064615700272620ustar00rootroot00000000000000REPLACE_ME;babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/basic/options.json000066400000000000000000000000361377064615700301600ustar00rootroot00000000000000{ "plugins": ["./plugin"] } babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/basic/output.js000066400000000000000000000001561377064615700274730ustar00rootroot00000000000000function _$_basic_main() { return _$_basic_dependency(); } function _$_basic_dependency() {} _$_basic_main; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/basic/plugin.js000066400000000000000000000010531377064615700274260ustar00rootroot00000000000000const defineHelper = require("../../../helpers/define-helper").default; const dependency = defineHelper(__dirname, "dependency", ` export default function fn() {} `); const main = defineHelper(__dirname, "main", ` import dep from "${dependency}"; export default function helper() { return dep(); } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name !== "REPLACE_ME") return; const helper = this.addHelper(main); path.replaceWith(helper); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/deep/000077500000000000000000000000001377064615700254275ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/deep/input.js000066400000000000000000000000131377064615700271160ustar00rootroot00000000000000REPLACE_ME;babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/deep/options.json000066400000000000000000000000361377064615700300140ustar00rootroot00000000000000{ "plugins": ["./plugin"] } babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/deep/output.js000066400000000000000000000002601377064615700273230ustar00rootroot00000000000000function _$_deep_main() { return _$_deep_dependency(); } function _$_deep_dependency() { return _$_deep_dependencyDeep; } function _$_deep_dependencyDeep() {} _$_deep_main; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/deep/plugin.js000066400000000000000000000013041377064615700272610ustar00rootroot00000000000000const defineHelper = require("../../../helpers/define-helper").default; const dependencyDeep = defineHelper(__dirname, "dependencyDeep", ` export default function fn() {} `) const dependency = defineHelper(__dirname, "dependency", ` import f from "${dependencyDeep}"; export default function fn() { return f; } `); const main = defineHelper(__dirname, "main", ` import dep from "${dependency}"; export default function helper() { return dep(); } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name !== "REPLACE_ME") return; const helper = this.addHelper(main); path.replaceWith(helper); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/missing/000077500000000000000000000000001377064615700261635ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/missing/input.js000066400000000000000000000000131377064615700276520ustar00rootroot00000000000000REPLACE_ME;babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/missing/options.json000066400000000000000000000000571377064615700305530ustar00rootroot00000000000000{ "plugins": ["./plugin"], "throws": " " } babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/missing/plugin.js000066400000000000000000000007231377064615700300210ustar00rootroot00000000000000const defineHelper = require("../../../helpers/define-helper").default; const main = defineHelper(__dirname, "main", ` import dep from "(!!!)%-..a,4892 missing"; export default function helper() { return dep(); } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name !== "REPLACE_ME") return; const helper = this.addHelper(main); path.replaceWith(helper); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/multiple/000077500000000000000000000000001377064615700263455ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/multiple/input.js000066400000000000000000000000131377064615700300340ustar00rootroot00000000000000REPLACE_ME;babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/multiple/options.json000066400000000000000000000000361377064615700307320ustar00rootroot00000000000000{ "plugins": ["./plugin"] } babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/multiple/output.js000066400000000000000000000003051377064615700302410ustar00rootroot00000000000000function _$_multiple_main() { return _$_multiple_dependency() + _$_multiple_dependency2(); } function _$_multiple_dependency2() { 1; } function _$_multiple_dependency() { 0; } _$_multiple_main; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/multiple/plugin.js000066400000000000000000000013121377064615700301760ustar00rootroot00000000000000const defineHelper = require("../../../helpers/define-helper").default; const dependency1 = defineHelper(__dirname, "dependency1", ` export default function fn() { 0; } `); const dependency2 = defineHelper(__dirname, "dependency2", ` export default function fn() { 1; } `); const main = defineHelper(__dirname, "main", ` import dep1 from "${dependency1}"; import dep2 from "${dependency2}"; export default function helper() { return dep1() + dep2(); } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name !== "REPLACE_ME") return; const helper = this.addHelper(main); path.replaceWith(helper); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-binding-equal/000077500000000000000000000000001377064615700304765ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-binding-equal/input.js000066400000000000000000000000131377064615700321650ustar00rootroot00000000000000REPLACE_ME;babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-binding-equal/options.json000066400000000000000000000000361377064615700330630ustar00rootroot00000000000000{ "plugins": ["./plugin"] } babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-binding-equal/output.js000066400000000000000000000003431377064615700323740ustar00rootroot00000000000000let _foo = "main"; function _$_renameBindingEqual_main() { return _$_renameBindingEqual_dependency() + _foo; } let foo = "dependency"; function _$_renameBindingEqual_dependency() { return foo; } _$_renameBindingEqual_main; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-binding-equal/plugin.js000066400000000000000000000011541377064615700323330ustar00rootroot00000000000000const defineHelper = require("../../../helpers/define-helper").default; const dependency = defineHelper(__dirname, "dependency", ` let foo = "dependency"; export default function fn() { return foo } `); const main = defineHelper(__dirname, "main", ` import dep from "${dependency}"; let foo = "main"; export default function helper() { return dep() + foo; } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name !== "REPLACE_ME") return; const helper = this.addHelper(main); path.replaceWith(helper); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-deep-global/000077500000000000000000000000001377064615700301325ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-deep-global/input.js000066400000000000000000000000641377064615700316270ustar00rootroot00000000000000REPLACE_ME; let Promise = "I will be a good guy!"; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-deep-global/options.json000066400000000000000000000000361377064615700325170ustar00rootroot00000000000000{ "plugins": ["./plugin"] } babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-deep-global/output.js000066400000000000000000000003361377064615700320320ustar00rootroot00000000000000function _$_renameDeepGlobal_main() { return _$_renameDeepGlobal_dependency() || Promise; } function _$_renameDeepGlobal_dependency() { return Promise; } _$_renameDeepGlobal_main; let _Promise = "I will be a good guy!"; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/rename-deep-global/plugin.js000066400000000000000000000011151377064615700317640ustar00rootroot00000000000000const defineHelper = require("../../../helpers/define-helper").default; const dependency = defineHelper(__dirname, "dependency", ` export default function fn() { return Promise; } `); const main = defineHelper(__dirname, "main", ` import dep from "${dependency}"; export default function helper() { return dep() || Promise; } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name !== "REPLACE_ME") return; const helper = this.addHelper(main); path.replaceWith(helper); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/reuse-dependency/000077500000000000000000000000001377064615700277515ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/reuse-dependency/input.js000066400000000000000000000000331377064615700314420ustar00rootroot00000000000000REPLACE_ME_1; REPLACE_ME_2;babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/reuse-dependency/options.json000066400000000000000000000000361377064615700323360ustar00rootroot00000000000000{ "plugins": ["./plugin"] } babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/reuse-dependency/output.js000066400000000000000000000002711377064615700316470ustar00rootroot00000000000000function _$_reuseDependency_main() { return _$_reuseDependency_dependency(); } function _$_reuseDependency_dependency() { 0; } _$_reuseDependency_main; _$_reuseDependency_dependency; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/reuse-dependency/plugin.js000066400000000000000000000013461377064615700316110ustar00rootroot00000000000000const defineHelper = require("../../../helpers/define-helper").default; const dependency = defineHelper(__dirname, "dependency", ` export default function fn() { 0; } `); const main = defineHelper(__dirname, "main", ` import dep from "${dependency}"; export default function helper() { return dep(); } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name === "REPLACE_ME_1") { const mainHelper = this.addHelper(main); path.replaceWith(mainHelper); } else if (path.node.name === "REPLACE_ME_2") { const dependencyHelper = this.addHelper(dependency); path.replaceWith(dependencyHelper); } }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/variable-same-name-dependency/000077500000000000000000000000001377064615700322545ustar00rootroot00000000000000input.js000066400000000000000000000000131377064615700336640ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/variable-same-name-dependencyREPLACE_ME;options.json000066400000000000000000000000361377064615700345620ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/variable-same-name-dependency{ "plugins": ["./plugin"] } output.js000066400000000000000000000003561377064615700340770ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/variable-same-name-dependencyfunction _$_variableSameNameDependency_main() { let x = _$_variableSameNameDependency_dependency; return function (dep) { return x() + dep; }; } function _$_variableSameNameDependency_dependency() {} _$_variableSameNameDependency_main; plugin.js000066400000000000000000000011441377064615700340310ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/dependencies/variable-same-name-dependencyconst defineHelper = require("../../../helpers/define-helper").default; const dependency = defineHelper(__dirname, "dependency", ` export default function fn() {} `); const main = defineHelper(__dirname, "main", ` import dep from "${dependency}"; export default function helper() { let x = dep; return function (dep) { return x() + dep; } } `); module.exports = function() { return { visitor: { Identifier(path) { if (path.node.name !== "REPLACE_ME") return; const helper = this.addHelper(main); path.replaceWith(helper); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/fixtures/regression/000077500000000000000000000000001377064615700242445ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/regression/9496/000077500000000000000000000000001377064615700246575ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/fixtures/regression/9496/input.js000066400000000000000000000000131377064615700263460ustar00rootroot00000000000000REPLACE_ME;babel-7.12.12/packages/babel-helpers/test/fixtures/regression/9496/options.json000066400000000000000000000000361377064615700272440ustar00rootroot00000000000000{ "plugins": ["./plugin"] } babel-7.12.12/packages/babel-helpers/test/fixtures/regression/9496/output.js000066400000000000000000000001041377064615700265500ustar00rootroot00000000000000function _$_9496_main_hub_is_found() {} _$_9496_main_hub_is_found; babel-7.12.12/packages/babel-helpers/test/fixtures/regression/9496/plugin.js000066400000000000000000000007731377064615700265220ustar00rootroot00000000000000const 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); }, }, }; }; babel-7.12.12/packages/babel-helpers/test/helpers/000077500000000000000000000000001377064615700216555ustar00rootroot00000000000000babel-7.12.12/packages/babel-helpers/test/helpers/define-helper.js000066400000000000000000000011151377064615700247200ustar00rootroot00000000000000import path from "path"; import template from "@babel/template"; import helpers from "../../lib/helpers"; function getHelperId(dir, name) { const testName = path.basename(dir); return `_$_${testName}_${name}`; } export default function defineHelper( dir: string, name: string, code: string, ): string { const id = getHelperId(dir, name); if (id in helpers) { throw new Error(`The ${id} helper is already defined.`); } Object.defineProperty(helpers, id, { value: { minVersion: "7.0.0-beta.0", ast: template.program(code), }, }); return id; } babel-7.12.12/packages/babel-helpers/test/index.js000066400000000000000000000001131377064615700216530ustar00rootroot00000000000000import runner from "@babel/helper-plugin-test-runner"; runner(__dirname); babel-7.12.12/packages/babel-highlight/000077500000000000000000000000001377064615700175415ustar00rootroot00000000000000babel-7.12.12/packages/babel-highlight/.npmignore000066400000000000000000000000171377064615700215360ustar00rootroot00000000000000src test *.log babel-7.12.12/packages/babel-highlight/README.md000066400000000000000000000004771377064615700210300ustar00rootroot00000000000000# @babel/highlight > Syntax highlight JavaScript strings for output in terminals. See our website [@babel/highlight](https://babeljs.io/docs/en/babel-highlight) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/highlight ``` or using yarn: ```sh yarn add @babel/highlight --dev ``` babel-7.12.12/packages/babel-highlight/package.json000066400000000000000000000011741377064615700220320ustar00rootroot00000000000000{ "name": "@babel/highlight", "version": "7.10.4", "description": "Syntax highlight JavaScript strings for output in terminals.", "author": "suchipi ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-highlight" }, "main": "lib/index.js", "dependencies": { "@babel/helper-validator-identifier": "workspace:^7.10.4", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, "devDependencies": { "strip-ansi": "^4.0.0" } } babel-7.12.12/packages/babel-highlight/src/000077500000000000000000000000001377064615700203305ustar00rootroot00000000000000babel-7.12.12/packages/babel-highlight/src/index.js000066400000000000000000000053771377064615700220110ustar00rootroot00000000000000import jsTokens, { matchToToken } from "js-tokens"; import { isReservedWord, isKeyword } from "@babel/helper-validator-identifier"; import Chalk from "chalk"; /** * Chalk styles for token types. */ function getDefs(chalk) { return { keyword: chalk.cyan, capitalized: chalk.yellow, jsx_tag: chalk.yellow, punctuator: chalk.yellow, // bracket: intentionally omitted. number: chalk.magenta, string: chalk.green, regex: chalk.magenta, comment: chalk.grey, invalid: chalk.white.bgRed.bold, }; } /** * RegExp to test for newlines in terminal. */ const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; /** * RegExp to test for what seems to be a JSX tag name. */ const JSX_TAG = /^[a-z][\w-]*$/i; /** * RegExp to test for the three types of brackets. */ const BRACKET = /^[()[\]{}]$/; /** * Get the type of token, specifying punctuator type. */ function getTokenType(match) { const [offset, text] = match.slice(-2); const token = matchToToken(match); if (token.type === "name") { if (isKeyword(token.value) || isReservedWord(token.value)) { return "keyword"; } if ( JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == " colorize(str)) .join("\n"); } else { return args[0]; } }); } type Options = { forceColor?: boolean, }; /** * Whether the code should be highlighted given the passed options. */ export function shouldHighlight(options: Options): boolean { return Chalk.supportsColor || options.forceColor; } /** * The Chalk instance that should be used given the passed options. */ export function getChalk(options: Options) { let chalk = Chalk; if (options.forceColor) { chalk = new Chalk.constructor({ enabled: true, level: 1 }); } return chalk; } /** * Highlight `code`. */ export default function highlight(code: string, options: Options = {}): string { if (shouldHighlight(options)) { const chalk = getChalk(options); const defs = getDefs(chalk); return highlightTokens(defs, code); } else { return code; } } babel-7.12.12/packages/babel-highlight/test/000077500000000000000000000000001377064615700205205ustar00rootroot00000000000000babel-7.12.12/packages/babel-highlight/test/index.js000066400000000000000000000066021377064615700221710ustar00rootroot00000000000000import chalk from "chalk"; import stripAnsi from "strip-ansi"; import highlight, { shouldHighlight, getChalk } from ".."; describe("@babel/highlight", function () { function stubColorSupport(supported) { let originalSupportsColor; beforeEach(function () { originalSupportsColor = chalk.supportsColor; chalk.supportsColor = supported; }); afterEach(function () { chalk.supportsColor = originalSupportsColor; }); } describe("highlight", function () { describe("when colors are supported", function () { stubColorSupport(true); it("highlights code", function () { const code = "console.log('hi')"; const result = highlight(code); const stripped = stripAnsi(result); expect(result.length).toBeGreaterThan(stripped.length); expect(stripped).toBe(code); }); }); describe("when colors are not supported", function () { stubColorSupport(false); it("does not attempt to highlight code", function () { const code = "console.log('hi')"; const result = highlight(code); const stripped = stripAnsi(result); expect(result.length).toBe(stripped.length); expect(result).toBe(code); }); describe("and the forceColor option is passed", function () { it("highlights the code anyway", function () { const code = "console.log('hi')"; const result = highlight(code, { forceColor: true }); const stripped = stripAnsi(result); expect(result.length).toBeGreaterThan(stripped.length); expect(stripped).toBe(code); }); }); }); }); describe("shouldHighlight", function () { describe("when colors are supported", function () { stubColorSupport(true); it("returns true", function () { expect(shouldHighlight({})).toBeTruthy(); }); }); describe("when colors are not supported", function () { stubColorSupport(false); it("returns false", function () { expect(shouldHighlight({})).toBeFalsy(); }); describe("and the forceColor option is passed", function () { it("returns true", function () { expect(shouldHighlight({ forceColor: true })).toBeTruthy(); }); }); }); }); describe("getChalk", function () { describe("when colors are supported", function () { stubColorSupport(true); describe("when forceColor is not passed", function () { it("returns a Chalk instance", function () { expect(getChalk({}).constructor).toBe(chalk.constructor); }); }); describe("when forceColor is passed", function () { it("returns a Chalk instance", function () { expect(getChalk({ forceColor: true }).constructor).toBe( chalk.constructor, ); }); }); }); describe("when colors are not supported", function () { stubColorSupport(false); describe("when forceColor is not passed", function () { it("returns a Chalk instance", function () { expect(getChalk({}).constructor).toBe(chalk.constructor); }); }); describe("when forceColor is passed", function () { it("returns a Chalk instance", function () { expect(getChalk({ forceColor: true }).constructor).toBe( chalk.constructor, ); }); }); }); }); }); babel-7.12.12/packages/babel-node/000077500000000000000000000000001377064615700165175ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/.npmignore000066400000000000000000000000261377064615700205140ustar00rootroot00000000000000src test node_modules babel-7.12.12/packages/babel-node/README.md000066400000000000000000000003741377064615700200020ustar00rootroot00000000000000# @babel/node > Babel command line See our website [@babel/node](https://babeljs.io/docs/en/babel-node) for more information. ## Install Using npm: ```sh npm install --save-dev @babel/node ``` or using yarn: ```sh yarn add @babel/node --dev ``` babel-7.12.12/packages/babel-node/bin/000077500000000000000000000000001377064615700172675ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/bin/babel-node.js000077500000000000000000000000631377064615700216170ustar00rootroot00000000000000#!/usr/bin/env node require("../lib/babel-node"); babel-7.12.12/packages/babel-node/package.json000066400000000000000000000021141377064615700210030ustar00rootroot00000000000000{ "name": "@babel/node", "version": "7.12.10", "description": "Babel command line", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-node" }, "keywords": [ "6to5", "babel", "es6", "transpile", "transpiler", "babel-cli", "compiler" ], "dependencies": { "@babel/register": "workspace:^7.12.10", "commander": "^4.0.1", "core-js": "^3.2.1", "lodash": "^4.17.19", "node-environment-flags": "^1.0.5", "regenerator-runtime": "^0.13.4", "v8flags": "^3.1.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { "@babel/core": "workspace:*", "@babel/helper-fixtures": "workspace:*", "@babel/runtime": "workspace:*", "fs-readdir-recursive": "^1.0.0", "make-dir": "^2.1.0", "rimraf": "^3.0.0" }, "bin": { "babel-node": "./bin/babel-node.js" } } babel-7.12.12/packages/babel-node/src/000077500000000000000000000000001377064615700173065ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/src/_babel-node.js000066400000000000000000000144451377064615700220030ustar00rootroot00000000000000import commander from "commander"; import Module from "module"; import { inspect } from "util"; import path from "path"; import repl from "repl"; import * as babel from "@babel/core"; import vm from "vm"; import "core-js/stable"; import "regenerator-runtime/runtime"; import register from "@babel/register"; import pkg from "../package.json"; const program = new commander.Command("babel-node"); function collect(value, previousValue): Array { // If the user passed the option with no value, like "babel-node file.js --presets", do nothing. if (typeof value !== "string") return previousValue; const values = value.split(","); return previousValue ? previousValue.concat(values) : values; } program.option("-e, --eval [script]", "Evaluate script"); program.option( "--no-babelrc", "Specify whether or not to use .babelrc and .babelignore files", ); program.option("-r, --require [module]", "Require module"); program.option("-p, --print [code]", "Evaluate script and print result"); program.option( "-o, --only [globs]", "A comma-separated list of glob patterns to compile", collect, ); program.option( "-i, --ignore [globs]", "A comma-separated list of glob patterns to skip compiling", collect, ); program.option( "-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js,.es,.jsx,.mjs]", collect, ); program.option( "--config-file [path]", "Path to the babel config file to use. Defaults to working directory babel.config.js", ); program.option( "--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + "Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.", ); program.option( "--root-mode [mode]", "The project-root resolution mode. " + "One of 'root' (the default), 'upward', or 'upward-optional'.", ); program.option("-w, --plugins [string]", "", collect); program.option("-b, --presets [string]", "", collect); program.version(pkg.version); program.usage("[options] [ -e script | script.js ] [arguments]"); program.parse(process.argv); const babelOptions = { caller: { name: "@babel/node", }, extensions: program.extensions, ignore: program.ignore, only: program.only, plugins: program.plugins, presets: program.presets, configFile: program.configFile, envName: program.envName, rootMode: program.rootMode, // Commander will default the "--no-" arguments to true, but we want to // leave them undefined so that @babel/core can handle the // default-assignment logic on its own. babelrc: program.babelrc === true ? undefined : program.babelrc, }; for (const key of Object.keys(babelOptions)) { if (babelOptions[key] === undefined) { delete babelOptions[key]; } } register(babelOptions); const replPlugin = ({ types: t }) => ({ visitor: { ModuleDeclaration(path) { throw path.buildCodeFrameError("Modules aren't supported in the REPL"); }, VariableDeclaration(path) { if (path.node.kind !== "var") { throw path.buildCodeFrameError( "Only `var` variables are supported in the REPL", ); } }, Program(path) { if (path.get("body").some(child => child.isExpressionStatement())) return; // If the executed code doesn't evaluate to a value, // prevent implicit strict mode from printing 'use strict'. path.pushContainer( "body", t.expressionStatement(t.identifier("undefined")), ); }, }, }); const _eval = function (code, filename) { code = code.trim(); if (!code) return undefined; code = babel.transform(code, { filename: filename, presets: program.presets, plugins: (program.plugins || []).concat([replPlugin]), }).code; return vm.runInThisContext(code, { filename: filename, }); }; if (program.eval || program.print) { let code = program.eval; if (!code || code === true) code = program.print; global.__filename = "[eval]"; global.__dirname = process.cwd(); const module = new Module(global.__filename); module.filename = global.__filename; module.paths = Module._nodeModulePaths(global.__dirname); global.exports = module.exports; global.module = module; global.require = module.require.bind(module); const result = _eval(code, global.__filename); if (program.print) { const output = typeof result === "string" ? result : inspect(result); process.stdout.write(output + "\n"); } } else { if (program.args.length) { // slice all arguments up to the first filename since they're babel args that we handle let args = process.argv.slice(2); let i = 0; let ignoreNext = false; args.some(function (arg, i2) { if (ignoreNext) { ignoreNext = false; return; } if (arg[0] === "-") { 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 { i = i2; return true; } }); args = args.slice(i); requireArgs(); // make the filename absolute const filename = args[0]; if (!path.isAbsolute(filename)) { args[0] = path.join(process.cwd(), filename); } // add back on node and concat the sliced args process.argv = ["node"].concat(args); process.execArgv.unshift(__filename); Module.runMain(); } else { requireArgs(); replStart(); } } // We have to handle require ourselves, as we want to require it in the context of babel-register function requireArgs() { if (program.require) { require(require.resolve(program.require, { paths: [process.cwd()], })); } } function replStart() { repl.start({ prompt: "babel > ", input: process.stdin, output: process.stdout, eval: replEval, useGlobal: true, }); } function replEval(code, context, filename, callback) { let err; let result; try { if (code[0] === "(" && code[code.length - 1] === ")") { code = code.slice(1, -1); // remove "(" and ")" } result = _eval(code, filename); } catch (e) { err = e; } callback(err, result); } babel-7.12.12/packages/babel-node/src/babel-node.js000077500000000000000000000047131377064615700216440ustar00rootroot00000000000000/** * This tiny wrapper file checks for known node flags and appends them * when found, before invoking the "real" _babel-node(1) executable. */ import getV8Flags from "v8flags"; import path from "path"; let args = [path.join(__dirname, "_babel-node")]; let babelArgs = process.argv.slice(2); let userArgs; // separate node arguments from script arguments const argSeparator = babelArgs.indexOf("--"); if (argSeparator > -1) { userArgs = babelArgs.slice(argSeparator); // including the -- babelArgs = babelArgs.slice(0, argSeparator); } /** * Replace dashes with underscores in the v8Flag name * Also ensure that if the arg contains a value (e.g. --arg=true) * that only the flag is returned. */ function getNormalizedV8Flag(arg) { // v8 uses the "no" prefix to negate boolean flags (e.g. --nolazy), // but they are not listed by v8flags const matches = arg.match(/--(?:no)?(.+)/); if (matches) { return `--${matches[1].replace(/-/g, "_")}`; } return arg; } // These are aliases for node options defined by babel-node. const aliases = new Map([ ["-d", "--debug"], ["-gc", "--expose-gc"], ]); getV8Flags(function (err, v8Flags) { for (let i = 0; i < babelArgs.length; i++) { const arg = babelArgs[i]; const flag = arg.split("=")[0]; if (flag === "-r" || flag === "--require") { args.push(flag); args.push(babelArgs[++i]); } else if (aliases.has(flag)) { args.unshift(aliases.get(flag)); } else if ( flag === "debug" || // node debug foo.js flag === "inspect" || v8Flags.indexOf(getNormalizedV8Flag(flag)) >= 0 || process.allowedNodeEnvironmentFlags.has(flag) ) { args.unshift(arg); } else { args.push(arg); } } // append arguments passed after -- if (argSeparator > -1) { args = args.concat(userArgs); } try { const kexec = require("kexec"); kexec(process.argv[0], args); } catch (err) { if ( err.code !== "MODULE_NOT_FOUND" && err.code !== "UNDECLARED_DEPENDENCY" ) { throw err; } const child_process = require("child_process"); const proc = child_process.spawn(process.argv[0], args, { stdio: "inherit", }); proc.on("exit", function (code, signal) { process.on("exit", function () { if (signal) { process.kill(process.pid, signal); } else { process.exitCode = code; } }); }); process.on("SIGINT", () => proc.kill("SIGINT")); } }); babel-7.12.12/packages/babel-node/test/000077500000000000000000000000001377064615700174765ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/config.json000066400000000000000000000003661377064615700216430ustar00rootroot00000000000000{ "presets": [ "../../babel-preset-env", ["../../babel-preset-react"] ], "plugins": [ "../../babel-plugin-transform-strict-mode", "../../babel-plugin-transform-modules-commonjs" ], "only": ["../../../packages/*/test"] } babel-7.12.12/packages/babel-node/test/fixtures/000077500000000000000000000000001377064615700213475ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/000077500000000000000000000000001377064615700233375ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--config-file/000077500000000000000000000000001377064615700256535ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--config-file/in-files/000077500000000000000000000000001377064615700273615ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--config-file/in-files/configFile.js000066400000000000000000000002131377064615700317600ustar00rootroot00000000000000module.exports = function (api) { api.cache.forever(); console.log("Config was loaded, so --config-file was used."); return {}; }; babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--config-file/in-files/index.js000066400000000000000000000000241377064615700310220ustar00rootroot00000000000000console.log("foo"); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--config-file/options.json000066400000000000000000000000741377064615700302420ustar00rootroot00000000000000{ "args": ["--config-file", "./configFile.js", "index"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--config-file/stdout.txt000066400000000000000000000000621377064615700277340ustar00rootroot00000000000000Config was loaded, so --config-file was used. foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--env-name/000077500000000000000000000000001377064615700251775ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--env-name/.babelrc000066400000000000000000000001241377064615700265670ustar00rootroot00000000000000{ "env": { "env-name-test": { "plugins": ["./logPlugin.js"] } } } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--env-name/in-files/000077500000000000000000000000001377064615700267055ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--env-name/in-files/index.js000066400000000000000000000000241377064615700303460ustar00rootroot00000000000000console.log("foo"); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--env-name/in-files/logPlugin.js000066400000000000000000000001511377064615700312000ustar00rootroot00000000000000module.exports = function () { console.log("Plugin was loaded, so --env-name matched."); return {} } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--env-name/options.json000066400000000000000000000000671377064615700275700ustar00rootroot00000000000000{ "args": ["--env-name", "env-name-test", "index"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--env-name/stdout.txt000066400000000000000000000000561377064615700272630ustar00rootroot00000000000000Plugin was loaded, so --env-name matched. foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--eval/000077500000000000000000000000001377064615700244205ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--eval/options.json000066400000000000000000000001371377064615700270070ustar00rootroot00000000000000{ "args": ["--eval", "console.log([1, 2, 3].map(x => x * x));"], "stdout": "[ 1, 4, 9 ]" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--extensions/000077500000000000000000000000001377064615700256705ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--extensions/in-files/000077500000000000000000000000001377064615700273765ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--extensions/in-files/foo.bar000066400000000000000000000000501377064615700306420ustar00rootroot00000000000000console.log([1, 2, 3].map(x => x * x)); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--extensions/options.json000066400000000000000000000001111377064615700302470ustar00rootroot00000000000000{ "args": ["foo", "--extensions", ".bar"], "stdout": "[ 1, 4, 9 ]" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--no-babelrc/000077500000000000000000000000001377064615700254755ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--no-babelrc/.babelrc000066400000000000000000000000441377064615700270660ustar00rootroot00000000000000{ "plugins": ["./logPlugin.js"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--no-babelrc/in-files/000077500000000000000000000000001377064615700272035ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--no-babelrc/in-files/index.js000066400000000000000000000000241377064615700306440ustar00rootroot00000000000000console.log("foo"); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--no-babelrc/in-files/logPlugin.js000066400000000000000000000001671377064615700315050ustar00rootroot00000000000000module.exports = function () { console.log("Plugin was loaded, shouldn't appear due to --no-babelrc"); return {} } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--no-babelrc/options.json000066400000000000000000000000501377064615700300560ustar00rootroot00000000000000{ "args": ["--no-babelrc", "index"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--no-babelrc/stdout.txt000066400000000000000000000000041377064615700275520ustar00rootroot00000000000000foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--presets/000077500000000000000000000000001377064615700251565ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--presets/in-files/000077500000000000000000000000001377064615700266645ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--presets/in-files/index.js000066400000000000000000000000241377064615700303250ustar00rootroot00000000000000console.log("foo"); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--presets/in-files/presetFile.js000066400000000000000000000001531377064615700313230ustar00rootroot00000000000000module.exports = function () { console.log("Preset was loaded, so --presets was used."); return {}; }; babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--presets/options.json000066400000000000000000000000701377064615700275410ustar00rootroot00000000000000{ "args": ["--presets", "./presetFile.js", "index"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--presets/stdout.txt000066400000000000000000000000561377064615700272420ustar00rootroot00000000000000Preset was loaded, so --presets was used. foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--print/000077500000000000000000000000001377064615700246255ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--print/options.json000066400000000000000000000001361377064615700272130ustar00rootroot00000000000000{ "args": ["--print", "--eval", "([1, 2, 3].map(x => x * x))"], "stdout": "[ 1, 4, 9 ]" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require/000077500000000000000000000000001377064615700251455ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require/in-files/000077500000000000000000000000001377064615700266535ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require/in-files/dep.js000066400000000000000000000000231377064615700277540ustar00rootroot00000000000000console.log("dep");babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require/in-files/foo.js000066400000000000000000000000241377064615700277700ustar00rootroot00000000000000console.log("foo"); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require/options.json000066400000000000000000000000451377064615700275320ustar00rootroot00000000000000{ "args": ["foo", "-r", "./dep"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require/stdout.txt000066400000000000000000000000101377064615700272170ustar00rootroot00000000000000dep foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require_node_modules/000077500000000000000000000000001377064615700277025ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/000077500000000000000000000000001377064615700314105ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/foo.js000066400000000000000000000000241377064615700325250ustar00rootroot00000000000000console.log("foo"); node_modules/000077500000000000000000000000001377064615700340065ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-filesdep.js000066400000000000000000000000231377064615700351070ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/node_modulesconsole.log("dep");babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require_node_modules/options.json000066400000000000000000000000431377064615700322650ustar00rootroot00000000000000{ "args": ["foo", "-r", "dep"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/--require_node_modules/stdout.txt000066400000000000000000000000101377064615700317540ustar00rootroot00000000000000dep foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/-b/000077500000000000000000000000001377064615700236355ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/-b/in-files/000077500000000000000000000000001377064615700253435ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/-b/in-files/index.js000066400000000000000000000000241377064615700270040ustar00rootroot00000000000000console.log("foo"); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/-b/in-files/presetFile.js000066400000000000000000000001441377064615700300020ustar00rootroot00000000000000module.exports = function () { console.log("Preset was loaded, so -b was used."); return {}; }; babel-7.12.12/packages/babel-node/test/fixtures/babel-node/-b/options.json000066400000000000000000000000611377064615700262200ustar00rootroot00000000000000{ "args": ["-b", "./presetFile.js", "index"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/-b/stdout.txt000066400000000000000000000000471377064615700257210ustar00rootroot00000000000000Preset was loaded, so -b was used. foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/arguments/000077500000000000000000000000001377064615700253445ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/arguments/in-files/000077500000000000000000000000001377064615700270525ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/arguments/in-files/bar.js000066400000000000000000000000361377064615700301530ustar00rootroot00000000000000console.log(process.argv[2]); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/arguments/options.json000066400000000000000000000000601377064615700277260ustar00rootroot00000000000000{ "args": ["bar", "foo"], "stdout": "foo" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/directory/000077500000000000000000000000001377064615700253435ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/directory/in-files/000077500000000000000000000000001377064615700270515ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/directory/in-files/foo/000077500000000000000000000000001377064615700276345ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/directory/in-files/foo/index.js000066400000000000000000000000531377064615700312770ustar00rootroot00000000000000var foo = () => console.log("foo"); foo(); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/directory/options.json000066400000000000000000000000261377064615700277270ustar00rootroot00000000000000{ "args": ["foo"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/directory/stdout.txt000066400000000000000000000000041377064615700274200ustar00rootroot00000000000000foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/filename/000077500000000000000000000000001377064615700251175ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/filename/in-files/000077500000000000000000000000001377064615700266255ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/filename/in-files/bar.js000066400000000000000000000000531377064615700277250ustar00rootroot00000000000000var foo = () => console.log("foo"); foo(); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/filename/options.json000066400000000000000000000000261377064615700275030ustar00rootroot00000000000000{ "args": ["bar"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/filename/stdout.txt000066400000000000000000000000041377064615700271740ustar00rootroot00000000000000foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/no-strict/000077500000000000000000000000001377064615700252615ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/no-strict/options.json000066400000000000000000000001131377064615700276420ustar00rootroot00000000000000{ "args": ["--eval", "--print", "var a = 1;"], "stdout": "undefined" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/node_--inspect/000077500000000000000000000000001377064615700261435ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/node_--inspect/options.json000066400000000000000000000002171377064615700305310ustar00rootroot00000000000000{ "args": ["--inspect", "--eval", "console.log('foo');"], "stderr": "Debugger listening on", "stderrContains": true, "stdout": "foo" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/node_--no-lazy/000077500000000000000000000000001377064615700260675ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/node_--no-lazy/options.json000066400000000000000000000001161377064615700304530ustar00rootroot00000000000000{ "args": ["--nolazy", "--eval", "console.log('foo')"], "stdout": "foo" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/node_-gc_alias_--expose-gc/000077500000000000000000000000001377064615700302675ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/node_-gc_alias_--expose-gc/options.json000066400000000000000000000001311377064615700326500ustar00rootroot00000000000000{ "args": ["-gc", "--eval", "console.log(typeof global.gc)"], "stdout": "function" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/require/000077500000000000000000000000001377064615700250135ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/require/in-files/000077500000000000000000000000001377064615700265215ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/require/in-files/bar2.js000066400000000000000000000000531377064615700277030ustar00rootroot00000000000000var bar = () => console.log("bar"); bar(); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/require/in-files/foo2.js000066400000000000000000000001321377064615700277200ustar00rootroot00000000000000import "./bar2"; import "./not_node_modules"; var foo = () => console.log("foo"); foo(); babel-7.12.12/packages/babel-node/test/fixtures/babel-node/require/in-files/not_node_modules.jsx000066400000000000000000000005621377064615700326070ustar00rootroot00000000000000/* The purpose of this file is to test that the node_modules check in the require hook doesn't mistakenly exclude something like "not_node_modules". To pass, this file merely needs to be transpiled. The transpiled code won't, and doesn't need to, execute without error. It won't execute because React will be undefined. */ try { ; } catch (e) {} babel-7.12.12/packages/babel-node/test/fixtures/babel-node/require/options.json000066400000000000000000000000271377064615700274000ustar00rootroot00000000000000{ "args": ["foo2"] } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/require/stdout.txt000066400000000000000000000000101377064615700270650ustar00rootroot00000000000000bar foo babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-dashed-with-param/000077500000000000000000000000001377064615700277635ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-dashed-with-param/options.json000066400000000000000000000002231377064615700323460ustar00rootroot00000000000000{ "args": [ "--expose-gc-as=garbageCollector", "--eval", "console.log(typeof global.garbageCollector)" ], "stdout": "function" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-dashed/000077500000000000000000000000001377064615700257145ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-dashed/options.json000066400000000000000000000001411377064615700302760ustar00rootroot00000000000000{ "args": ["--expose-gc", "--eval", "console.log(typeof global.gc)"], "stdout": "function" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-underscored-with-param/000077500000000000000000000000001377064615700310505ustar00rootroot00000000000000options.json000066400000000000000000000002231377064615700333540ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-underscored-with-param{ "args": [ "--expose_gc_as=garbageCollector", "--eval", "console.log(typeof global.garbageCollector)" ], "stdout": "function" } babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-underscored/000077500000000000000000000000001377064615700270015ustar00rootroot00000000000000babel-7.12.12/packages/babel-node/test/fixtures/babel-node/v8Flag-underscored/options.json000066400000000000000000000001411377064615700313630ustar00rootroot00000000000000{ "args": ["--expose_gc", "--eval", "console.log(typeof global.gc)"], "stdout": "function" } babel-7.12.12/packages/babel-node/test/index.js000066400000000000000000000117201377064615700211440ustar00rootroot00000000000000const includes = require("lodash/includes"); const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); const fs = require("fs"); const fixtureLoc = path.join(__dirname, "fixtures"); const tmpLoc = path.join(__dirname, "tmp"); const fileFilter = function (x) { return x !== ".DS_Store"; }; const outputFileSync = function (filePath, data) { makeDirSync(path.dirname(filePath)); fs.writeFileSync(filePath, data); }; const readDir = function (loc, filter) { const files = {}; if (fs.existsSync(loc)) { readdir(loc, filter).forEach(function (filename) { files[filename] = helper.readFile(path.join(loc, filename)); }); } return files; }; const saveInFiles = function (files) { // Place an empty .babelrc in each test so tests won't unexpectedly get to repo-level config. outputFileSync(".babelrc", "{}"); Object.keys(files).forEach(function (filename) { const content = files[filename]; outputFileSync(filename, content); }); }; const assertTest = function (stdout, stderr, opts) { const expectStderr = opts.stderr.trim(); stderr = stderr.trim(); if (opts.stderr) { if (opts.stderrContains) { expect(includes(stderr, expectStderr)).toBeTruthy(); } else { expect(stderr).toBe(expectStderr); } } else if (stderr) { throw new Error("stderr:\n" + stderr + "\n\nstdout:\n" + stdout); } const expectStdout = opts.stdout.trim(); stdout = stdout.trim(); stdout = stdout.replace(/\\/g, "/"); if (opts.stdout) { if (opts.stdoutContains) { expect(includes(stdout, expectStdout)).toBeTruthy(); } else { expect(stdout).toBe(expectStdout); } } else if (stdout) { throw new Error("stdout:\n" + stdout); } if (opts.outFiles) { const actualFiles = readDir(path.join(tmpLoc)); Object.keys(actualFiles).forEach(function (filename) { if (!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)) { const expected = opts.outFiles[filename]; const actual = actualFiles[filename]; expect(expected).not.toBeUndefined(); if (expected) { expect(actual).toBe(expected); } } }); Object.keys(opts.outFiles).forEach(function (filename) { expect(actualFiles).toHaveProperty(filename); }); } }; const buildTest = function (binName, testName, opts) { const binLoc = path.join(__dirname, "../lib", binName); return function (callback) { saveInFiles(opts.inFiles); let args = [binLoc]; args.push("--config-file", "../config.json"); args = args.concat(opts.args); const spawn = child.spawn(process.execPath, args); let stderr = ""; let stdout = ""; spawn.stderr.on("data", function (chunk) { stderr += chunk; }); spawn.stdout.on("data", function (chunk) { stdout += chunk; }); spawn.on("close", function () { let err; try { assertTest(stdout, stderr, opts); } catch (e) { err = e; } if (err) { err.message = args.map(arg => `"${arg}"`).join(" ") + ": " + err.message; } callback(err); }); if (opts.stdin) { spawn.stdin.write(opts.stdin); spawn.stdin.end(); } }; }; fs.readdirSync(fixtureLoc).forEach(function (binName) { if (binName[0] === ".") return; 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[0] === ".") return; const testLoc = path.join(suiteLoc, testName); const opts = { args: [], }; const optionsLoc = path.join(testLoc, "options.json"); if (fs.existsSync(optionsLoc)) merge(opts, require(optionsLoc)); ["stdout", "stdin", "stderr"].forEach(function (key) { const loc = path.join(testLoc, key + ".txt"); if (fs.existsSync(loc)) { opts[key] = helper.readFile(loc); } else { opts[key] = opts[key] || ""; } }); opts.outFiles = readDir(path.join(testLoc, "out-files"), fileFilter); opts.inFiles = readDir(path.join(testLoc, "in-files"), fileFilter); const babelrcLoc = path.join(testLoc, ".babelrc"); if (fs.existsSync(babelrcLoc)) { // copy .babelrc file to tmp directory opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); } it(testName, buildTest(binName, testName, opts), 20000); }); }); }); babel-7.12.12/packages/babel-parser/000077500000000000000000000000001377064615700170665ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/AUTHORS000066400000000000000000000011121377064615700201310ustar00rootroot00000000000000List of Acorn contributors. Updated before every release. Adrian Rakovsky Alistair Braidwood Andres Suarez Aparajita Fishman Arian Stolwijk Artem Govorov Brandon Mills Charles Hughes Conrad Irwin David Bonnet Forbes Lindesay Gilad Peleg impinball Ingvar Stepanyan Jesse McCarthy Jiaxing Wang Joel Kemp Johannes Herr Jürg Lehni keeyipchan Kevin Kwok krator Marijn Haverbeke Martin Carlberg Mathias Bynens Mathieu 'p01' Henri Max Schaefer Max Zerzouri Mihai Bazon Mike Rennie Nick Fitzgerald Oskar Schöldström Paul Harper Peter Rust PlNG r-e-d Rich Harris Sebastian McKenzie zsjforcn babel-7.12.12/packages/babel-parser/CHANGELOG.md000066400000000000000000001125361377064615700207070ustar00rootroot00000000000000# Changelog > **Tags:** > - :boom: [Breaking Change] > - :eyeglasses: [Spec Compliance] > - :rocket: [New Feature] > - :bug: [Bug Fix] > - :memo: [Documentation] > - :house: [Internal] > - :nail_care: [Polish] > Semver Policy: https://github.com/babel/babel/tree/main/packages/babel-parser#semver _Note: Gaps between patch versions are faulty, broken or test releases._ See the [Babel Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) for the pre-6.8.0 version Changelog. ## 6.17.1 (2017-05-10) ### :bug: Bug Fix * Fix typo in flow spread operator error (Brian Ng) * Fixed invalid number literal parsing ([#473](https://github.com/babel/babylon/pull/473)) (Alex Kuzmenko) * Fix number parser ([#433](https://github.com/babel/babylon/pull/433)) (Alex Kuzmenko) * Ensure non pattern shorthand props are checked for reserved words ([#479](https://github.com/babel/babylon/pull/479)) (Brian Ng) * Remove jsx context when parsing arrow functions ([#475](https://github.com/babel/babylon/pull/475)) (Brian Ng) * Allow super in class properties ([#499](https://github.com/babel/babylon/pull/499)) (Brian Ng) * Allow flow class field to be named constructor ([#510](https://github.com/babel/babylon/pull/510)) (Brian Ng) ## 6.17.0 (2017-04-20) ### :bug: Bug Fix * Cherry-pick #418 to 6.x ([#476](https://github.com/babel/babylon/pull/476)) (Sebastian McKenzie) * Add support for invalid escapes in tagged templates ([#274](https://github.com/babel/babylon/pull/274)) (Kevin Gibbons) * Throw error if new.target is used outside of a function ([#402](https://github.com/babel/babylon/pull/402)) (Brian Ng) * Fix parsing of class properties ([#351](https://github.com/babel/babylon/pull/351)) (Kevin Gibbons) * Fix parsing yield with dynamicImport ([#383](https://github.com/babel/babylon/pull/383)) (Brian Ng) * Ensure consistent start args for parseParenItem ([#386](https://github.com/babel/babylon/pull/386)) (Brian Ng) ## 7.0.0-beta.8 (2017-04-04) ### New Feature * Add support for flow type spread (#418) (Conrad Buck) * Allow statics in flow interfaces (#427) (Brian Ng) ### Bug Fix * Fix predicate attachment to match flow parser (#428) (Brian Ng) * Add extra.raw back to JSXText and JSXAttribute (#344) (Alex Rattray) * Fix rest parameters with array and objects (#424) (Brian Ng) * Fix number parser (#433) (Alex Kuzmenko) ### Docs * Fix CONTRIBUTING.md [skip ci] (#432) (Alex Kuzmenko) ### Internal * Use babel-register script when running babel smoke tests (#442) (Brian Ng) ## 7.0.0-beta.7 (2017-03-22) ### Spec Compliance * Remove babylon plugin for template revision since it's stage-4 (#426) (Henry Zhu) ### Bug Fix * Fix push-pop logic in flow (#405) (Daniel Tschinder) ## 7.0.0-beta.6 (2017-03-21) ### New Feature * Add support for invalid escapes in tagged templates (#274) (Kevin Gibbons) ### Polish * Improves error message when super is called outside of constructor (#408) (Arshabh Kumar Agarwal) ### Docs * [7.0] Moved value field in spec from ObjectMember to ObjectProperty as ObjectMethod's don't have it (#415) [skip ci] (James Browning) ## 7.0.0-beta.5 (2017-03-21) ### Bug Fix * Throw error if new.target is used outside of a function (#402) (Brian Ng) * Fix parsing of class properties (#351) (Kevin Gibbons) ### Other * Test runner: Detect extra property in 'actual' but not in 'expected'. (#407) (Andy) * Optimize travis builds (#419) (Daniel Tschinder) * Update codecov to 2.0 (#412) (Daniel Tschinder) * Fix spec for ClassMethod: It doesn't have a function, it *is* a function. (#406) [skip ci] (Andy) * Changed Non-existent RestPattern to RestElement which is what is actually parsed (#409) [skip ci] (James Browning) * Upgrade flow to 0.41 (Daniel Tschinder) * Fix watch command (#403) (Brian Ng) * Update yarn lock (Daniel Tschinder) * Fix watch command (#403) (Brian Ng) * chore(package): update flow-bin to version 0.41.0 (#395) (greenkeeper[bot]) * Add estree test for correct order of directives (Daniel Tschinder) * Add DoExpression to spec (#364) (Alex Kuzmenko) * Mention cloning of repository in CONTRIBUTING.md (#391) [skip ci] (Sumedh Nimkarde) * Explain how to run only one test (#389) [skip ci] (Aaron Ang) ## 7.0.0-beta.4 (2017-03-01) * Don't consume async when checking for async func decl (#377) (Brian Ng) * add `ranges` option [skip ci] (Henry Zhu) * Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) (Andrew Levine) ## 7.0.0-beta.3 (2017-02-28) - [7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement (#384) - Merge changes from 6.x ## 7.0.0-beta.2 (2017-02-20) - estree: correctly change literals in all cases (#368) (Daniel Tschinder) ## 7.0.0-beta.1 (2017-02-20) - Fix negative number literal typeannotations (#366) (Daniel Tschinder) - Update contributing with more test info [skip ci] (#355) (Brian Ng) ## 7.0.0-beta.0 (2017-02-15) - Reintroduce Variance node (#333) (Daniel Tschinder) - Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#332) (Charles Pick) - [7.0] Remove ForAwaitStatement, add await flag to ForOfStatement (#349) (Brandon Dail) - chore(package): update ava to version 0.18.0 (#345) (greenkeeper[bot]) - chore(package): update babel-plugin-istanbul to version 4.0.0 (#350) (greenkeeper[bot]) - Change location of ObjectTypeIndexer to match flow (#228) (Daniel Tschinder) - Rename flow AST Type ExistentialTypeParam to ExistsTypeAnnotation (#322) (Toru Kobayashi) - Revert "Temporary rollback for erroring on trailing comma with spread (#154)" (#290) (Daniel Tschinder) - Remove classConstructorCall plugin (#291) (Brian Ng) - Update yarn.lock (Daniel Tschinder) - Update cross-env to 3.x (Daniel Tschinder) - [7.0] Remove node 0.10, 0.12 and 5 from Travis (#284) (Sergey Rubanov) - Remove `String.fromCodePoint` shim (#279) (Mathias Bynens) ## 6.16.1 (2017-02-23) ### :bug: Regression - Revert "Fix export default async function to be FunctionDeclaration" ([#375](https://github.com/babel/babylon/pull/375)) Need to modify Babel for this AST node change, so moving to 7.0. - Revert "Don't parse class properties without initializers when classProperties plugin is disabled, and Flow is enabled" ([#376](https://github.com/babel/babylon/pull/376)) [react-native](https://github.com/facebook/react-native/issues/12542) broke with this so we reverted. ## 6.16.0 (2017-02-23) ### :rocket: New Feature ***ESTree*** compatibility as plugin ([#277](https://github.com/babel/babylon/pull/277)) (Daniel Tschinder) We finally introduce a new compatibility layer for ESTree. To put babylon into ESTree-compatible mode the new plugin `estree` can be enabled. In this mode the parser will output an AST that is compliant to the specs of [ESTree](https://github.com/estree/estree/) We highly recommend everyone who uses babylon outside of babel to use this plugin. This will make it much easier for users to switch between different ESTree-compatible parsers. We so far tested several projects with different parsers and exchanged their parser to babylon and in nearly all cases it worked out of the box. Some other estree-compatible parsers include `acorn`, `esprima`, `espree`, `flow-parser`, etc. To enable `estree` mode simply add the plugin in the config: ```json { "plugins": [ "estree" ] } ``` If you want to migrate your project from non-ESTree mode to ESTree, have a look at our [Readme](https://github.com/babel/babylon/#output), where all deviations are mentioned. Add a parseExpression public method ([#213](https://github.com/babel/babylon/pull/213)) (jeromew) Babylon exports a new function to parse a single expression ```js import { parseExpression } from 'babylon'; const ast = parseExpression('x || y && z', options); ``` The returned AST will only consist of the expression. The options are the same as for `parse()` Add startLine option ([#346](https://github.com/babel/babylon/pull/346)) (Raphael Mu) A new option was added to babylon allowing to change the initial linenumber for the first line which is usually `1`. Changing this for example to `100` will make line `1` of the input source to be marked as line `100`, line `2` as `101`, line `3` as `102`, ... Function predicate declaration ([#103](https://github.com/babel/babylon/pull/103)) (Panagiotis Vekris) Added support for function predicates which flow introduced in version 0.33.0 ```js declare function is_number(x: mixed): boolean %checks(typeof x === "number"); ``` Allow imports in declare module ([#315](https://github.com/babel/babylon/pull/315)) (Daniel Tschinder) Added support for imports within module declarations which flow introduced in version 0.37.0 ```js declare module "C" { import type { DT } from "D"; declare export type CT = { D: DT }; } ``` ### :eyeglasses: Spec Compliance Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons) This example now correctly throws an error when there is a semicolon after the decorator: ```js class A { @a; foo(){} } ``` Keywords are not allowed as local specifier ([#307](https://github.com/babel/babylon/pull/307)) (Daniel Tschinder) Using keywords in imports is not allowed anymore: ```js import { default } from "foo"; import { a as debugger } from "foo"; ``` Do not allow overwritting of primitive types ([#314](https://github.com/babel/babylon/pull/314)) (Daniel Tschinder) In flow it is now forbidden to overwrite the primitive types `"any"`, `"mixed"`, `"empty"`, `"bool"`, `"boolean"`, `"number"`, `"string"`, `"void"` and `"null"` with your own type declaration. Disallow import type { type a } from … ([#305](https://github.com/babel/babylon/pull/305)) (Daniel Tschinder) The following code now correctly throws an error ```js import type { type a } from "foo"; ``` Don't parse class properties without initializers when classProperties is disabled and Flow is enabled ([#300](https://github.com/babel/babylon/pull/300)) (Andrew Levine) Ensure that you enable the `classProperties` plugin in order to enable correct parsing of class properties. Prior to this version it was possible to parse them by enabling the `flow` plugin but this was not intended the behaviour. If you enable the flow plugin you can only define the type of the class properties, but not initialize them. Fix export default async function to be FunctionDeclaration ([#324](https://github.com/babel/babylon/pull/324)) (Daniel Tschinder) Parsing the following code now returns a `FunctionDeclaration` AST node instead of `FunctionExpression`. ```js export default async function bar() {}; ``` ### :nail_care: Polish Improve error message on attempt to destructure named import ([#288](https://github.com/babel/babylon/pull/288)) (Brian Ng) ### :bug: Bug Fix Fix negative number literal typeannotations ([#366](https://github.com/babel/babylon/pull/366)) (Daniel Tschinder) Ensure takeDecorators is called on exported class ([#358](https://github.com/babel/babylon/pull/358)) (Brian Ng) ESTree: correctly change literals in all cases ([#368](https://github.com/babel/babylon/pull/368)) (Daniel Tschinder) Correctly convert RestProperty to Assignable ([#339](https://github.com/babel/babylon/pull/339)) (Daniel Tschinder) Fix #321 by allowing question marks in type params ([#338](https://github.com/babel/babylon/pull/338)) (Daniel Tschinder) Fix #336 by correctly setting arrow-param ([#337](https://github.com/babel/babylon/pull/337)) (Daniel Tschinder) Fix parse error when destructuring `set` with default value ([#317](https://github.com/babel/babylon/pull/317)) (Brian Ng) Fix ObjectTypeCallProperty static ([#298](https://github.com/babel/babylon/pull/298)) (Dan Harper) ### :house: Internal Fix generator-method-with-computed-name spec ([#360](https://github.com/babel/babylon/pull/360)) (Alex Rattray) Fix flow type-parameter-declaration test with unintended semantic ([#361](https://github.com/babel/babylon/pull/361)) (Alex Rattray) Cleanup and splitup parser functions ([#295](https://github.com/babel/babylon/pull/295)) (Daniel Tschinder) chore(package): update flow-bin to version 0.38.0 ([#313](https://github.com/babel/babylon/pull/313)) (greenkeeper[bot]) Call inner function instead of 1:1 copy to plugin ([#294](https://github.com/babel/babylon/pull/294)) (Daniel Tschinder) Update eslint-config-babel to the latest version 🚀 ([#299](https://github.com/babel/babylon/pull/299)) (greenkeeper[bot]) Update eslint-config-babel to the latest version 🚀 ([#293](https://github.com/babel/babylon/pull/293)) (greenkeeper[bot]) devDeps: remove eslint-plugin-babel ([#292](https://github.com/babel/babylon/pull/292)) (Kai Cataldo) Correct indent eslint rule config ([#276](https://github.com/babel/babylon/pull/276)) (Daniel Tschinder) Fail tests that have expected.json and throws-option ([#285](https://github.com/babel/babylon/pull/285)) (Daniel Tschinder) ### :memo: Documentation Update contributing with more test info [skip ci] ([#355](https://github.com/babel/babylon/pull/355)) (Brian Ng) Update API documentation ([#330](https://github.com/babel/babylon/pull/330)) (Timothy Gu) Added keywords to package.json ([#323](https://github.com/babel/babylon/pull/323)) (Dmytro) AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon/pull/318)) (Mathias Bynens) ## 6.15.0 (2017-01-10) ### :eyeglasses: Spec Compliance Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison) This change implements flows new shorthand import syntax and where previously you had to write this code: ```js import {someValue} from "blah"; import type {someType} from "blah"; import typeof {someOtherValue} from "blah"; ``` you can now write it like this: ```js import { someValue, type someType, typeof someOtherValue, } from "blah"; ``` For more information look at [this](https://github.com/facebook/flow/pull/2890) pull request. flow: allow leading pipes in all positions ([#256](https://github.com/babel/babylon/pull/256)) (Vladimir Kurchatkin) This change now allows a leading pipe everywhere types can be used: ```js var f = (x): | 1 | 2 => 1; ``` Throw error when exporting non-declaration ([#241](https://github.com/babel/babylon/pull/241)) (Kai Cataldo) Previously babylon parsed the following exports, although they are not valid: ```js export typeof foo; export new Foo(); export function() {}; export for (;;); export while(foo); ``` ### :bug: Bug Fix Don't set inType flag when parsing property names ([#266](https://github.com/babel/babylon/pull/266)) (Vladimir Kurchatkin) This fixes parsing of this case: ```js const map = { [age <= 17] : 'Too young' }; ``` Fix source location for JSXEmptyExpression nodes (fixes #248) ([#249](https://github.com/babel/babylon/pull/249)) (James Long) The following case produced an invalid AST ```js
{/* foo */}
``` Use fromCodePoint to convert high value unicode entities ([#243](https://github.com/babel/babylon/pull/243)) (Ryan Duffy) When high value unicode entities (e.g. 💩) were used in the input source code they are now correctly encoded in the resulting AST. Rename folder to avoid Windows-illegal characters ([#281](https://github.com/babel/babylon/pull/281)) (Ryan Plant) Allow this.state.clone() when parsing decorators ([#262](https://github.com/babel/babylon/pull/262)) (Alex Rattray) ### :house: Internal User external-helpers ([#254](https://github.com/babel/babylon/pull/254)) (Daniel Tschinder) Add watch script for dev ([#234](https://github.com/babel/babylon/pull/234)) (Kai Cataldo) Freeze current plugins list for "*" option, and remove from README.md ([#245](https://github.com/babel/babylon/pull/245)) (Andrew Levine) Prepare tests for multiple fixture runners. ([#240](https://github.com/babel/babylon/pull/240)) (Daniel Tschinder) Add some test coverage for decorators stage-0 plugin ([#250](https://github.com/babel/babylon/pull/250)) (Andrew Levine) Refactor tokenizer types file ([#263](https://github.com/babel/babylon/pull/263)) (Sven SAULEAU) Update eslint-config-babel to the latest version 🚀 ([#273](https://github.com/babel/babylon/pull/273)) (greenkeeper[bot]) chore(package): update rollup to version 0.41.0 ([#272](https://github.com/babel/babylon/pull/272)) (greenkeeper[bot]) chore(package): update flow-bin to version 0.37.0 ([#255](https://github.com/babel/babylon/pull/255)) (greenkeeper[bot]) ## 6.14.1 (2016-11-17) ### :bug: Bug Fix Allow `"plugins": ["*"]` ([#229](https://github.com/babel/babylon/pull/229)) (Daniel Tschinder) ```js { "plugins": ["*"] } ``` Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer. ## 6.14.0 (2016-11-16) ### :eyeglasses: Spec Compliance Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo) [11.6.2.2 Future Reserved Words](http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words) Babylon will throw for more reserved words such as `enum` or `await` (in strict mode). ``` class enum {} // throws class await {} // throws in strict mode (module) ``` Optional names for function types and object type indexers ([#197](https://github.com/babel/babylon/pull/197)) (Gabe Levi) So where you used to have to write ```js type A = (x: string, y: boolean) => number; type B = (z: string) => number; type C = { [key: string]: number }; ``` you can now write (with flow 0.34.0) ```js type A = (string, boolean) => number; type B = string => number; type C = { [string]: number }; ``` Parse flow nested array type annotations like `number[][]` ([#219](https://github.com/babel/babylon/pull/219)) (Bernhard Häussner) Supports these form now of specifying array types: ```js var a: number[][][][]; var b: string[][]; ``` ### :bug: Bug Fix Correctly eat semicolon at the end of `DelcareModuleExports` ([#223](https://github.com/babel/babylon/pull/223)) (Daniel Tschinder) ``` declare module "foo" { declare module.exports: number } declare module "foo" { declare module.exports: number; } // also allowed now ``` ### :house: Internal * Count Babel tests towards Babylon code coverage ([#182](https://github.com/babel/babylon/pull/182)) (Moti Zilberman) * Fix strange line endings ([#214](https://github.com/babel/babylon/pull/214)) (Thomas Grainger) * Add node 7 (Daniel Tschinder) * chore(package): update flow-bin to version 0.34.0 ([#204](https://github.com/babel/babylon/pull/204)) (Greenkeeper) ## v6.13.1 (2016-10-26) ### :nail_care: Polish - Use rollup for bundling to speed up startup time ([#190](https://github.com/babel/babylon/pull/190)) ([@drewml](https://github.com/DrewML)) ```js const babylon = require('babylon'); const ast = babylon.parse('var foo = "lol";'); ``` With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph. **Without bundling** ![image](https://cloud.githubusercontent.com/assets/5233399/19420264/3133497e-93ad-11e6-9a6a-2da59c4f5c13.png) **With bundling** ![image](https://cloud.githubusercontent.com/assets/5233399/19420267/388f556e-93ad-11e6-813e-7c5c396be322.png) - add clean command [skip ci] ([#201](https://github.com/babel/babylon/pull/201)) (Henry Zhu) - add ForAwaitStatement (async generator already added) [skip ci] ([#196](https://github.com/babel/babylon/pull/196)) (Henry Zhu) ## v6.13.0 (2016-10-21) ### :eyeglasses: Spec Compliance Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman) > See https://flowtype.org/docs/variance.html for more information ```js type T = { +p: T }; interface T { -p: T }; declare class T { +[k:K]: V }; class T { -[k:K]: V }; class C2 { +p: T = e }; ``` Raise error on duplicate definition of __proto__ ([#183](https://github.com/babel/babylon/pull/183)) (Moti Zilberman) ```js ({ __proto__: 1, __proto__: 2 }) // Throws an error now ``` ### :bug: Bug Fix Flow: Allow class properties to be named `static` ([#184](https://github.com/babel/babylon/pull/184)) (Moti Zilberman) ```js declare class A { static: T; } ``` Allow "async" as identifier for object literal property shorthand ([#187](https://github.com/babel/babylon/pull/187)) (Andrew Levine) ```js var foo = { async, bar }; ``` ### :nail_care: Polish Fix flowtype and add inType to state ([#189](https://github.com/babel/babylon/pull/189)) (Daniel Tschinder) > This improves the performance slightly (because of hidden classes) ### :house: Internal Fix .gitattributes line ending setting ([#191](https://github.com/babel/babylon/pull/191)) (Moti Zilberman) Increase test coverage ([#175](https://github.com/babel/babylon/pull/175) (Moti Zilberman) Readd missin .eslinignore for IDEs (Daniel Tschinder) Error on missing expected.json fixture in CI ([#188](https://github.com/babel/babylon/pull/188)) (Moti Zilberman) Add .gitattributes and .editorconfig for LF line endings ([#179](https://github.com/babel/babylon/pull/179)) (Moti Zilberman) Fixes two tests that are failing after the merge of #172 ([#177](https://github.com/babel/babylon/pull/177)) (Moti Zilberman) ## v6.12.0 (2016-10-14) ### :eyeglasses: Spec Compliance Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler) #### Dynamic Import - Proposal Repo: https://github.com/domenic/proposal-dynamic-import - Championed by [@domenic](https://github.com/domenic) - stage-2 - [sept-28 tc39 notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#113a-import) > This repository contains a proposal for adding a "function-like" import() module loading syntactic form to JavaScript ```js import(`./section-modules/${link.dataset.entryModule}.js`) .then(module => { module.loadPageInto(main); }) ``` Add EmptyTypeAnnotation ([#171](https://github.com/babel/babylon/pull/171)) (Sam Goldman) #### EmptyTypeAnnotation Just wasn't covered before. ```js type T = empty; ``` ### :bug: Bug Fix Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) ```js // was failing due to sparse array export const { foo: [ ,, qux7 ] } = bar; ``` Allow keyword in Flow object declaration property names with type parameters ([#146](https://github.com/babel/babylon/pull/146)) (Dan Harper) ```js declare class X { foobar(): void; static foobar(): void; } ``` Allow keyword in object/class property names with Flow type parameters ([#145](https://github.com/babel/babylon/pull/145)) (Dan Harper) ```js class Foo { delete(item: T): T { return item; } } ``` Allow typeAnnotations for yield expressions ([#174](https://github.com/babel/babylon/pull/174))) (Daniel Tschinder) ```js function *foo() { const x = (yield 5: any); } ``` ### :nail_care: Polish Annotate more errors with expected token ([#172](https://github.com/babel/babylon/pull/172))) (Moti Zilberman) ```js // Unexpected token, expected ; (1:6) { set 1 } ``` ### :house: Internal Remove kcheck ([#173](https://github.com/babel/babylon/pull/173))) (Daniel Tschinder) Also run flow, linting, babel tests on separate instances (add back node 0.10) ## v6.11.6 (2016-10-12) ### :bug: Bug Fix/Regression Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) ```js // was failing with `Cannot read property 'type' of null` because of null identifiers export const { foo: [ ,, qux7 ] } = bar; ``` ## v6.11.5 (2016-10-12) ### :eyeglasses: Spec Compliance Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo) ```js // `foo` has already been exported. Exported identifiers must be unique. (2:20) export function foo() {}; export const { a: [{foo}] } = bar; ``` Fix: Check for duplicate named exports in exported rest elements/properties ([#164](https://github.com/babel/babylon/pull/164)) (Kai Cataldo) ```js // `foo` has already been exported. Exported identifiers must be unique. (2:22) export const foo = 1; export const [bar, ...foo] = baz; ``` ### :bug: Bug Fix Fix: Allow identifier `async` for default param in arrow expression ([#165](https://github.com/babel/babylon/pull/165)) (Kai Cataldo) ```js // this is ok now const test = ({async = true}) => {}; ``` ### :nail_care: Polish Babylon will now print out the token it's expecting if there's a `SyntaxError` ([#150](https://github.com/babel/babylon/pull/150)) (Daniel Tschinder) ```bash # So in the case of a missing ending curly (`}`) Module build failed: SyntaxError: Unexpected token, expected } (30:0) 28 | } 29 | > 30 | | ^ ``` ## v6.11.4 (2016-10-03) Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu) ## v6.11.3 (2016-10-01) ### :eyeglasses: Spec Compliance Add static errors for object rest (#149) ([@danez](https://github.com/danez)) > https://github.com/sebmarkbage/ecmascript-rest-spread Object rest copies the *rest* of properties from the right hand side `obj` starting from the left to right. ```js let { x, y, ...z } = { x: 1, y: 2, z: 3 }; // x = 1 // y = 2 // z = { z: 3 } ``` #### New Syntax Errors: **SyntaxError**: The rest element has to be the last element when destructuring (1:10) ```bash > 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3}; | ^ # Previous behavior: # x = { x: 1, y: 2, z: 3 } # y = 2 # z = 3 ``` Before, this was just a more verbose way of shallow copying `obj` since it doesn't actually do what you think. **SyntaxError**: Cannot have multiple rest elements when destructuring (1:13) ```bash > 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3}; | ^ # Previous behavior: # x = 1 # y = { y: 2, z: 3 } # z = { y: 2, z: 3 } ``` Before y and z would just be the same value anyway so there is no reason to need to have both. **SyntaxError**: A trailing comma is not permitted after the rest element (1:16) ```js let { x, y, ...z, } = obj; ``` The rationale for this is that the use case for trailing comma is that you can add something at the end without affecting the line above. Since a RestProperty always has to be the last property it doesn't make sense. --- get / set are valid property names in default assignment (#142) ([@jezell](https://github.com/jezell)) ```js // valid function something({ set = null, get = null }) {} ``` ## v6.11.2 (2016-09-23) ### Bug Fix - [#139](https://github.com/babel/babylon/issues/139) Don't do the duplicate check if not an identifier (#140) @hzoo ```js // regression with duplicate export check SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13) 20 | 21 | export const { rhythm } = typography; > 22 | export const { TypographyStyle } = typography ``` Bail out for now, and make a change to account for destructuring in the next release. ## 6.11.1 (2016-09-22) ### Bug Fix - [#137](https://github.com/babel/babylon/pull/137) - Fix a regression with duplicate exports - it was erroring on all keys in `Object.prototype`. @danez ```javascript export toString from './toString'; ``` ```bash `toString` has already been exported. Exported identifiers must be unique. (1:7) > 1 | export toString from './toString'; | ^ 2 | ``` ## 6.11.0 (2016-09-22) ### Spec Compliance (will break CI) - Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo ```js // Only one default export allowed per module. (2:9) export default function() {}; export { foo as default }; // Only one default export allowed per module. (2:0) export default {}; export default function() {}; // `Foo` has already been exported. Exported identifiers must be unique. (2:0) export { Foo }; export class Foo {}; ``` ### New Feature (Syntax) - Add support for computed class property names ([#121](https://github.com/babel/babylon/pull/121)) @motiz88 ```js // AST interface ClassProperty <: Node { type: "ClassProperty"; key: Identifier; value: Expression; computed: boolean; // added } ``` ```js // with "plugins": ["classProperties"] class Foo { [x] ['y'] } class Bar { [p] [m] () {} } ``` ### Bug Fix - Fix `static` property falling through in the declare class Flow AST ([#135](https://github.com/babel/babylon/pull/135)) @danharper ```js declare class X { a: number; static b: number; // static c: number; // this was being marked as static in the AST as well } ``` ### Polish - Rephrase "assigning/binding to rvalue" errors to include context ([#119](https://github.com/babel/babylon/pull/119)) @motiz88 ```js // Used to error with: // SyntaxError: Assigning to rvalue (1:0) // Now: // Invalid left-hand side in assignment expression (1:0) 3 = 4 // Invalid left-hand side in for-in statement (1:5) for (+i in {}); ``` ### Internal - Fix call to `this.parseMaybeAssign` with correct arguments ([#133](https://github.com/babel/babylon/pull/133)) @danez - Add semver note to changelog ([#131](https://github.com/babel/babylon/pull/131)) @hzoo ## 6.10.0 (2016-09-19) > We plan to include some spec compliance bugs in patch versions. An example was the multiple default exports issue. ### Spec Compliance * Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu) > It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. https://tc39.github.io/ecma262/2016/#sec-function-definitions-static-semantics-early-errors More Context: [tc39-notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-07/july-29.md#611-the-scope-of-use-strict-with-respect-to-destructuring-in-parameter-lists) For example: ```js // this errors because it uses destructuring and default parameters // in a function with a "use strict" directive function a([ option1, option2 ] = []) { "use strict"; } ``` The solution would be to use a top level "use strict" or to remove the destructuring or default parameters when using a function + "use strict" or to. ### New Feature * Exact object type annotations for Flow plugin ([#104](https://github.com/babel/babylon/pull/104)) (Basil Hosmer) Added to flow in https://github.com/facebook/flow/commit/c710c40aa2a115435098d6c0dfeaadb023cd39b8 Looks like: ```js var a : {| x: number, y: string |} = { x: 0, y: 'foo' }; ``` ### Bug Fixes * Include `typeParameter` location in `ArrowFunctionExpression` ([#126](https://github.com/babel/babylon/pull/126)) (Daniel Tschinder) * Error on invalid flow type annotation with default assignment ([#122](https://github.com/babel/babylon/pull/122)) (Dan Harper) * Fix Flow return types on arrow functions ([#124](https://github.com/babel/babylon/pull/124)) (Dan Harper) ### Misc * Add tests for export extensions ([#127](https://github.com/babel/babylon/pull/127)) (Daniel Tschinder) * Fix Contributing guidelines [skip ci] (Daniel Tschinder) ## 6.9.2 (2016-09-09) The only change is to remove the `babel-runtime` dependency by compiling with Babel's ES2015 loose mode. So using babylon standalone should be smaller. ## 6.9.1 (2016-08-23) This release contains mainly small bugfixes but also updates babylons default mode to es2017. The features for `exponentiationOperator`, `asyncFunctions` and `trailingFunctionCommas` which previously needed to be activated via plugin are now enabled by default and the plugins are now no-ops. ### Bug Fixes - Fix issues with default object params in async functions ([#96](https://github.com/babel/babylon/pull/96)) @danez - Fix issues with flow-types and async function ([#95](https://github.com/babel/babylon/pull/95)) @danez - Fix arrow functions with destructuring, types & default value ([#94](https://github.com/babel/babylon/pull/94)) @danharper - Fix declare class with qualified type identifier ([#97](https://github.com/babel/babylon/pull/97)) @danez - Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas plugins and enable them by default ([#98](https://github.com/babel/babylon/pull/98)) @danez ## 6.9.0 (2016-08-16) ### New syntax support - Add JSX spread children ([#42](https://github.com/babel/babylon/pull/42)) @calebmer (Be aware that React is not going to support this syntax) ```js
{...todos.map(todo => )}
``` - Add support for declare module.exports ([#72](https://github.com/babel/babylon/pull/72)) @danez ```js declare module "foo" { declare module.exports: {} } ``` ### New Features - If supplied, attach filename property to comment node loc. ([#80](https://github.com/babel/babylon/pull/80)) @divmain - Add identifier name to node loc field ([#90](https://github.com/babel/babylon/pull/90)) @kittens ### Bug Fixes - Fix exponential operator to behave according to spec ([#75](https://github.com/babel/babylon/pull/75)) @danez - Fix lookahead to not add comments to arrays which are not cloned ([#76](https://github.com/babel/babylon/pull/76)) @danez - Fix accidental fall-through in Flow type parsing. ([#82](https://github.com/babel/babylon/pull/82)) @xiemaisi - Only allow declares inside declare module ([#73](https://github.com/babel/babylon/pull/73)) @danez - Small fix for parsing type parameter declarations ([#83](https://github.com/babel/babylon/pull/83)) @gabelevi - Fix arrow param locations with flow types ([#57](https://github.com/babel/babylon/pull/57)) @danez - Fixes SyntaxError position with flow optional type ([#65](https://github.com/babel/babylon/pull/65)) @danez ### Internal - Add codecoverage to tests @danez - Fix tests to not save expected output if we expect the test to fail @danez - Make a shallow clone of babel for testing @danez - chore(package): update cross-env to version 2.0.0 ([#77](https://github.com/babel/babylon/pull/77)) @greenkeeperio-bot - chore(package): update ava to version 0.16.0 ([#86](https://github.com/babel/babylon/pull/86)) @greenkeeperio-bot - chore(package): update babel-plugin-istanbul to version 2.0.0 ([#89](https://github.com/babel/babylon/pull/89)) @greenkeeperio-bot - chore(package): update nyc to version 8.0.0 ([#88](https://github.com/babel/babylon/pull/88)) @greenkeeperio-bot ## 6.8.4 (2016-07-06) ### Bug Fixes - Fix the location of params, when flow and default value used ([#68](https://github.com/babel/babylon/pull/68)) @danez ## 6.8.3 (2016-07-02) ### Bug Fixes - Fix performance regression introduced in 6.8.2 with conditionals ([#63](https://github.com/babel/babylon/pull/63)) @danez ## 6.8.2 (2016-06-24) ### Bug Fixes - Fix parse error with yielding jsx elements in generators `function* it() { yield
; }` ([#31](https://github.com/babel/babylon/pull/31)) @eldereal - When cloning nodes do not clone its comments ([#24](https://github.com/babel/babylon/pull/24)) @danez - Fix parse errors when using arrow functions with an spread element and return type `(...props): void => {}` ([#10](https://github.com/babel/babylon/pull/10)) @danez - Fix leading comments added from previous node ([#23](https://github.com/babel/babylon/pull/23)) @danez - Fix parse errors with flow's optional arguments `(arg?) => {}` ([#19](https://github.com/babel/babylon/pull/19)) @danez - Support negative numeric type literals @kittens - Remove line terminator restriction after await keyword @kittens - Remove grouped type arrow restriction as it seems flow no longer has it @kittens - Fix parse error with generic methods that have the name `get` or `set` `class foo { get() {} }` ([#55](https://github.com/babel/babylon/pull/55)) @vkurchatkin - Fix parse error with arrow functions that have flow type parameter declarations `(x: T): T => x;` ([#54](https://github.com/babel/babylon/pull/54)) @gabelevi ### Documentation - Document AST differences from ESTree ([#41](https://github.com/babel/babylon/pull/41)) @nene - Move ast spec from babel/babel ([#46](https://github.com/babel/babylon/pull/46)) @hzoo ### Internal - Enable skipped tests ([#16](https://github.com/babel/babylon/pull/16)) @danez - Add script to test latest version of babylon with babel ([#21](https://github.com/babel/babylon/pull/21)) @danez - Upgrade test runner ava @kittens - Add missing generate-identifier-regex script @kittens - Rename parser context types @kittens - Add node v6 to travis testing @hzoo - Update to Unicode v9 ([#45](https://github.com/babel/babylon/pull/45)) @mathiasbynens ## 6.8.1 (2016-06-06) ### New Feature - Parse type parameter declarations with defaults like `type Foo = T` ### Bug Fixes - Type parameter declarations need 1 or more type parameters. - The existential type `*` is not a valid type parameter. - The existential type `*` is a primary type ### Spec Compliance - The param list for type parameter declarations now consists of `TypeParameter` nodes - New `TypeParameter` AST Node (replaces using the `Identifier` node before) ``` interface TypeParameter <: Node { bound: TypeAnnotation; default: TypeAnnotation; name: string; variance: "plus" | "minus"; } ``` ## 6.8.0 (2016-05-02) #### New Feature ##### Parse Method Parameter Decorators ([#12](https://github.com/babel/babylon/pull/12)) > [Method Parameter Decorators](https://goo.gl/8MmCMG) is now a TC39 [stage 0 proposal](https://github.com/tc39/ecma262/blob/master/stage0.md). Examples: ```js class Foo { constructor(@foo() x, @bar({ a: 123 }) @baz() y) {} } export default function func(@foo() x, @bar({ a: 123 }) @baz() y) {} var obj = { method(@foo() x, @bar({ a: 123 }) @baz() y) {} }; ``` ##### Parse for-await statements (w/ `asyncGenerators` plugin) ([#17](https://github.com/babel/babylon/pull/17)) There is also a new node type, `ForAwaitStatement`. > [Async generators and for-await](https://github.com/tc39/proposal-async-iteration) are now a [stage 2 proposal](https://github.com/tc39/ecma262#current-proposals). Example: ```js async function f() { for await (let x of y); } ``` babel-7.12.12/packages/babel-parser/LICENSE000066400000000000000000000020761377064615700201000ustar00rootroot00000000000000Copyright (C) 2012-2014 by various contributors (see AUTHORS) 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. babel-7.12.12/packages/babel-parser/README.md000066400000000000000000000006531377064615700203510ustar00rootroot00000000000000# @babel/parser > A JavaScript parser See our website [@babel/parser](https://babeljs.io/docs/en/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%20(babylon)%22+is%3Aopen) associated with this package. ## Install Using npm: ```sh npm install --save-dev @babel/parser ``` or using yarn: ```sh yarn add @babel/parser --dev ``` babel-7.12.12/packages/babel-parser/ast/000077500000000000000000000000001377064615700176555ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/ast/flow.md000066400000000000000000000000001377064615700211340ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/ast/jsx.md000066400000000000000000000000001377064615700207710ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/ast/spec.md000066400000000000000000000724531377064615700211440ustar00rootroot00000000000000These are the core @babel/parser (babylon) AST node types. - [Node objects](#node-objects) - [Changes](#changes) - [Identifier](#identifier) - [PrivateName](#privatename) - [Literals](#literals) - [RegExpLiteral](#regexpliteral) - [NullLiteral](#nullliteral) - [StringLiteral](#stringliteral) - [BooleanLiteral](#booleanliteral) - [NumericLiteral](#numericliteral) - [BigIntLiteral](#bigintliteral) - [DecimalLiteral](#decimalliteral) - [Programs](#programs) - [Functions](#functions) - [Statements](#statements) - [ExpressionStatement](#expressionstatement) - [BlockStatement](#blockstatement) - [EmptyStatement](#emptystatement) - [DebuggerStatement](#debuggerstatement) - [WithStatement](#withstatement) - [Control flow](#control-flow) - [ReturnStatement](#returnstatement) - [LabeledStatement](#labeledstatement) - [BreakStatement](#breakstatement) - [ContinueStatement](#continuestatement) - [Choice](#choice) - [IfStatement](#ifstatement) - [SwitchStatement](#switchstatement) - [SwitchCase](#switchcase) - [Exceptions](#exceptions) - [ThrowStatement](#throwstatement) - [TryStatement](#trystatement) - [CatchClause](#catchclause) - [Loops](#loops) - [WhileStatement](#whilestatement) - [DoWhileStatement](#dowhilestatement) - [ForStatement](#forstatement) - [ForInStatement](#forinstatement) - [ForOfStatement](#forofstatement) - [Declarations](#declarations) - [FunctionDeclaration](#functiondeclaration) - [VariableDeclaration](#variabledeclaration) - [VariableDeclarator](#variabledeclarator) - [Misc](#misc) - [Decorator](#decorator) - [Directive](#directive) - [DirectiveLiteral](#directiveliteral) - [InterpreterDirective](#interpreterdirective) - [Expressions](#expressions) - [Super](#super) - [Import](#import) - [ThisExpression](#thisexpression) - [ArrowFunctionExpression](#arrowfunctionexpression) - [YieldExpression](#yieldexpression) - [AwaitExpression](#awaitexpression) - [ArrayExpression](#arrayexpression) - [ObjectExpression](#objectexpression) - [ObjectMember](#objectmember) - [ObjectProperty](#objectproperty) - [ObjectMethod](#objectmethod) - [RecordExpression](#recordexpression) - [TupleExpression](#tupleexpression) - [FunctionExpression](#functionexpression) - [Unary operations](#unary-operations) - [UnaryExpression](#unaryexpression) - [UnaryOperator](#unaryoperator) - [UpdateExpression](#updateexpression) - [UpdateOperator](#updateoperator) - [Binary operations](#binary-operations) - [BinaryExpression](#binaryexpression) - [BinaryOperator](#binaryoperator) - [AssignmentExpression](#assignmentexpression) - [AssignmentOperator](#assignmentoperator) - [LogicalExpression](#logicalexpression) - [LogicalOperator](#logicaloperator) - [SpreadElement](#spreadelement) - [ArgumentPlaceholder](#argumentplaceholder) - [MemberExpression](#memberexpression) - [OptionalMemberExpression](#optionalmemberexpression) - [BindExpression](#bindexpression) - [ConditionalExpression](#conditionalexpression) - [CallExpression](#callexpression) - [OptionalCallExpression](#optionalcallexpression) - [NewExpression](#newexpression) - [SequenceExpression](#sequenceexpression) - [ParenthesizedExpression](#parenthesizedexpression) - [DoExpression](#doexpression) - [Template Literals](#template-literals) - [TemplateLiteral](#templateliteral) - [TaggedTemplateExpression](#taggedtemplateexpression) - [TemplateElement](#templateelement) - [Patterns](#patterns) - [ObjectPattern](#objectpattern) - [ArrayPattern](#arraypattern) - [RestElement](#restelement) - [AssignmentPattern](#assignmentpattern) - [Classes](#classes) - [ClassBody](#classbody) - [ClassMethod](#classmethod) - [ClassPrivateMethod](#classprivatemethod) - [ClassProperty](#classproperty) - [ClassPrivateProperty](#classprivateproperty) - [StaticBlock](#staticblock) - [ClassDeclaration](#classdeclaration) - [ClassExpression](#classexpression) - [MetaProperty](#metaproperty) - [Modules](#modules) - [ModuleDeclaration](#moduledeclaration) - [ModuleSpecifier](#modulespecifier) - [Imports](#imports) - [ImportDeclaration](#importdeclaration) - [ImportSpecifier](#importspecifier) - [ImportDefaultSpecifier](#importdefaultspecifier) - [ImportNamespaceSpecifier](#importnamespacespecifier) - [ImportAttribute](#importattribute) - [Exports](#exports) - [ExportNamedDeclaration](#exportnameddeclaration) - [ExportSpecifier](#exportspecifier) - [ExportDefaultDeclaration](#exportdefaultdeclaration) - [ExportAllDeclaration](#exportalldeclaration) # Node objects AST nodes are represented as `Node` objects, which may have any prototype inheritance but which implement the following interface: ```js interface Node { type: string; loc: SourceLocation | null; } ``` The `type` field is a string representing the AST variant type. Each subtype of `Node` is documented below with the specific string of its `type` field. You can use this field to determine which interface a node implements. The `loc` field represents the source location information of the node. If the node contains no information about the source location, the field is `null`; otherwise it is an object consisting of a start position (the position of the first character of the parsed source region) and an end position (the position of the first character after the parsed source region): ```js interface SourceLocation { source: string | null; start: Position; end: Position; } ``` Each `Position` object consists of a `line` number (1-indexed) and a `column` number (0-indexed): ```js interface Position { line: number; // >= 1 column: number; // >= 0 } ``` # Changes ### @babel/parser (Babylon) v7 Flow: Node renamed from `ExistentialTypeParam` to `ExistsTypeAnnotation` [#322](https://github.com/babel/babylon/pull/322) Flow: Node renamed from `NumericLiteralTypeAnnotation` to `NumberLiteralTypeAnnotation` [babel/babylon#332](https://github.com/babel/babylon/pull/332) Flow: Node `Variance` which replaces the string value of the `variance` field on several nodes [babel/babylon#333](https://github.com/babel/babylon/pull/333) Flow: `ObjectTypeIndexer` location info matches Flow's better [babel/babylon#228](https://github.com/babel/babylon/pull/228) Node `ForAwaitStatement` has been removed [#349](https://github.com/babel/babylon/pull/349) in favor of modifying `ForOfStatement` `RestProperty` and `SpreadProperty` have been dropped in favor of `RestElement` and `SpreadElement`. # Identifier ```js interface Identifier <: Expression, Pattern { type: "Identifier"; name: string; } ``` An identifier. Note that an identifier may be an expression or a destructuring pattern. # PrivateName ```js interface PrivateName <: Node { type: "PrivateName"; id: Identifier; } ``` A Private Name Identifier. # Literals ```js interface Literal <: Expression { } ``` A literal token. May or may not represent an expression. ## RegExpLiteral ```js interface RegExpLiteral <: Literal { type: "RegExpLiteral"; pattern: string; flags: string; } ``` ## NullLiteral ```js interface NullLiteral <: Literal { type: "NullLiteral"; } ``` ## StringLiteral ```js interface StringLiteral <: Literal { type: "StringLiteral"; value: string; } ``` ## BooleanLiteral ```js interface BooleanLiteral <: Literal { type: "BooleanLiteral"; value: boolean; } ``` ## NumericLiteral ```js interface NumericLiteral <: Literal { type: "NumericLiteral"; value: number; } ``` ## 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`. ## DecimalLiteral ```js interface DecimalLiteral <: Literal { type: "DecimalLiteral"; value: string; } ``` The `value` property is the string representation of the `BigDecimal` value. It doesn't include the suffix `m`. # Programs ```js interface Program <: Node { type: "Program"; interpreter: InterpreterDirective | null; sourceType: "script" | "module"; body: [ Statement | ModuleDeclaration ]; directives: [ Directive ]; } ``` A complete program source tree. Parsers must specify `sourceType` as `"module"` if the source has been parsed as an ES6 module. Otherwise, `sourceType` must be `"script"`. # Functions ```js interface Function <: Node { id: Identifier | null; params: [ Pattern ]; body: BlockStatement; generator: boolean; async: boolean; } ``` A function [declaration](#functiondeclaration) or [expression](#functionexpression). # Statements ```js interface Statement <: Node { } ``` Any statement. ## ExpressionStatement ```js interface ExpressionStatement <: Statement { type: "ExpressionStatement"; expression: Expression; } ``` An expression statement, i.e., a statement consisting of a single expression. ## BlockStatement ```js interface BlockStatement <: Statement { type: "BlockStatement"; body: [ Statement ]; directives: [ Directive ]; } ``` A block statement, i.e., a sequence of statements surrounded by braces. ## EmptyStatement ```js interface EmptyStatement <: Statement { type: "EmptyStatement"; } ``` An empty statement, i.e., a solitary semicolon. ## DebuggerStatement ```js interface DebuggerStatement <: Statement { type: "DebuggerStatement"; } ``` A `debugger` statement. ## WithStatement ```js interface WithStatement <: Statement { type: "WithStatement"; object: Expression; body: Statement; } ``` A `with` statement. ## Control flow ### ReturnStatement ```js interface ReturnStatement <: Statement { type: "ReturnStatement"; argument: Expression | null; } ``` A `return` statement. ### LabeledStatement ```js interface LabeledStatement <: Statement { type: "LabeledStatement"; label: Identifier; body: Statement; } ``` A labeled statement, i.e., a statement prefixed by a `break`/`continue` label. ### BreakStatement ```js interface BreakStatement <: Statement { type: "BreakStatement"; label: Identifier | null; } ``` A `break` statement. ### ContinueStatement ```js interface ContinueStatement <: Statement { type: "ContinueStatement"; label: Identifier | null; } ``` A `continue` statement. ## Choice ### IfStatement ```js interface IfStatement <: Statement { type: "IfStatement"; test: Expression; consequent: Statement; alternate: Statement | null; } ``` An `if` statement. ### SwitchStatement ```js interface SwitchStatement <: Statement { type: "SwitchStatement"; discriminant: Expression; cases: [ SwitchCase ]; } ``` A `switch` statement. #### SwitchCase ```js interface SwitchCase <: Node { type: "SwitchCase"; test: Expression | null; consequent: [ Statement ]; } ``` A `case` (if `test` is an `Expression`) or `default` (if `test === null`) clause in the body of a `switch` statement. ## Exceptions ### ThrowStatement ```js interface ThrowStatement <: Statement { type: "ThrowStatement"; argument: Expression; } ``` A `throw` statement. ### TryStatement ```js interface TryStatement <: Statement { type: "TryStatement"; block: BlockStatement; handler: CatchClause | null; finalizer: BlockStatement | null; } ``` A `try` statement. If `handler` is `null` then `finalizer` must be a `BlockStatement`. #### CatchClause ```js interface CatchClause <: Node { type: "CatchClause"; param?: Pattern; body: BlockStatement; } ``` A `catch` clause following a `try` block. ## Loops ### WhileStatement ```js interface WhileStatement <: Statement { type: "WhileStatement"; test: Expression; body: Statement; } ``` A `while` statement. ### DoWhileStatement ```js interface DoWhileStatement <: Statement { type: "DoWhileStatement"; body: Statement; test: Expression; } ``` A `do`/`while` statement. ### ForStatement ```js interface ForStatement <: Statement { type: "ForStatement"; init: VariableDeclaration | Expression | null; test: Expression | null; update: Expression | null; body: Statement; } ``` A `for` statement. ### ForInStatement ```js interface ForInStatement <: Statement { type: "ForInStatement"; left: VariableDeclaration | Expression; right: Expression; body: Statement; } ``` A `for`/`in` statement. ## ForOfStatement ```js interface ForOfStatement <: ForInStatement { type: "ForOfStatement"; await: boolean; } ``` # Declarations ```js interface Declaration <: Statement { } ``` Any declaration node. Note that declarations are considered statements; this is because declarations can appear in any statement context. ## FunctionDeclaration ```js interface FunctionDeclaration <: Function, Declaration { type: "FunctionDeclaration"; id: Identifier; } ``` A function declaration. Note that unlike in the parent interface `Function`, the `id` cannot be `null`, except when this is the child of an `ExportDefaultDeclaration`. ## VariableDeclaration ```js interface VariableDeclaration <: Declaration { type: "VariableDeclaration"; declarations: [ VariableDeclarator ]; kind: "var" | "let" | "const"; } ``` A variable declaration. ### VariableDeclarator ```js interface VariableDeclarator <: Node { type: "VariableDeclarator"; id: Pattern; init: Expression | null; } ``` A variable declarator. # Misc ## Decorator ```js interface Decorator <: Node { type: "Decorator"; expression: Expression; } ``` ## Directive ```js interface Directive <: Node { type: "Directive"; value: DirectiveLiteral; } ``` ## DirectiveLiteral ```js interface DirectiveLiteral <: StringLiteral { type: "DirectiveLiteral"; } ``` ## InterpreterDirective ```js interface InterpreterDirective <: StringLiteral { type: "InterpreterDirective"; } ``` # Expressions ```js interface Expression <: Node { } ``` Any expression node. Since the left-hand side of an assignment may be any expression in general, an expression can also be a pattern. ## Super ```js interface Super <: Node { type: "Super"; } ``` A `super` pseudo-expression. ## Import ```js interface Import <: Node { type: "Import"; } ``` A `import` pseudo-expression. ## ThisExpression ```js interface ThisExpression <: Expression { type: "ThisExpression"; } ``` A `this` expression. ## ArrowFunctionExpression ```js interface ArrowFunctionExpression <: Function, Expression { type: "ArrowFunctionExpression"; body: BlockStatement | Expression; } ``` A fat arrow function expression, e.g., `let foo = (bar) => { /* body */ }`. ## YieldExpression ```js interface YieldExpression <: Expression { type: "YieldExpression"; argument: Expression | null; delegate: boolean; } ``` A `yield` expression. ## AwaitExpression ```js interface AwaitExpression <: Expression { type: "AwaitExpression"; argument: Expression | null; } ``` A `await` expression. ## ArrayExpression ```js interface ArrayExpression <: Expression { type: "ArrayExpression"; elements: [ Expression | SpreadElement | null ]; } ``` An array expression. ## ObjectExpression ```js interface ObjectExpression <: Expression { type: "ObjectExpression"; properties: [ ObjectProperty | ObjectMethod | SpreadElement ]; } ``` An object expression. ### ObjectMember ```js interface ObjectMember <: Node { key: Expression; computed: boolean; decorators: [ Decorator ]; } ``` #### ObjectProperty ```js interface ObjectProperty <: ObjectMember { type: "ObjectProperty"; shorthand: boolean; value: Expression; } ``` #### ObjectMethod ```js interface ObjectMethod <: ObjectMember, Function { type: "ObjectMethod"; kind: "get" | "set" | "method"; } ``` ## RecordExpression ```js interface RecordExpression <: Expression { type: "RecordExpression"; properties: [ ObjectProperty | ObjectMethod | SpreadElement ]; } ``` ## TupleExpression ```js interface TupleExpression <: Expression { type: "TupleExpression"; elements: [ Expression | SpreadElement | null ]; } ``` ## FunctionExpression ```js interface FunctionExpression <: Function, Expression { type: "FunctionExpression"; } ``` A `function` expression. ## Unary operations ### UnaryExpression ```js interface UnaryExpression <: Expression { type: "UnaryExpression"; operator: UnaryOperator; prefix: boolean; argument: Expression; } ``` A unary operator expression. #### UnaryOperator ```js enum UnaryOperator { "-" | "+" | "!" | "~" | "typeof" | "void" | "delete" | "throw" } ``` A unary operator token. ### UpdateExpression ```js interface UpdateExpression <: Expression { type: "UpdateExpression"; operator: UpdateOperator; argument: Expression; prefix: boolean; } ``` An update (increment or decrement) operator expression. #### UpdateOperator ```js enum UpdateOperator { "++" | "--" } ``` An update (increment or decrement) operator token. ## Binary operations ### BinaryExpression ```js interface BinaryExpression <: Expression { type: "BinaryExpression"; operator: BinaryOperator; left: Expression | PrivateName; right: Expression; } ``` A binary operator expression. When `operator` is `in`, the `left` can be a `PrivateName`. #### BinaryOperator ```js enum BinaryOperator { "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof" | "|>" } ``` A binary operator token. ### AssignmentExpression ```js interface AssignmentExpression <: Expression { type: "AssignmentExpression"; operator: AssignmentOperator; left: Pattern | Expression; right: Expression; } ``` An assignment operator expression. It has short-circuiting behaviour if the `operator` is one of `"||="`, `"&&="`, and `"??="`. #### AssignmentOperator ```js enum AssignmentOperator { "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=" } ``` An assignment operator token. ### LogicalExpression ```js interface LogicalExpression <: Expression { type: "LogicalExpression"; operator: LogicalOperator; left: Expression; right: Expression; } ``` A logical operator expression. #### LogicalOperator ```js enum LogicalOperator { "||" | "&&" | "??" } ``` A logical operator token. ### SpreadElement ```js interface SpreadElement <: Node { type: "SpreadElement"; argument: Expression; } ``` ### ArgumentPlaceholder ```js interface ArgumentPlaceholder <: Node { type: "ArgumentPlaceholder"; } ``` ### MemberExpression ```js interface MemberExpression <: Expression, Pattern { type: "MemberExpression"; object: Expression | Super; property: Expression | PrivateName; computed: boolean; } ``` 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`. ### OptionalMemberExpression ```js interface OptionalMemberExpression <: Expression { type: "OptionalMemberExpression"; object: Expression; property: Expression | PrivateName; computed: boolean; optional: boolean; } ``` An optional member expression is a part of the optional chain. When `optional` is `true`, it is the starting element of the optional chain. i.e. In `a?.b.c`, `?.b` is an optional member expression with `optional: true`, `.c` is an optional member expression. See this [gist](https://gist.github.com/JLHwung/567fb29fa2b82bbe164ad9067ff3290f) for more AST examples. ### BindExpression ```js interface BindExpression <: Expression { type: "BindExpression"; object: Expression | null; callee: Expression; } ``` If `object` is `null`, then `callee` should be a `MemberExpression`. ### Pipeline These nodes are used by the Smart Pipeline to determine the type of the expression in a Pipeline Operator Expression. The F# Pipeline uses simple `BinaryExpression`s. #### PipelineBody ```js interface PipelineBody <: NodeBase { type: "PipelineBody"; } ``` #### PipelineBareFunctionBody ```js interface PipelineBody <: NodeBase { type: "PipelineBareFunctionBody"; callee: Expression; } ``` #### PipelineBareConstructorBody ```js interface PipelineBareConstructorBody <: NodeBase { type: "PipelineBareConstructorBody"; callee: Expression; } ``` #### PipelineBareAwaitedFunctionBody ```js interface PipelineBareConstructorBody <: NodeBase { type: "PipelineTopicBody"; expression: Expression; } ``` #### PipelineTopicBody ```js interface PipelineBareConstructorBody <: NodeBase { type: "PipelineBareAwaitedFunctionBody"; callee: Expression; } ``` ## ConditionalExpression ```js interface ConditionalExpression <: Expression { type: "ConditionalExpression"; test: Expression; alternate: Expression; consequent: Expression; } ``` A conditional expression, i.e., a ternary `?`/`:` expression. ## CallExpression ```js interface CallExpression <: Expression { type: "CallExpression"; callee: Expression | Super | Import; arguments: [ Expression | SpreadElement ]; } ``` A function or method call expression. When the `callee` is `Import`, the `arguments` must have only one `Expression` element. ## OptionalCallExpression ```js interface OptionalCallExpression <: Expression { type: "OptionalCallExpression"; callee: Expression; arguments: [ Expression | SpreadElement ]; optional: boolean; } ``` An optional call expression is a part of the optional chain. When `optional` is `true`, it is the starting element of the optional chain. i.e. In `f?.()()`, `?.()` is an optional call expression with `optional: true`, `()` is an optional call expression with `optional: false`. See this [gist](https://gist.github.com/JLHwung/567fb29fa2b82bbe164ad9067ff3290f) for more AST examples. ## NewExpression ```js interface NewExpression <: CallExpression { type: "NewExpression"; } ``` A `new` expression. ## SequenceExpression ```js interface SequenceExpression <: Expression { type: "SequenceExpression"; expressions: [ Expression ]; } ``` A sequence expression, i.e., a comma-separated sequence of expressions. ## ParenthesizedExpression ```js interface ParenthesizedExpression <: Expression { type "ParenthesizedExpression"; expression: Expression; } ``` An expression wrapped by parentheses. By default `@babel/parser` does not create this node, unless the `createParenthesizedExpressions: true` option is passed. ## DoExpression ```js interface DoExpression <: Expression { type: "DoExpression"; body: BlockStatement; } ``` # Template Literals ## TemplateLiteral ```js interface TemplateLiteral <: Expression { type: "TemplateLiteral"; quasis: [ TemplateElement ]; expressions: [ Expression ]; } ``` ## TaggedTemplateExpression ```js interface TaggedTemplateExpression <: Expression { type: "TaggedTemplateExpression"; tag: Expression; quasi: TemplateLiteral; } ``` ## TemplateElement ```js interface TemplateElement <: Node { type: "TemplateElement"; tail: boolean; value: { cooked: string | null; raw: string; }; } ``` # Patterns ```js interface Pattern <: Node { } ``` ## ObjectPattern ```js interface AssignmentProperty <: ObjectProperty { value: Pattern; } interface ObjectPattern <: Pattern { type: "ObjectPattern"; properties: [ AssignmentProperty | RestElement ]; } ``` ## ArrayPattern ```js interface ArrayPattern <: Pattern { type: "ArrayPattern"; elements: [ Pattern | null ]; } ``` ## RestElement ```js interface RestElement <: Pattern { type: "RestElement"; argument: Pattern; } ``` ## AssignmentPattern ```js interface AssignmentPattern <: Pattern { type: "AssignmentPattern"; left: Pattern; right: Expression; } ``` # Classes ```js interface Class <: Node { id: Identifier | null; superClass: Expression | null; body: ClassBody; decorators: [ Decorator ]; } ``` ## ClassBody ```js interface ClassBody <: Node { type: "ClassBody"; body: [ ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | StaticBlock ]; } ``` ## ClassMethod ```js interface ClassMethod <: Function { type: "ClassMethod"; key: Expression; kind: "constructor" | "method" | "get" | "set"; computed: boolean; static: boolean; decorators: [ Decorator ]; } ``` ## ClassPrivateMethod ```js interface ClassPrivateMethod <: Function { type: "ClassPrivateMethod"; key: PrivateName; kind: "method" | "get" | "set"; static: boolean; decorators: [ Decorator ]; } ``` ## ClassProperty ```js interface ClassProperty <: Node { type: "ClassProperty"; key: Expression; value: Expression; static: boolean; computed: boolean; } ``` ## ClassPrivateProperty ```js interface ClassPrivateProperty <: Node { type: "ClassPrivateProperty"; key: PrivateName; value: Expression; static: boolean; } ``` ## StaticBlock ```js interface StaticBlock <: Node { type: "StaticBlock"; body: [ Statement ]; } ``` A static block proposed in https://github.com/tc39/proposal-class-static-block. ## ClassDeclaration ```js interface ClassDeclaration <: Class, Declaration { type: "ClassDeclaration"; id: Identifier; } ``` ## ClassExpression ```js interface ClassExpression <: Class, Expression { type: "ClassExpression"; } ``` ## MetaProperty ```js interface MetaProperty <: Expression { type: "MetaProperty"; meta: Identifier; property: Identifier; } ``` # Modules ## ModuleDeclaration ```js interface ModuleDeclaration <: Node { } ``` A module `import` or `export` declaration. ## ModuleSpecifier ```js interface ModuleSpecifier <: Node { local: Identifier; } ``` A specifier in an import or export declaration. ## Imports ### ImportDeclaration ```js interface ImportDeclaration <: ModuleDeclaration { type: "ImportDeclaration"; importKind: null | "type" | "typeof" | "value"; specifiers: [ ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier ]; source: StringLiteral; assertions?: [ ImportAttribute ]; } ``` An import declaration, e.g., `import foo from "mod";`. > importKind is only set when `flow` plugin enabled in babel-parser ### ImportSpecifier ```js interface ImportSpecifier <: ModuleSpecifier { type: "ImportSpecifier"; imported: Identifier | StringLiteral; } ``` An imported variable binding, e.g., `{foo}` in `import {foo} from "mod"` or `{foo as bar}` in `import {foo as bar} from "mod"`. The `imported` field refers to the name of the export imported from the module. The `local` field refers to the binding imported into the local module scope. If it is a basic named import, such as in `import {foo} from "mod"`, both `imported` and `local` are equivalent `Identifier` nodes; in this case an `Identifier` node representing `foo`. If it is an aliased import, such as in `import {foo as bar} from "mod"`, the `imported` field is an `Identifier` node representing `foo`, and the `local` field is an `Identifier` node representing `bar`. ### ImportDefaultSpecifier ```js interface ImportDefaultSpecifier <: ModuleSpecifier { type: "ImportDefaultSpecifier"; } ``` A default import specifier, e.g., `foo` in `import foo from "mod.js"`. ### ImportNamespaceSpecifier ```js interface ImportNamespaceSpecifier <: ModuleSpecifier { type: "ImportNamespaceSpecifier"; } ``` 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 ```js interface ExportNamedDeclaration <: ModuleDeclaration { type: "ExportNamedDeclaration"; declaration: Declaration | null; specifiers: [ ExportSpecifier ]; source: StringLiteral | null; assertions?: [ ImportAttribute ]; } ``` An export named declaration, e.g., `export {foo, bar};`, `export {foo} from "mod";`, `export var foo = 1;` or `export * as foo from "bar";`. Note: - Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state. - If `source` is `null`, for each `specifier` of `specifiers`, `specifier.local` can not be a `StringLiteral`. ### ExportSpecifier ```js interface ExportSpecifier <: ModuleSpecifier { type: "ExportSpecifier"; exported: Identifier | StringLiteral; local?: Identifier | StringLiteral; } ``` An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`. The `exported` field refers to the name exported in the module. The `local` field refers to the binding into the local module scope. If it is a basic named export, such as in `export {foo}`, both `exported` and `local` are equivalent `Identifier` nodes; in this case an `Identifier` node representing `foo`. If it is an aliased export, such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`, and the `local` field is an `Identifier` node representing `bar`. ### ExportDefaultDeclaration ```js interface OptFunctionDeclaration <: FunctionDeclaration { id: Identifier | null; } interface OptClassDeclaration <: ClassDeclaration { id: Identifier | null; } interface ExportDefaultDeclaration <: ModuleDeclaration { type: "ExportDefaultDeclaration"; declaration: OptFunctionDeclaration | OptClassDeclaration | Expression; } ``` An export default declaration, e.g., `export default function () {};` or `export default 1;`. ### ExportAllDeclaration ```js interface ExportAllDeclaration <: ModuleDeclaration { type: "ExportAllDeclaration"; source: StringLiteral; assertions?: [ ImportAttribute ]; } ``` An export batch declaration, e.g., `export * from "mod";`. babel-7.12.12/packages/babel-parser/bin/000077500000000000000000000000001377064615700176365ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/bin/babel-parser.js000077500000000000000000000005101377064615700225320ustar00rootroot00000000000000#!/usr/bin/env node /* eslint no-var: 0 */ var parser = require(".."); var fs = require("fs"); var filename = process.argv[2]; if (!filename) { console.error("no filename specified"); } else { var file = fs.readFileSync(filename, "utf8"); var ast = parser.parse(file); console.log(JSON.stringify(ast, null, " ")); } babel-7.12.12/packages/babel-parser/package.json000066400000000000000000000015751377064615700213640ustar00rootroot00000000000000{ "name": "@babel/parser", "version": "7.12.11", "description": "A JavaScript parser", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { "access": "public" }, "keywords": [ "babel", "javascript", "parser", "tc39", "ecmascript", "@babel/parser" ], "repository": { "type": "git", "url": "https://github.com/babel/babel.git", "directory": "packages/babel-parser" }, "main": "lib/index.js", "types": "typings/babel-parser.d.ts", "files": [ "bin", "lib", "typings" ], "engines": { "node": ">=6.0.0" }, "devDependencies": { "@babel/code-frame": "workspace:*", "@babel/helper-fixtures": "workspace:*", "@babel/helper-validator-identifier": "workspace:*", "charcodes": "^0.2.0" }, "bin": "./bin/babel-parser.js" } babel-7.12.12/packages/babel-parser/src/000077500000000000000000000000001377064615700176555ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/src/index.js000077500000000000000000000050171377064615700213300ustar00rootroot00000000000000// @flow import { type Options } from "./options"; import { hasPlugin, validatePlugins, mixinPluginNames, mixinPlugins, type PluginList, } from "./plugin-utils"; import Parser from "./parser"; import { types as tokTypes } from "./tokenizer/types"; import "./tokenizer/context"; import type { Expression, File } from "./types"; export function parse(input: string, options?: Options): File { if (options?.sourceType === "unambiguous") { options = { ...options, }; try { options.sourceType = "module"; const parser = getParser(options, input); const ast = parser.parse(); 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 {} throw moduleError; } } else { return getParser(options, input).parse(); } } export function parseExpression(input: string, options?: Options): Expression { const parser = getParser(options, input); if (parser.options.strictMode) { parser.state.strict = true; } return parser.getExpression(); } export { tokTypes }; function getParser(options: ?Options, input: string): Parser { let cls = Parser; if (options?.plugins) { validatePlugins(options.plugins); cls = getParserClass(options.plugins); } return new cls(options, input); } const parserClassCache: { [key: string]: Class } = {}; /** Get a Parser class with plugins applied. */ function getParserClass(pluginsFromOptions: PluginList): Class { const pluginList = mixinPluginNames.filter(name => hasPlugin(pluginsFromOptions, name), ); const key = pluginList.join("/"); let cls = parserClassCache[key]; if (!cls) { cls = Parser; for (const plugin of pluginList) { cls = mixinPlugins[plugin](cls); } parserClassCache[key] = cls; } return cls; } babel-7.12.12/packages/babel-parser/src/options.js000077500000000000000000000053061377064615700217150ustar00rootroot00000000000000// @flow import type { PluginList } from "./plugin-utils"; // A second optional argument can be given to further configure // the parser process. These options are recognized: export type SourceType = "script" | "module" | "unambiguous"; export type Options = { sourceType: SourceType, sourceFilename?: string, startLine: number, allowAwaitOutsideFunction: boolean, allowReturnOutsideFunction: boolean, allowImportExportEverywhere: boolean, allowSuperOutsideMethod: boolean, allowUndeclaredExports: boolean, plugins: PluginList, strictMode: ?boolean, ranges: boolean, tokens: boolean, createParenthesizedExpressions: boolean, errorRecovery: boolean, }; export const defaultOptions: Options = { // Source type ("script" or "module") for different semantics sourceType: "script", // Source filename. sourceFilename: undefined, // Line from which to start counting source. Useful for // integration with other tools. startLine: 1, // When enabled, await at the top level is not considered an // error. allowAwaitOutsideFunction: false, // When enabled, a return at the top level is not considered an // error. allowReturnOutsideFunction: false, // When enabled, import/export statements are not constrained to // appearing at the top of the program. allowImportExportEverywhere: false, // TODO allowSuperOutsideMethod: false, // When enabled, export statements can reference undeclared variables. allowUndeclaredExports: false, // An array of plugins to enable plugins: [], // TODO strictMode: null, // Nodes have their start and end characters offsets recorded in // `start` and `end` properties (directly on the node, rather than // the `loc` object, which holds line/column data. To also add a // [semi-standardized][range] `range` property holding a `[start, // end]` array with the same numbers, set the `ranges` option to // `true`. // // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 ranges: false, // Adds all parsed tokens to a `tokens` property on the `File` node tokens: false, // 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 export function getOptions(opts: ?Options): Options { const options: any = {}; for (const key of Object.keys(defaultOptions)) { options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key]; } return options; } babel-7.12.12/packages/babel-parser/src/parser/000077500000000000000000000000001377064615700211515ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/src/parser/base.js000066400000000000000000000024451377064615700224260ustar00rootroot00000000000000// @flow import type { Options } from "../options"; import type State from "../tokenizer/state"; import type { PluginsMap } from "./index"; import type ScopeHandler from "../util/scope"; import type ExpressionScopeHandler from "../util/expression-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 declare options: Options; declare inModule: boolean; declare scope: ScopeHandler<*>; declare classScope: ClassScopeHandler; declare prodParam: ProductionParameterHandler; declare expressionScope: ExpressionScopeHandler; declare plugins: PluginsMap; declare filename: ?string; sawUnambiguousESM: boolean = false; ambiguousScriptDifferentAst: boolean = false; // Initialized by Tokenizer declare state: State; // input and length are not in state as they are constant and we do // not want to ever copy them, which happens if state gets cloned declare input: string; declare length: number; hasPlugin(name: string): boolean { return this.plugins.has(name); } getPluginOption(plugin: string, name: string) { // $FlowIssue if (this.hasPlugin(plugin)) return this.plugins.get(plugin)[name]; } } babel-7.12.12/packages/babel-parser/src/parser/comments.js000066400000000000000000000244471377064615700233470ustar00rootroot00000000000000// @flow /** * Based on the comment attachment algorithm used in espree and estraverse. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import BaseParser from "./base"; import type { Comment, Node } from "../types"; function last(stack: $ReadOnlyArray): T { return stack[stack.length - 1]; } export default class CommentsParser extends BaseParser { addComment(comment: Comment): void { if (this.filename) comment.loc.filename = this.filename; this.state.trailingComments.push(comment); 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; const stack = this.state.commentStack; let firstChild, lastChild, trailingComments, i, j; if (this.state.trailingComments.length > 0) { // If the first comment in trailingComments comes after the // current node, then we're good - all comments in the array will // come after the node and so it's safe to add them as official // trailingComments. if (this.state.trailingComments[0].start >= node.end) { trailingComments = this.state.trailingComments; this.state.trailingComments = []; } else { // Otherwise, if the first comment doesn't come after the // current node, that means we have a mix of leading and trailing // comments in the array and that leadingComments contains the // same items as trailingComments. Reset trailingComments to // zero items and we'll handle this by evaluating leadingComments // later. this.state.trailingComments.length = 0; } } else if (stack.length > 0) { const lastInStack = last(stack); if ( lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end ) { trailingComments = lastInStack.trailingComments; delete lastInStack.trailingComments; } } // Eating the stack. if (stack.length > 0 && last(stack).start >= node.start) { firstChild = stack.pop(); } while (stack.length > 0 && last(stack).start >= node.start) { lastChild = stack.pop(); } if (!lastChild && firstChild) lastChild = firstChild; // 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) { if (lastChild.leadingComments) { if ( lastChild !== node && lastChild.leadingComments.length > 0 && last(lastChild.leadingComments).end <= node.start ) { node.leadingComments = lastChild.leadingComments; delete lastChild.leadingComments; } else { // A leading comment for an anonymous class had been stolen by its first ClassMethod, // so this takes back the leading comment. // See also: https://github.com/eslint/espree/issues/158 for (i = lastChild.leadingComments.length - 2; i >= 0; --i) { if (lastChild.leadingComments[i].end <= node.start) { node.leadingComments = lastChild.leadingComments.splice(0, i + 1); break; } } } } } else if (this.state.leadingComments.length > 0) { if (last(this.state.leadingComments).end <= 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) { node.leadingComments = this.state.leadingComments; this.state.leadingComments = []; } } else { // https://github.com/eslint/espree/issues/2 // // In special cases, such as return (without a value) and // debugger, all comments will end up as leadingComments and // will otherwise be eliminated. This step runs when the // commentStack is empty and there are comments left // in leadingComments. // // This loop figures out the stopping point between the actual // leading and trailing comments by finding the location of the // first comment that comes after the given node. for (i = 0; i < this.state.leadingComments.length; i++) { if (this.state.leadingComments[i].end > node.start) { break; } } // Split the array based on the location of the first comment // that comes after the node. Keep in mind that this could // result in an empty array, and if so, the array must be // deleted. const leadingComments = this.state.leadingComments.slice(0, i); if (leadingComments.length) { node.leadingComments = leadingComments; } // Similarly, trailing comments are attached later. The variable // must be reset to null if there are no trailing comments. trailingComments = this.state.leadingComments.slice(i); if (trailingComments.length === 0) { trailingComments = null; } } } this.state.commentPreviousNode = node; if (trailingComments) { if ( trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end ) { node.innerComments = trailingComments; } else { // TrailingComments maybe contain innerComments const firstTrailingCommentIndex = trailingComments.findIndex( comment => comment.end >= node.end, ); if (firstTrailingCommentIndex > 0) { node.innerComments = trailingComments.slice( 0, firstTrailingCommentIndex, ); node.trailingComments = trailingComments.slice( firstTrailingCommentIndex, ); } else { node.trailingComments = trailingComments; } } } stack.push(node); } } babel-7.12.12/packages/babel-parser/src/parser/error-message.js000066400000000000000000000306631377064615700242720ustar00rootroot00000000000000// @flow /* eslint sort-keys: "error" */ /** * @module parser/error-message */ // The Errors key follows https://cs.chromium.org/chromium/src/v8/src/common/message-template.h unless it does not exist export const ErrorMessages = Object.freeze({ AccessorIsGenerator: "A %0ter cannot be a generator", ArgumentsInClass: "'arguments' is only allowed in functions and class methods", 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", AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules", AwaitNotInAsyncFunction: "'await' is only allowed within async functions", 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", DecoratorStaticBlock: "Decorators can't be used with a static block", 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", DuplicateStaticBlock: "Duplicate static block in the same class", ElementAfterRest: "Rest element must be last element", EscapedCharNotAnIdentifier: "Invalid Unicode escape", ExportBindingIsString: "A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { '%0' as '%1' } from 'some-module'`?", ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'", 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", ImportBindingIsString: 'A string literal cannot be used as an imported binding.\n- Did you mean `import { "%0" as foo }`?', ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments", ImportCallArity: "import() requires exactly %0", 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"'`, InvalidBigIntLiteral: "Invalid BigIntLiteral", InvalidCodePoint: "Code point out of bounds", InvalidDecimal: "Invalid decimal", 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", InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'", InvalidOrUnexpectedToken: "Unexpected character '%0'", InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern", InvalidPrivateFieldResolution: "Private name #%0 is not defined", InvalidPropertyBindingPattern: "Binding member expression", InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions", 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.", LineTerminatorBeforeArrow: "No line break is allowed before '=>'", 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", ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`", ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values", ModuleAttributesWithDuplicateKeys: 'Duplicate key "%0" is not allowed in module attributes', ModuleExportNameHasLoneSurrogate: "An export name cannot include a lone surrogate, found '\\u%0'", 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.", PrivateInExpectedIn: "Private names are only allowed in property accesses (`obj.#%0`) or in `in` expressions (`#%0 in obj`)", 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'", RecordNoProto: "'__proto__' is not allowed in Record expressions", 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", StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'", 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 '%0'", 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 expression is not allowed in formal parameters", ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0", }); babel-7.12.12/packages/babel-parser/src/parser/error.js000066400000000000000000000040651377064615700226450ustar00rootroot00000000000000// @flow /* eslint sort-keys: "error" */ import { getLineInfo, type Position } from "../util/location"; import CommentsParser from "./comments"; // This function is used to raise exceptions on parse errors. It // takes an offset integer (into the current `input`) to indicate // the location of the error, attaches the position to the end // of the error message, and then raises a `SyntaxError` with that // message. type ErrorContext = { pos: number, loc: Position, missingPlugin?: Array, code?: string, }; export { ErrorMessages as Errors } from "./error-message.js"; export default class ParserError 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; else if (pos === this.state.lastTokStart) loc = this.state.lastTokStartLoc; else if (pos === this.state.end) loc = this.state.endLoc; else if (pos === this.state.lastTokEnd) loc = this.state.lastTokEndLoc; else loc = getLineInfo(this.input, pos); return loc; } raise(pos: number, errorTemplate: string, ...params: any): Error | empty { return this.raiseWithData(pos, undefined, errorTemplate, ...params); } raiseWithData( pos: number, data?: { missingPlugin?: Array, code?: string, }, 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); } _raise(errorContext: ErrorContext, message: string): Error | empty { // $FlowIgnore 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; } } } babel-7.12.12/packages/babel-parser/src/parser/expression.js000066400000000000000000002337271377064615700237240ustar00rootroot00000000000000// @flow // A recursive descent parser operates by defining functions for all // syntactic elements, and recursively calling those, each function // advancing the input stream and returning an AST node. Precedence // of constructs (for example, the fact that `!x[1]` means `!(x[1])` // instead of `(!x)[1]` is handled by the fact that the parser // function that parses unary prefix operators is called first, and // in turn calls the function that parses `[]` subscripts — that // way, it'll receive the node for `x[1]` already parsed, and wraps // *that* in the unary operator node. // // Acorn uses an [operator precedence parser][opp] to handle binary // operator precedence, because it is much more compact than using // the technique outlined above, which uses different, nesting // functions to specify precedence, for all of the ten binary // precedence levels that JavaScript defines. // // [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 { isKeyword, isReservedWord, isStrictReservedWord, isStrictBindReservedWord, isIdentifierStart, } from "../util/identifier"; import type { Pos, Position } from "../util/location"; import * as charCodes from "charcodes"; import { BIND_OUTSIDE, BIND_VAR, SCOPE_ARROW, SCOPE_CLASS, SCOPE_DIRECT_SUPER, SCOPE_FUNCTION, SCOPE_SUPER, SCOPE_PROGRAM, } from "../util/scopeflags"; import { ExpressionErrors } from "./util"; import { PARAM_AWAIT, PARAM_IN, PARAM_RETURN, PARAM, functionFlags, } from "../util/production-parameter"; import { newArrowHeadScope, newAsyncArrowScope, newExpressionScope, } from "../util/expression-scope.js"; import { Errors } from "./error"; 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, isStatement: boolean, optionalId?: boolean, ) => N.Class; +parseDecorators: (allowExport?: boolean) => void; +parseFunction: ( node: T, statement?: number, allowExpressionBody?: boolean, isAsync?: boolean, ) => T; +parseFunctionParams: (node: N.Function, allowModifiers?: boolean) => void; +takeDecorators: (node: N.HasDecorators) => void; */ // For object literal, 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. // For record expression, check if property __proto__ exists checkProto( prop: N.ObjectMember | N.SpreadElement, isRecord: boolean, protoRef: { used: boolean }, refExpressionErrors: ?ExpressionErrors, ): void { if ( prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || // $FlowIgnore prop.shorthand ) { return; } const key = prop.key; // It is either an Identifier or a String/NumericLiteral const name = key.type === "Identifier" ? key.name : key.value; if (name === "__proto__") { if (isRecord) { this.raise(key.start, Errors.RecordNoProto); return; } 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); } } protoRef.used = true; } } shouldExitDescending(expr: N.Expression, potentialArrowAt: number): boolean { return ( expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt ); } // 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; } // ### Expression parsing // These nest, from the most general expression type at the top to // 'atomic', nondivisible expression types at the bottom. Most of // the functions will simply let the function (s) below them parse, // 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. // - `disallowIn` // is used to forbid the `in` operator (in for loops initialization expressions) // When `disallowIn` is true, the production parameter [In] is not present. // - `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( disallowIn?: boolean, refExpressionErrors?: ExpressionErrors, ): N.Expression { if (disallowIn) { return this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors), ); } return this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors)); } // https://tc39.es/ecma262/#prod-Expression parseExpressionBase(refExpressionErrors?: ExpressionErrors): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const expr = this.parseMaybeAssign(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(refExpressionErrors)); } this.toReferencedList(node.expressions); return this.finishNode(node, "SequenceExpression"); } return expr; } // Set [~In] parameter for assignment expression parseMaybeAssignDisallowIn( refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ) { return this.disallowInAnd(() => this.parseMaybeAssign( refExpressionErrors, afterLeftParse, refNeedsArrowPos, ), ); } // Set [+In] parameter for assignment expression parseMaybeAssignAllowIn( refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ) { return this.allowInAnd(() => this.parseMaybeAssign( refExpressionErrors, afterLeftParse, refNeedsArrowPos, ), ); } // Parse an assignment expression. This includes applications of // operators like `+=`. // https://tc39.es/ecma262/#prod-AssignmentExpression parseMaybeAssign( refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; if (this.isContextual("yield")) { if (this.prodParam.hasYield) { // If we have [Yield] production, `yield` will start a YieldExpression thus // regex is allowed following. Otherwise `yield` is an identifier and regex // is disallowed in tt.name.updateContext this.state.exprAllowed = true; let left = this.parseYield(); if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); } return left; } } let ownExpressionErrors; if (refExpressionErrors) { ownExpressionErrors = false; } else { refExpressionErrors = new ExpressionErrors(); ownExpressionErrors = true; } if (this.match(tt.parenL) || this.match(tt.name)) { this.state.potentialArrowAt = this.state.start; } let left = this.parseMaybeConditional( refExpressionErrors, refNeedsArrowPos, ); if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); } if (this.state.type.isAssign) { const node = this.startNodeAt(startPos, startLoc); const operator = this.state.value; node.operator = operator; if (this.match(tt.eq)) { node.left = this.toAssignable(left, /* isLHS */ true); refExpressionErrors.doubleProto = -1; // reset because double __proto__ is valid in assignment expression } else { node.left = left; } if (refExpressionErrors.shorthandAssign >= node.left.start) { refExpressionErrors.shorthandAssign = -1; // reset because shorthand default was used correctly } this.checkLVal(left, "assignment expression"); this.next(); node.right = this.parseMaybeAssign(); return this.finishNode(node, "AssignmentExpression"); } else if (ownExpressionErrors) { this.checkExpressionErrors(refExpressionErrors, true); } return left; } // Parse a ternary conditional (`?:`) operator. // https://tc39.es/ecma262/#prod-ConditionalExpression parseMaybeConditional( 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(refExpressionErrors); if (this.shouldExitDescending(expr, potentialArrowAt)) { return expr; } return this.parseConditional(expr, startPos, startLoc, refNeedsArrowPos); } parseConditional( expr: N.Expression, startPos: number, startLoc: Position, // FIXME: Disabling this for now since can't seem to get it to play nicely // eslint-disable-next-line no-unused-vars refNeedsArrowPos?: ?Pos, ): N.Expression { if (this.eat(tt.question)) { const node = this.startNodeAt(startPos, startLoc); node.test = expr; node.consequent = this.parseMaybeAssignAllowIn(); this.expect(tt.colon); node.alternate = this.parseMaybeAssign(); return this.finishNode(node, "ConditionalExpression"); } return expr; } // Start the precedence parser. // https://tc39.es/ecma262/#prod-ShortCircuitExpression parseExprOps(refExpressionErrors: ExpressionErrors): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; const expr = this.parseMaybeUnary(refExpressionErrors); if (this.shouldExitDescending(expr, potentialArrowAt)) { return expr; } return this.parseExprOp(expr, startPos, startLoc, -1); } // Parse binary operators with the operator precedence parsing // algorithm. `left` is the left-hand side of the operator. // `minPrec` provides context that allows the function to stop and // defer further parser to one of its callers when it encounters an // operator that has a lower precedence than the set it is parsing. parseExprOp( left: N.Expression, leftStartPos: number, leftStartLoc: Position, minPrec: number, ): N.Expression { let prec = this.state.type.binop; if (prec != null && (this.prodParam.hasIn || !this.match(tt._in))) { if (prec > minPrec) { const op = this.state.type; if (op === tt.pipeline) { this.expectPlugin("pipelineOperator"); if (this.state.inFSharpPipelineDirectBody) { return left; } this.state.inPipeline = true; this.checkPipelineAtInfixOperator(left, leftStartPos); } const node = this.startNodeAt(leftStartPos, leftStartLoc); node.left = left; node.operator = this.state.value; if ( op === tt.exponent && left.type === "UnaryExpression" && (this.options.createParenthesizedExpressions || !(left.extra && left.extra.parenthesized)) ) { this.raise( left.argument.start, Errors.UnexpectedTokenUnaryExponentiation, ); } const logical = op === tt.logicalOR || op === tt.logicalAND; const coalesce = op === tt.nullishCoalescing; 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(); if ( op === tt.pipeline && this.getPluginOption("pipelineOperator", "proposal") === "minimal" ) { if ( this.match(tt.name) && this.state.value === "await" && this.prodParam.hasAwait ) { throw this.raise( this.state.start, Errors.UnexpectedAwaitAfterPipelineBody, ); } } node.right = this.parseExprOpRightExpr(op, prec); this.finishNode( node, 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, leftStartPos, leftStartLoc, minPrec); } } return left; } // Helper function for `parseExprOp`. Parse the right-hand side of binary- // operator expressions, then apply any operator-specific functions. parseExprOpRightExpr(op: TokenType, prec: number): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; switch (op) { case tt.pipeline: switch (this.getPluginOption("pipelineOperator", "proposal")) { case "smart": return this.withTopicPermittingContext(() => { return this.parseSmartPipelineBody( this.parseExprOpBaseRightExpr(op, prec), startPos, startLoc, ); }); case "fsharp": return this.withSoloAwaitPermittingContext(() => { return this.parseFSharpPipelineBody(prec); }); } // falls through default: return this.parseExprOpBaseRightExpr(op, prec); } } // Helper function for `parseExprOpRightExpr`. Parse the right-hand side of // binary-operator expressions without applying any operator-specific functions. parseExprOpBaseRightExpr(op: TokenType, prec: number): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; return this.parseExprOp( this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, ); } // Parse unary operators, both prefix and postfix. // https://tc39.es/ecma262/#prod-UnaryExpression parseMaybeUnary(refExpressionErrors: ?ExpressionErrors): N.Expression { if (this.isContextual("await") && this.isAwaitAllowed()) { return this.parseAwait(); } const update = this.match(tt.incDec); const node = this.startNode(); if (this.state.type.prefix) { node.operator = this.state.value; node.prefix = true; if (this.match(tt._throw)) { this.expectPlugin("throwExpressions"); } const isDelete = this.match(tt._delete); this.next(); node.argument = this.parseMaybeUnary(); this.checkExpressionErrors(refExpressionErrors, true); if (this.state.strict && isDelete) { const arg = node.argument; if (arg.type === "Identifier") { this.raise(node.start, Errors.StrictDelete); } else if (this.hasPropertyAsPrivateName(arg)) { this.raise(node.start, Errors.DeletePrivateField); } } if (!update) { return this.finishNode(node, "UnaryExpression"); } } return this.parseUpdate(node, update, refExpressionErrors); } // https://tc39.es/ecma262/#prod-UpdateExpression parseUpdate( node: N.Expression, update: boolean, refExpressionErrors: ?ExpressionErrors, ): N.Expression { if (update) { this.checkLVal(node.argument, "prefix operation"); return this.finishNode(node, "UpdateExpression"); } const startPos = this.state.start; const startLoc = this.state.startLoc; 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; node.prefix = false; node.argument = expr; this.checkLVal(expr, "postfix operation"); this.next(); expr = this.finishNode(node, "UpdateExpression"); } return expr; } // Parse call, dot, and `[]`-subscript expressions. // https://tc39.es/ecma262/#prod-LeftHandSideExpression parseExprSubscripts(refExpressionErrors: ?ExpressionErrors): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; const expr = this.parseExprAtom(refExpressionErrors); if (this.shouldExitDescending(expr, potentialArrowAt)) { return expr; } return this.parseSubscripts(expr, startPos, startLoc); } parseSubscripts( base: N.Expression, startPos: number, startLoc: Position, noCalls?: ?boolean, ): N.Expression { const state = { optionalChainMember: false, maybeAsyncArrow: this.atPossibleAsyncArrow(base), stop: false, }; do { base = this.parseSubscript(base, startPos, startLoc, noCalls, state); // After parsing a subscript, this isn't "async" for sure. state.maybeAsyncArrow = false; } while (!state.stop); return base; } /** * @param state Set 'state.stop = true' to indicate that we should stop parsing subscripts. * state.optionalChainMember to indicate that the member is currently in OptionalChain */ parseSubscript( base: N.Expression, startPos: number, startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, ): N.Expression { if (!noCalls && this.eat(tt.doubleColon)) { return this.parseBind(base, startPos, startLoc, noCalls, state); } else if (this.match(tt.backQuote)) { return this.parseTaggedTemplateExpression( base, startPos, startLoc, state, ); } let optional = false; if (this.match(tt.questionDot)) { if (noCalls && this.lookaheadCharCode() === charCodes.leftParenthesis) { // stop at `?.` when parsing `new a?.()` state.stop = true; return base; } state.optionalChainMember = optional = true; this.next(); } if (!noCalls && this.match(tt.parenL)) { return this.parseCoverCallAndAsyncArrowHead( base, startPos, startLoc, state, optional, ); } else if (optional || this.match(tt.bracketL) || this.eat(tt.dot)) { return this.parseMember(base, startPos, startLoc, state, optional); } else { state.stop = true; return base; } } // base[?Yield, ?Await] [ Expression[+In, ?Yield, ?Await] ] // base[?Yield, ?Await] . IdentifierName // base[?Yield, ?Await] . PrivateIdentifier // where `base` is one of CallExpression, MemberExpression and OptionalChain parseMember( base: N.Expression, startPos: number, startLoc: Position, state: N.ParseSubscriptState, optional: boolean, ): N.OptionalMemberExpression | N.MemberExpression { const node = this.startNodeAt(startPos, startLoc); const computed = this.eat(tt.bracketL); node.object = base; node.computed = computed; const property = computed ? this.parseExpression() : this.parseMaybePrivateName(true); if (this.isPrivateName(property)) { if (node.object.type === "Super") { this.raise(startPos, Errors.SuperPrivateField); } this.classScope.usePrivateName( this.getPrivateNameSV(property), property.start, ); } node.property = property; if (computed) { this.expect(tt.bracketR); } if (state.optionalChainMember) { node.optional = optional; return this.finishNode(node, "OptionalMemberExpression"); } else { return this.finishNode(node, "MemberExpression"); } } // https://github.com/tc39/proposal-bind-operator#syntax parseBind( base: N.Expression, startPos: number, startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, ): N.Expression { const node = this.startNodeAt(startPos, startLoc); node.object = base; node.callee = this.parseNoCallExpr(); state.stop = true; return this.parseSubscripts( this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls, ); } // https://tc39.es/ecma262/#prod-CoverCallExpressionAndAsyncArrowHead // CoverCallExpressionAndAsyncArrowHead // CallExpression[?Yield, ?Await] Arguments[?Yield, ?Await] // OptionalChain[?Yield, ?Await] Arguments[?Yield, ?Await] parseCoverCallAndAsyncArrowHead( base: N.Expression, startPos: number, startLoc: Position, state: N.ParseSubscriptState, optional: boolean, ): N.Expression { const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; this.state.maybeInArrowParameters = true; this.next(); // eat `(` let node = this.startNodeAt(startPos, startLoc); node.callee = base; if (state.maybeAsyncArrow) { this.expressionScope.enter(newAsyncArrowScope()); } if (state.optionalChainMember) { node.optional = optional; } if (optional) { node.arguments = this.parseCallExpressionArguments(tt.parenR, false); } else { node.arguments = this.parseCallExpressionArguments( tt.parenR, state.maybeAsyncArrow, base.type === "Import", base.type !== "Super", node, ); } this.finishCallExpression(node, state.optionalChainMember); if (state.maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) { state.stop = true; this.expressionScope.validateAsPattern(); this.expressionScope.exit(); node = this.parseAsyncArrowFromCallExpression( this.startNodeAt(startPos, startLoc), node, ); } else { if (state.maybeAsyncArrow) { this.expressionScope.exit(); } this.toReferencedArguments(node); } this.state.maybeInArrowParameters = oldMaybeInArrowParameters; return node; } toReferencedArguments( node: N.CallExpression | N.OptionalCallExpression, isParenthesizedExpr?: boolean, ) { this.toReferencedListDeep(node.arguments, isParenthesizedExpr); } // MemberExpression [?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] // CallExpression [?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] parseTaggedTemplateExpression( base: N.Expression, startPos: number, startLoc: Position, state: N.ParseSubscriptState, ): N.TaggedTemplateExpression { const node: N.TaggedTemplateExpression = this.startNodeAt( startPos, startLoc, ); node.tag = base; node.quasi = this.parseTemplate(true); if (state.optionalChainMember) { this.raise(startPos, Errors.OptionalChainingNoTemplate); } return this.finishNode(node, "TaggedTemplateExpression"); } atPossibleAsyncArrow(base: N.Expression): boolean { return ( base.type === "Identifier" && base.name === "async" && this.state.lastTokEnd === base.end && !this.canInsertSemicolon() && // check there are no escape sequences, such as \u{61}sync base.end - base.start === 5 && base.start === this.state.potentialArrowAt ); } finishCallExpression( node: T, optional: boolean, ): N.Expression { if (node.callee.type === "Import") { if (node.arguments.length === 2) { // todo(Babel 8): remove the if condition, // moduleAttributes is renamed to importAssertions if (!this.hasPlugin("moduleAttributes")) { this.expectPlugin("importAssertions"); } } if (node.arguments.length === 0 || node.arguments.length > 2) { this.raise( node.start, Errors.ImportCallArity, this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? "one or two arguments" : "one argument", ); } else { for (const arg of node.arguments) { if (arg.type === "SpreadElement") { this.raise(arg.start, Errors.ImportCallSpreadArgument); } } } } return this.finishNode( node, optional ? "OptionalCallExpression" : "CallExpression", ); } parseCallExpressionArguments( close: TokenType, possibleAsyncArrow: boolean, dynamicImport?: boolean, allowPlaceholder?: boolean, nodeForExtra?: ?N.Node, ): $ReadOnlyArray { const elts = []; let first = true; const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = false; while (!this.eat(close)) { if (first) { first = false; } else { this.expect(tt.comma); if (this.match(close)) { if ( dynamicImport && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes") ) { this.raise( this.state.lastTokStart, Errors.ImportCallArgumentTrailingComma, ); } if (nodeForExtra) { this.addExtra( nodeForExtra, "trailingComma", this.state.lastTokStart, ); } this.next(); break; } } elts.push( this.parseExprListItem( false, possibleAsyncArrow ? new ExpressionErrors() : undefined, possibleAsyncArrow ? { start: 0 } : undefined, allowPlaceholder, ), ); } this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; return elts; } shouldParseAsyncArrow(): boolean { return this.match(tt.arrow) && !this.canInsertSemicolon(); } parseAsyncArrowFromCallExpression( node: N.ArrowFunctionExpression, call: N.CallExpression, ): N.ArrowFunctionExpression { this.expect(tt.arrow); this.parseArrowExpression( node, call.arguments, true, call.extra?.trailingComma, ); return node; } // Parse a no-call expression (like argument of `new` or `::` operators). // https://tc39.es/ecma262/#prod-MemberExpression parseNoCallExpr(): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); } // Parse an atomic expression — either a single token that is an // expression, an expression started by a keyword like `function` or // `new`, or an expression wrapped in punctuation like `()`, `[]`, // or `{}`. // https://tc39.es/ecma262/#prod-PrimaryExpression // https://tc39.es/ecma262/#prod-AsyncArrowFunction // PrimaryExpression // Super // Import // AsyncArrowFunction 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(); const canBeArrow = this.state.potentialArrowAt === this.state.start; let node; switch (this.state.type) { case tt._super: return this.parseSuper(); case tt._import: node = this.startNode(); this.next(); if (this.match(tt.dot)) { return this.parseImportMetaProperty(node); } if (!this.match(tt.parenL)) { this.raise(this.state.lastTokStart, Errors.UnsupportedImport); } return this.finishNode(node, "Import"); case tt._this: node = this.startNode(); this.next(); return this.finishNode(node, "ThisExpression"); case tt.name: { const containsEsc = this.state.containsEsc; const id = this.parseIdentifier(); if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) { if (this.match(tt._function)) { 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( this.startNodeAtNode(id), undefined, true, ); } else if (this.match(tt.name)) { return this.parseAsyncArrowUnaryFunction(id); } } if (canBeArrow && this.match(tt.arrow) && !this.canInsertSemicolon()) { this.next(); return this.parseArrowExpression( this.startNodeAtNode(id), [id], false, ); } return id; } case tt._do: { return this.parseDo(); } case tt.regexp: { const value = this.state.value; node = this.parseLiteral(value.value, "RegExpLiteral"); node.pattern = value.pattern; node.flags = value.flags; return node; } case tt.num: return this.parseLiteral(this.state.value, "NumericLiteral"); case tt.bigint: return this.parseLiteral(this.state.value, "BigIntLiteral"); case tt.decimal: return this.parseLiteral(this.state.value, "DecimalLiteral"); case tt.string: return this.parseLiteral(this.state.value, "StringLiteral"); case tt._null: node = this.startNode(); this.next(); return this.finishNode(node, "NullLiteral"); case tt._true: case tt._false: return this.parseBooleanLiteral(); case tt.parenL: return this.parseParenAndDistinguishExpression(canBeArrow); case tt.bracketBarL: case tt.bracketHashL: { return this.parseArrayLike( this.state.type === tt.bracketBarL ? tt.bracketBarR : tt.bracketR, /* canBePattern */ false, /* isTuple */ true, refExpressionErrors, ); } case tt.bracketL: { return this.parseArrayLike( tt.bracketR, /* canBePattern */ true, /* isTuple */ false, refExpressionErrors, ); } case tt.braceBarL: case tt.braceHashL: { return this.parseObjectLike( this.state.type === tt.braceBarL ? tt.braceBarR : tt.braceR, /* isPattern */ false, /* isRecord */ true, refExpressionErrors, ); } case tt.braceL: { return this.parseObjectLike( tt.braceR, /* isPattern */ false, /* isRecord */ false, refExpressionErrors, ); } case tt._function: return this.parseFunctionOrFunctionSent(); case tt.at: this.parseDecorators(); // fall through case tt._class: node = this.startNode(); this.takeDecorators(node); return this.parseClass(node, false); case tt._new: return this.parseNewOrNewTarget(); case tt.backQuote: return this.parseTemplate(false); // BindExpression[Yield] // :: MemberExpression[?Yield] case tt.doubleColon: { node = this.startNode(); this.next(); node.object = null; const callee = (node.callee = this.parseNoCallExpr()); if (callee.type === "MemberExpression") { return this.finishNode(node, "BindExpression"); } else { throw this.raise(callee.start, Errors.UnsupportedBind); } } case tt.hash: { if (this.state.inPipeline) { node = this.startNode(); if ( this.getPluginOption("pipelineOperator", "proposal") !== "smart" ) { this.raise(node.start, Errors.PrimaryTopicRequiresSmartPipeline); } this.next(); if (!this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { this.raise(node.start, Errors.PrimaryTopicNotAllowed); } this.registerTopicReference(); return this.finishNode(node, "PipelinePrimaryTopicReference"); } // https://tc39.es/proposal-private-fields-in-in // RelationalExpression [In, Yield, Await] // [+In] PrivateIdentifier in ShiftExpression[?Yield, ?Await] const nextCh = this.input.codePointAt(this.state.end); if (isIdentifierStart(nextCh) || nextCh === charCodes.backslash) { const start = this.state.start; // $FlowIgnore It'll either parse a PrivateName or throw. node = (this.parseMaybePrivateName(true): N.PrivateName); if (this.match(tt._in)) { this.expectPlugin("privateIn"); this.classScope.usePrivateName(node.id.name, node.start); } else if (this.hasPlugin("privateIn")) { this.raise( this.state.start, Errors.PrivateInExpectedIn, node.id.name, ); } else { throw this.unexpected(start); } return node; } } // fall through case tt.relational: { if (this.state.value === "<") { const lookaheadCh = this.input.codePointAt(this.nextTokenStart()); if ( isIdentifierStart(lookaheadCh) || // Element/Type Parameter lookaheadCh === charCodes.greaterThan // Fragment <> ) { this.expectOnePlugin(["jsx", "flow", "typescript"]); } } } // fall through default: throw this.unexpected(); } } // async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] parseAsyncArrowUnaryFunction(id: N.Expression): N.ArrowFunctionExpression { const node = this.startNodeAtNode(id); // We don't need to push a new ParameterDeclarationScope here since we are sure // 1) it is an async arrow, 2) no biding pattern is allowed in params this.prodParam.enter(functionFlags(true, this.prodParam.hasYield)); const params = [this.parseIdentifier()]; this.prodParam.exit(); if (this.hasPrecedingLineBreak()) { this.raise(this.state.pos, Errors.LineTerminatorBeforeArrow); } this.expect(tt.arrow); // let foo = async bar => {}; this.parseArrowExpression(node, params, true); return node; } // https://github.com/tc39/proposal-do-expressions parseDo(): N.DoExpression { this.expectPlugin("doExpressions"); const node = this.startNode(); this.next(); // eat `do` const oldLabels = this.state.labels; this.state.labels = []; node.body = this.parseBlock(); this.state.labels = oldLabels; return this.finishNode(node, "DoExpression"); } // Parse the `super` keyword parseSuper(): N.Super { const node = this.startNode(); this.next(); // eat `super` if ( this.match(tt.parenL) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod ) { this.raise(node.start, Errors.SuperNotAllowed); } else if ( !this.scope.allowSuper && !this.options.allowSuperOutsideMethod ) { this.raise(node.start, Errors.UnexpectedSuper); } if ( !this.match(tt.parenL) && !this.match(tt.bracketL) && !this.match(tt.dot) ) { this.raise(node.start, Errors.UnsupportedSuper); } return this.finishNode(node, "Super"); } parseBooleanLiteral(): N.BooleanLiteral { const node = this.startNode(); node.value = this.match(tt._true); this.next(); return this.finishNode(node, "BooleanLiteral"); } 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"); node.id = this.parseIdentifier(true); return this.finishNode(node, "PrivateName"); } else { return this.parseIdentifier(true); } } parseFunctionOrFunctionSent(): N.FunctionExpression | N.MetaProperty { const node = this.startNode(); // We do not do parseIdentifier here because when parseFunctionOrFunctionSent // is called we already know that the current token is a "name" with the value "function" // This will improve perf a tiny little bit as we do not do validation but more importantly // here is that parseIdentifier will remove an item from the expression stack // if "function" or "class" is parsed as identifier (in objects e.g.), which should not happen here. this.next(); // eat `function` if (this.prodParam.hasYield && this.match(tt.dot)) { const meta = this.createIdentifier( this.startNodeAtNode(node), "function", ); this.next(); // eat `.` return this.parseMetaProperty(node, meta, "sent"); } return this.parseFunction(node); } parseMetaProperty( node: N.MetaProperty, meta: N.Identifier, propertyName: string, ): N.MetaProperty { node.meta = meta; if (meta.name === "function" && propertyName === "sent") { // https://github.com/tc39/proposal-function.sent#syntax-1 if (this.isContextual(propertyName)) { this.expectPlugin("functionSent"); } else if (!this.hasPlugin("functionSent")) { // The code wasn't `function.sent` but just `function.`, so a simple error is less confusing. this.unexpected(); } } const containsEsc = this.state.containsEsc; node.property = this.parseIdentifier(true); if (node.property.name !== propertyName || containsEsc) { this.raise( node.property.start, Errors.UnsupportedMetaProperty, meta.name, propertyName, ); } return this.finishNode(node, "MetaProperty"); } // https://tc39.es/ecma262/#prod-ImportMeta parseImportMetaProperty(node: N.MetaProperty): N.MetaProperty { const id = this.createIdentifier(this.startNodeAtNode(node), "import"); this.next(); // eat `.` if (this.isContextual("meta")) { if (!this.inModule) { this.raiseWithData( id.start, { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" }, Errors.ImportMetaOutsideModule, ); } this.sawUnambiguousESM = true; } return this.parseMetaProperty(node, id, "meta"); } parseLiteral( value: any, type: /*T["kind"]*/ string, startPos?: number, startLoc?: Position, ): T { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; const node = this.startNodeAt(startPos, startLoc); this.addExtra(node, "rawValue", value); this.addExtra(node, "raw", this.input.slice(startPos, this.state.end)); node.value = value; this.next(); return this.finishNode(node, type); } // https://tc39.es/ecma262/#prod-CoverParenthesizedExpressionAndArrowParameterList parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; let val; this.next(); // eat `(` this.expressionScope.enter(newArrowHeadScope()); const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.maybeInArrowParameters = true; this.state.inFSharpPipelineDirectBody = false; const innerStartPos = this.state.start; const innerStartLoc = this.state.startLoc; const exprList = []; const refExpressionErrors = new ExpressionErrors(); const refNeedsArrowPos = { start: 0 }; let first = true; let spreadStart; let optionalCommaStart; while (!this.match(tt.parenR)) { if (first) { first = false; } else { this.expect(tt.comma, refNeedsArrowPos.start || null); if (this.match(tt.parenR)) { optionalCommaStart = this.state.start; break; } } if (this.match(tt.ellipsis)) { const spreadNodeStartPos = this.state.start; const spreadNodeStartLoc = this.state.startLoc; spreadStart = this.state.start; exprList.push( this.parseParenItem( this.parseRestBinding(), spreadNodeStartPos, spreadNodeStartLoc, ), ); this.checkCommaAfterRest(charCodes.rightParenthesis); break; } else { exprList.push( this.parseMaybeAssignAllowIn( refExpressionErrors, this.parseParenItem, refNeedsArrowPos, ), ); } } const innerEndPos = this.state.lastTokEnd; const innerEndLoc = this.state.lastTokEndLoc; this.expect(tt.parenR); this.state.maybeInArrowParameters = oldMaybeInArrowParameters; this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; let arrowNode = this.startNodeAt(startPos, startLoc); if ( canBeArrow && this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode)) ) { this.expressionScope.validateAsPattern(); this.expressionScope.exit(); this.parseArrowExpression(arrowNode, exprList, false); return arrowNode; } this.expressionScope.exit(); if (!exprList.length) { this.unexpected(this.state.lastTokStart); } if (optionalCommaStart) this.unexpected(optionalCommaStart); if (spreadStart) this.unexpected(spreadStart); this.checkExpressionErrors(refExpressionErrors, true); if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start); this.toReferencedListDeep(exprList, /* isParenthesizedExpr */ true); if (exprList.length > 1) { val = this.startNodeAt(innerStartPos, innerStartLoc); val.expressions = exprList; this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); } else { val = exprList[0]; } if (!this.options.createParenthesizedExpressions) { this.addExtra(val, "parenthesized", true); this.addExtra(val, "parenStart", startPos); return val; } const parenExpression = this.startNodeAt(startPos, startLoc); parenExpression.expression = val; this.finishNode(parenExpression, "ParenthesizedExpression"); return parenExpression; } shouldParseArrow(): boolean { return !this.canInsertSemicolon(); } parseArrow(node: N.ArrowFunctionExpression): ?N.ArrowFunctionExpression { if (this.eat(tt.arrow)) { return node; } } parseParenItem( node: N.Expression, startPos: number, // eslint-disable-line no-unused-vars startLoc: Position, // eslint-disable-line no-unused-vars ): N.Expression { return node; } parseNewOrNewTarget(): N.NewExpression | N.MetaProperty { const node = this.startNode(); this.next(); if (this.match(tt.dot)) { // https://tc39.es/ecma262/#prod-NewTarget const meta = this.createIdentifier(this.startNodeAtNode(node), "new"); this.next(); const metaProp = this.parseMetaProperty(node, meta, "target"); if (!this.scope.inNonArrowFunction && !this.scope.inClass) { let error = Errors.UnexpectedNewTarget; if (this.hasPlugin("classProperties")) { error += " or class properties"; } /* eslint-disable @babel/development-internal/dry-error-messages */ this.raise(metaProp.start, error); /* eslint-enable @babel/development-internal/dry-error-messages */ } return metaProp; } return this.parseNew(node); } // New's precedence is slightly tricky. It must allow its argument to // be a `[]` or dot subscript expression, but not a call — at least, // not without wrapping it in parentheses. Thus, it uses the noCalls // argument to parseSubscripts to prevent it from consuming the // argument list. // https://tc39.es/ecma262/#prod-NewExpression parseNew(node: N.Expression): N.NewExpression { node.callee = this.parseNoCallExpr(); if (node.callee.type === "Import") { this.raise(node.callee.start, Errors.ImportCallNotNewExpression); } else if (this.isOptionalChain(node.callee)) { this.raise(this.state.lastTokEnd, Errors.OptionalChainingNoNew); } else if (this.eat(tt.questionDot)) { this.raise(this.state.start, Errors.OptionalChainingNoNew); } this.parseNewArguments(node); return this.finishNode(node, "NewExpression"); } parseNewArguments(node: N.NewExpression): void { if (this.eat(tt.parenL)) { const args = this.parseExprList(tt.parenR); this.toReferencedList(args); // $FlowFixMe (parseExprList should be all non-null in this case) node.arguments = args; } else { node.arguments = []; } } // Parse template expression. parseTemplateElement(isTagged: boolean): N.TemplateElement { const elem = this.startNode(); if (this.state.value === null) { if (!isTagged) { this.raise(this.state.start + 1, Errors.InvalidEscapeSequenceTemplate); } } elem.value = { raw: this.input .slice(this.state.start, this.state.end) .replace(/\r\n?/g, "\n"), cooked: this.state.value, }; this.next(); elem.tail = this.match(tt.backQuote); return this.finishNode(elem, "TemplateElement"); } // https://tc39.es/ecma262/#prod-TemplateLiteral parseTemplate(isTagged: boolean): N.TemplateLiteral { const node = this.startNode(); this.next(); node.expressions = []; let curElt = this.parseTemplateElement(isTagged); node.quasis = [curElt]; while (!curElt.tail) { this.expect(tt.dollarBraceL); node.expressions.push(this.parseTemplateSubstitution()); this.expect(tt.braceR); node.quasis.push((curElt = this.parseTemplateElement(isTagged))); } this.next(); return this.finishNode(node, "TemplateLiteral"); } // This is overwritten by the TypeScript plugin to parse template types parseTemplateSubstitution(): N.Expression { return this.parseExpression(); } // Parse an object literal, binding pattern, or record. parseObjectLike( close: TokenType, isPattern: boolean, isRecord?: ?boolean, refExpressionErrors?: ?ExpressionErrors, ): T { if (isRecord) { this.expectPlugin("recordAndTuple"); } const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = false; const propHash: any = Object.create(null); let first = true; const node = this.startNode(); node.properties = []; this.next(); while (!this.match(close)) { if (first) { first = false; } else { this.expect(tt.comma); if (this.match(close)) { this.addExtra(node, "trailingComma", this.state.lastTokStart); break; } } const prop = this.parsePropertyDefinition(isPattern, refExpressionErrors); if (!isPattern) { // $FlowIgnore RestElement will never be returned if !isPattern this.checkProto(prop, isRecord, propHash, refExpressionErrors); } if ( isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement" ) { this.raise(prop.start, Errors.InvalidRecordProperty); } // $FlowIgnore if (prop.shorthand) { this.addExtra(prop, "shorthand", true); } node.properties.push(prop); } // The tokenizer uses `braceIsBlock` to detect whether `{` starts a block statement. // If `{` is a block statement, `exprAllowed` will be `true`. // However the tokenizer can not handle edge cases like `0 ? a : { a : 1 } / 2`, here // we update `exprAllowed` when an object-like is parsed. this.state.exprAllowed = false; this.next(); this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; let type = "ObjectExpression"; if (isPattern) { type = "ObjectPattern"; } else if (isRecord) { type = "RecordExpression"; } return this.finishNode(node, type); } // Check grammar production: // IdentifierName *_opt PropertyName // It is used in `parsePropertyDefinition` to detect AsyncMethod and Accessors maybeAsyncOrAccessorProp(prop: N.ObjectProperty): boolean { return ( !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(tt.bracketL) || this.match(tt.star)) ); } // https://tc39.es/ecma262/#prod-PropertyDefinition parsePropertyDefinition( isPattern: boolean, refExpressionErrors?: ?ExpressionErrors, ): N.ObjectMember | N.SpreadElement | N.RestElement { let decorators = []; if (this.match(tt.at)) { if (this.hasPlugin("decorators")) { 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()); } } const prop = this.startNode(); let isGenerator = false; let isAsync = false; let isAccessor = false; let startPos; let startLoc; if (this.match(tt.ellipsis)) { if (decorators.length) this.unexpected(); if (isPattern) { this.next(); // Don't use parseRestBinding() as we only allow Identifier here. prop.argument = this.parseIdentifier(); this.checkCommaAfterRest(charCodes.rightCurlyBrace); return this.finishNode(prop, "RestElement"); } return this.parseSpread(); } if (decorators.length) { prop.decorators = decorators; decorators = []; } prop.method = false; if (isPattern || refExpressionErrors) { startPos = this.state.start; startLoc = this.state.startLoc; } if (!isPattern) { isGenerator = this.eat(tt.star); } const containsEsc = this.state.containsEsc; const key = this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); if ( !isPattern && !isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop) ) { const keyName = key.name; // https://tc39.es/ecma262/#prod-AsyncMethod // https://tc39.es/ecma262/#prod-AsyncGeneratorMethod if (keyName === "async" && !this.hasPrecedingLineBreak()) { isAsync = true; isGenerator = this.eat(tt.star); this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); } // get PropertyName[?Yield, ?Await] () { FunctionBody[~Yield, ~Await] } // set PropertyName[?Yield, ?Await] ( PropertySetParameterList ) { FunctionBody[~Yield, ~Await] } if (keyName === "get" || keyName === "set") { isAccessor = true; prop.kind = keyName; if (this.match(tt.star)) { isGenerator = true; this.raise(this.state.pos, Errors.AccessorIsGenerator, keyName); this.next(); } this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); } } this.parseObjPropValue( prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors, ); return prop; } getGetterSetterExpectedParamCount( method: N.ObjectMethod | N.ClassMethod, ): number { return method.kind === "get" ? 0 : 1; } // This exists so we can override within the ESTree plugin getObjectOrClassMethodParams(method: N.ObjectMethod | N.ClassMethod) { return method.params; } // get methods aren't allowed to have any parameters // set methods must have exactly 1 parameter which is not a rest parameter checkGetterSetterParams(method: N.ObjectMethod | N.ClassMethod): void { const paramCount = this.getGetterSetterExpectedParamCount(method); const params = this.getObjectOrClassMethodParams(method); const start = method.start; if (params.length !== paramCount) { if (method.kind === "get") { this.raise(start, Errors.BadGetterArity); } else { this.raise(start, Errors.BadSetterArity); } } if ( method.kind === "set" && params[params.length - 1]?.type === "RestElement" ) { this.raise(start, Errors.BadSetterRestParameter); } } // https://tc39.es/ecma262/#prod-MethodDefinition parseObjectMethod( prop: N.ObjectMethod, isGenerator: boolean, isAsync: boolean, isPattern: boolean, isAccessor: boolean, ): ?N.ObjectMethod { if (isAccessor) { // isAccessor implies isAsync: false, isPattern: false, isGenerator: false this.parseMethod( prop, // This _should_ be false, but with error recovery, we allow it to be // set for informational purposes isGenerator, /* isAsync */ false, /* isConstructor */ false, false, "ObjectMethod", ); this.checkGetterSetterParams(prop); return prop; } if (isAsync || isGenerator || this.match(tt.parenL)) { if (isPattern) this.unexpected(); prop.kind = "method"; prop.method = true; return this.parseMethod( prop, isGenerator, isAsync, /* isConstructor */ false, false, "ObjectMethod", ); } } // if `isPattern` is true, parse https://tc39.es/ecma262/#prod-BindingProperty // else https://tc39.es/ecma262/#prod-PropertyDefinition parseObjectProperty( prop: N.ObjectProperty, startPos: ?number, startLoc: ?Position, isPattern: boolean, refExpressionErrors: ?ExpressionErrors, ): ?N.ObjectProperty { prop.shorthand = false; if (this.eat(tt.colon)) { prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors); return this.finishNode(prop, "ObjectProperty"); } if (!prop.computed && prop.key.type === "Identifier") { // PropertyDefinition: // IdentifierReference // CoveredInitializedName // Note: `{ eval } = {}` will be checked in `checkLVal` later. this.checkReservedWord(prop.key.name, prop.key.start, true, false); if (isPattern) { prop.value = this.parseMaybeDefault( startPos, startLoc, prop.key.__clone(), ); } else if (this.match(tt.eq) && refExpressionErrors) { if (refExpressionErrors.shorthandAssign === -1) { refExpressionErrors.shorthandAssign = this.state.start; } prop.value = this.parseMaybeDefault( startPos, startLoc, prop.key.__clone(), ); } else { prop.value = prop.key.__clone(); } prop.shorthand = true; return this.finishNode(prop, "ObjectProperty"); } } parseObjPropValue( prop: any, startPos: ?number, startLoc: ?Position, isGenerator: boolean, isAsync: boolean, isPattern: boolean, isAccessor: boolean, refExpressionErrors?: ?ExpressionErrors, ): void { const node = this.parseObjectMethod( prop, isGenerator, isAsync, isPattern, isAccessor, ) || this.parseObjectProperty( prop, startPos, startLoc, isPattern, refExpressionErrors, ); if (!node) this.unexpected(); // $FlowFixMe return node; } parsePropertyName( prop: N.ObjectOrClassMember | N.ClassMember | N.TsNamedTypeElementBase, isPrivateNameAllowed: boolean, ): N.Expression | N.Identifier { if (this.eat(tt.bracketL)) { (prop: $FlowSubtype).computed = true; prop.key = this.parseMaybeAssignAllowIn(); this.expect(tt.bracketR); } else { const oldInPropertyName = this.state.inPropertyName; 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.bigint) || this.match(tt.decimal) ? this.parseExprAtom() : this.parseMaybePrivateName(isPrivateNameAllowed); if (!this.isPrivateName(prop.key)) { // ClassPrivateProperty is never computed, so we don't assign in that case. prop.computed = false; } this.state.inPropertyName = oldInPropertyName; } return prop.key; } // Initialize empty function node. initFunction(node: N.BodilessFunctionOrMethodBase, isAsync: ?boolean): void { node.id = null; node.generator = false; node.async = !!isAsync; } // Parse object or class method. parseMethod( node: T, isGenerator: boolean, isAsync: boolean, isConstructor: boolean, allowDirectSuper: boolean, type: string, inClassScope: boolean = false, ): T { this.initFunction(node, isAsync); node.generator = !!isGenerator; const allowModifiers = isConstructor; // For TypeScript parameter properties this.scope.enter( 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.parseFunctionBodyAndFinish(node, type, true); this.prodParam.exit(); this.scope.exit(); return node; } // parse an array literal or tuple literal // https://tc39.es/ecma262/#prod-ArrayLiteral // https://tc39.es/proposal-record-tuple/#prod-TupleLiteral parseArrayLike( close: TokenType, canBePattern: boolean, isTuple: boolean, refExpressionErrors: ?ExpressionErrors, ): N.ArrayExpression | N.TupleExpression { if (isTuple) { this.expectPlugin("recordAndTuple"); } const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = false; const node = this.startNode(); this.next(); node.elements = this.parseExprList( close, /* allowEmpty */ !isTuple, refExpressionErrors, node, ); this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; return this.finishNode( node, isTuple ? "TupleExpression" : "ArrayExpression", ); } // Parse arrow function expression. // If the parameters are provided, they will be converted to an // assignable list. parseArrowExpression( node: N.ArrowFunctionExpression, params: ?(N.Expression[]), isAsync: boolean, trailingCommaPos: ?number, ): N.ArrowFunctionExpression { this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW); let flags = functionFlags(isAsync, false); // ConciseBody and AsyncConciseBody inherit [In] if (!this.match(tt.bracketL) && this.prodParam.hasIn) { flags |= PARAM_IN; } this.prodParam.enter(flags); this.initFunction(node, isAsync); const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; if (params) { this.state.maybeInArrowParameters = true; this.setArrowFunctionParameters(node, params, trailingCommaPos); } this.state.maybeInArrowParameters = false; this.parseFunctionBody(node, true); this.prodParam.exit(); this.scope.exit(); this.state.maybeInArrowParameters = oldMaybeInArrowParameters; return this.finishNode(node, "ArrowFunctionExpression"); } setArrowFunctionParameters( node: N.ArrowFunctionExpression, params: N.Expression[], trailingCommaPos: ?number, ): void { node.params = this.toAssignableList(params, trailingCommaPos, false); } parseFunctionBodyAndFinish( node: N.BodilessFunctionOrMethodBase, type: string, isMethod?: boolean = false, ): void { // $FlowIgnore (node is not bodiless if we get here) this.parseFunctionBody(node, false, isMethod); this.finishNode(node, type); } // Parse function body and check parameters. parseFunctionBody( node: N.Function, allowExpression: ?boolean, isMethod?: boolean = false, ): void { const isExpression = allowExpression && !this.match(tt.braceL); this.expressionScope.enter(newExpressionScope()); if (isExpression) { // https://tc39.es/ecma262/#prod-ExpressionBody node.body = this.parseMaybeAssign(); this.checkParams(node, false, allowExpression, false); } else { 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 = []; // 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, "function name", BIND_OUTSIDE, undefined, undefined, strictModeChanged, ); } }, ); this.prodParam.exit(); this.expressionScope.exit(); this.state.labels = oldLabels; } } isSimpleParamList( params: $ReadOnlyArray, ): boolean { for (let i = 0, len = params.length; i < len; i++) { if (params[i].type !== "Identifier") return false; } return true; } checkParams( node: N.Function, allowDuplicates: boolean, // eslint-disable-next-line no-unused-vars isArrowFunction: ?boolean, strictModeChanged?: boolean = true, ): void { const checkClashes = new Set(); for (const param of node.params) { this.checkLVal( param, "function parameter list", BIND_VAR, allowDuplicates ? null : checkClashes, undefined, strictModeChanged, ); } } // Parses a comma-separated list of expressions, and returns them as // an array. `close` is the token type that ends the list, and // `allowEmpty` can be turned on to allow subsequent commas with // nothing in between them to be parsed as `null` (which is needed // for array literals). parseExprList( close: TokenType, allowEmpty?: boolean, refExpressionErrors?: ?ExpressionErrors, nodeForExtra?: ?N.Node, ): $ReadOnlyArray { const elts = []; let first = true; while (!this.eat(close)) { if (first) { first = false; } else { this.expect(tt.comma); if (this.match(close)) { if (nodeForExtra) { this.addExtra( nodeForExtra, "trailingComma", this.state.lastTokStart, ); } this.next(); break; } } elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors)); } return elts; } parseExprListItem( allowEmpty: ?boolean, refExpressionErrors?: ?ExpressionErrors, refNeedsArrowPos: ?Pos, allowPlaceholder: ?boolean, ): ?N.Expression { let elt; if (this.match(tt.comma)) { if (!allowEmpty) { this.raise(this.state.pos, Errors.UnexpectedToken, ","); } elt = null; } else if (this.match(tt.ellipsis)) { const spreadNodeStartPos = this.state.start; const spreadNodeStartLoc = this.state.startLoc; elt = this.parseParenItem( this.parseSpread(refExpressionErrors, refNeedsArrowPos), spreadNodeStartPos, spreadNodeStartLoc, ); } else if (this.match(tt.question)) { this.expectPlugin("partialApplication"); if (!allowPlaceholder) { this.raise(this.state.start, Errors.UnexpectedArgumentPlaceholder); } const node = this.startNode(); this.next(); elt = this.finishNode(node, "ArgumentPlaceholder"); } else { elt = this.parseMaybeAssignAllowIn( refExpressionErrors, this.parseParenItem, refNeedsArrowPos, ); } return elt; } // 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(); const name = this.parseIdentifierName(node.start, liberal); return this.createIdentifier(node, name); } createIdentifier(node: N.Identifier, name: string): N.Identifier { node.name = name; node.loc.identifierName = name; return this.finishNode(node, "Identifier"); } parseIdentifierName(pos: number, liberal?: boolean): string { let name: string; const { start, type } = this.state; if (type === tt.name) { name = this.state.value; } else if (type.keyword) { name = type.keyword; // `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. const curContext = this.curContext(); if ( (type === tt._class || type === tt._function) && (curContext === ct.functionStatement || curContext === ct.functionExpression) ) { this.state.context.pop(); } } else { throw this.unexpected(); } 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, start, !!type.keyword, false); } this.next(); return name; } checkReservedWord( word: string, startLoc: number, checkKeywords: boolean, isBinding: boolean, ): void { if (this.prodParam.hasYield && word === "yield") { this.raise(startLoc, Errors.YieldBindingIdentifier); return; } if (word === "await") { if (this.prodParam.hasAwait) { this.raise(startLoc, Errors.AwaitBindingIdentifier); return; } else { this.expressionScope.recordAsyncArrowParametersError( startLoc, Errors.AwaitBindingIdentifier, ); } } if ( this.scope.inClass && !this.scope.inNonArrowFunction && word === "arguments" ) { this.raise(startLoc, Errors.ArgumentsInClass); return; } if (checkKeywords && isKeyword(word)) { this.raise(startLoc, Errors.UnexpectedKeyword, word); return; } const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord; if (reservedTest(word, this.inModule)) { if (!this.prodParam.hasAwait && word === "await") { this.raise( startLoc, this.hasPlugin("topLevelAwait") ? Errors.AwaitNotInAsyncContext : Errors.AwaitNotInAsyncFunction, ); } else { this.raise(startLoc, Errors.UnexpectedReservedWord, word); } } } isAwaitAllowed(): boolean { if (this.prodParam.hasAwait) return true; if (this.options.allowAwaitOutsideFunction && !this.scope.inFunction) { return true; } return false; } // Parses await expression inside async function. parseAwait(): N.AwaitExpression { const node = this.startNode(); this.next(); this.expressionScope.recordParameterInitializerError( node.start, Errors.AwaitExpressionFormalParameter, ); 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(): N.YieldExpression { const node = this.startNode(); this.expressionScope.recordParameterInitializerError( node.start, Errors.YieldInParameter, ); this.next(); if ( this.match(tt.semi) || (!this.match(tt.star) && !this.state.type.startsExpr) || this.hasPrecedingLineBreak() ) { node.delegate = false; node.argument = null; } else { node.delegate = this.eat(tt.star); node.argument = this.parseMaybeAssign(); } return this.finishNode(node, "YieldExpression"); } // Validates a pipeline (for any of the pipeline Babylon plugins) at the point // of the infix operator `|>`. checkPipelineAtInfixOperator(left: N.Expression, leftStartPos: number) { if (this.getPluginOption("pipelineOperator", "proposal") === "smart") { if (left.type === "SequenceExpression") { // Ensure that the pipeline head is not a comma-delimited // sequence expression. this.raise(leftStartPos, Errors.PipelineHeadSequenceExpression); } } } parseSmartPipelineBody( childExpression: N.Expression, startPos: number, startLoc: Position, ): N.PipelineBody { this.checkSmartPipelineBodyEarlyErrors(childExpression, startPos); return this.parseSmartPipelineBodyInStyle( childExpression, startPos, startLoc, ); } checkSmartPipelineBodyEarlyErrors( childExpression: N.Expression, startPos: number, ): void { 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, Errors.PipelineBodyNoArrow); } else if (childExpression.type === "SequenceExpression") { this.raise(startPos, Errors.PipelineBodySequenceExpression); } } parseSmartPipelineBodyInStyle( childExpression: N.Expression, startPos: number, startLoc: Position, ): N.PipelineBody { const bodyNode = this.startNodeAt(startPos, startLoc); const isSimpleReference = this.isSimpleReference(childExpression); if (isSimpleReference) { bodyNode.callee = childExpression; } else { if (!this.topicReferenceWasUsedInCurrentTopicContext()) { this.raise(startPos, Errors.PipelineTopicUnused); } bodyNode.expression = childExpression; } return this.finishNode( bodyNode, isSimpleReference ? "PipelineBareFunction" : "PipelineTopicExpression", ); } isSimpleReference(expression: N.Expression): boolean { switch (expression.type) { case "MemberExpression": return ( !expression.computed && this.isSimpleReference(expression.object) ); case "Identifier": return true; default: return false; } } // Enable topic references from outer contexts within smart pipeline bodies. // The function modifies the parser's topic-context state to enable or disable // the use of topic references with the smartPipelines plugin. They then run a // callback, then they reset the parser to the old topic-context state that it // had before the function was called. withTopicPermittingContext(callback: () => T): T { const outerContextTopicState = this.state.topicContext; this.state.topicContext = { // Enable the use of the primary topic reference. maxNumOfResolvableTopics: 1, // Hide the use of any topic references from outer contexts. maxTopicIndex: null, }; try { return callback(); } finally { this.state.topicContext = outerContextTopicState; } } // Disable topic references from outer contexts within syntax constructs // such as the bodies of iteration statements. // The function modifies the parser's topic-context state to enable or disable // the use of topic references with the smartPipelines plugin. They then run a // callback, then they reset the parser to the old topic-context state that it // had before the function was called. withTopicForbiddingContext(callback: () => T): T { const outerContextTopicState = this.state.topicContext; this.state.topicContext = { // Disable the use of the primary topic reference. maxNumOfResolvableTopics: 0, // Hide the use of any topic references from outer contexts. maxTopicIndex: null, }; try { return callback(); } finally { this.state.topicContext = outerContextTopicState; } } withSoloAwaitPermittingContext(callback: () => T): T { const outerContextSoloAwaitState = this.state.soloAwait; this.state.soloAwait = true; try { return callback(); } finally { this.state.soloAwait = outerContextSoloAwaitState; } } allowInAnd(callback: () => T): T { const flags = this.prodParam.currentFlags(); const prodParamToSet = PARAM_IN & ~flags; if (prodParamToSet) { this.prodParam.enter(flags | PARAM_IN); try { return callback(); } finally { this.prodParam.exit(); } } return callback(); } disallowInAnd(callback: () => T): T { const flags = this.prodParam.currentFlags(); const prodParamToClear = PARAM_IN & flags; if (prodParamToClear) { this.prodParam.enter(flags & ~PARAM_IN); try { return callback(); } finally { this.prodParam.exit(); } } return callback(); } // Register the use of a primary topic reference (`#`) within the current // topic context. registerTopicReference(): void { this.state.topicContext.maxTopicIndex = 0; } primaryTopicReferenceIsAllowedInCurrentTopicContext(): boolean { return this.state.topicContext.maxNumOfResolvableTopics >= 1; } topicReferenceWasUsedInCurrentTopicContext(): boolean { return ( this.state.topicContext.maxTopicIndex != null && this.state.topicContext.maxTopicIndex >= 0 ); } parseFSharpPipelineBody(prec: number): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; this.state.potentialArrowAt = this.state.start; const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = true; const ret = this.parseExprOp( this.parseMaybeUnary(), startPos, startLoc, prec, ); this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; return ret; } } babel-7.12.12/packages/babel-parser/src/parser/index.js000066400000000000000000000044701377064615700226230ustar00rootroot00000000000000// @flow import type { Options } from "../options"; 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 ExpressionScopeHandler from "../util/expression-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); super(options, input); const ScopeHandler = this.getScopeHandler(); 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.expressionScope = new ExpressionScopeHandler(this.raise.bind(this)); this.plugins = pluginsMap(this.options.plugins); this.filename = options.sourceFilename; } // This can be overwritten, for example, by the TypeScript plugin. getScopeHandler(): Class> { return ScopeHandler; } 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(); file.errors = null; this.parseTopLevel(file, program); file.errors = this.state.errors; return file; } } function pluginsMap(plugins: PluginList): PluginsMap { const pluginMap: PluginsMap = new Map(); for (const plugin of plugins) { const [name, options] = Array.isArray(plugin) ? plugin : [plugin, {}]; if (!pluginMap.has(name)) pluginMap.set(name, options || {}); } return pluginMap; } babel-7.12.12/packages/babel-parser/src/parser/lval.js000066400000000000000000000406401377064615700224510ustar00rootroot00000000000000// @flow /*:: declare var invariant; */ import * as charCodes from "charcodes"; import { types as tt, type TokenType } from "../tokenizer/types"; import type { TSParameterProperty, Decorator, Expression, Node, Pattern, RestElement, SpreadElement, /*:: Identifier, */ /*:: ObjectExpression, */ /*:: ObjectPattern, */ } from "../types"; import type { Pos, Position } from "../util/location"; import { isStrictBindOnlyReservedWord, isStrictBindReservedWord, } from "../util/identifier"; import { NodeUtils } from "./node"; import { type BindingTypes, BIND_NONE } from "../util/scopeflags"; import { ExpressionErrors } from "./util"; import { Errors } from "./error"; const unwrapParenthesizedExpression = (node: 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; +parseMaybeAssignAllowIn: ( refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ) => Expression; +parseObjectLike: ( close: TokenType, isPattern: boolean, isRecord?: ?boolean, refExpressionErrors?: ?ExpressionErrors, ) => T; */ // Forward-declaration: defined in statement.js /*:: +parseDecorator: () => Decorator; */ /** * Convert existing expression atom to assignable pattern * if possible. Also checks invalid destructuring targets: - Parenthesized Destructuring patterns - RestElement is not the last element - Missing `=` in assignment pattern 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. * @param {Node} node The expression atom * @param {boolean} [isLHS=false] Whether we are parsing a LeftHandSideExpression. If isLHS is `true`, the following cases are allowed: `[(a)] = [0]`, `[(a.b)] = [0]` * @returns {Node} The converted assignable pattern * @memberof LValParser */ toAssignable(node: Node, isLHS: boolean = false): Node { let parenthesized = undefined; if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) { parenthesized = unwrapParenthesizedExpression(node); if (isLHS) { // an LHS can be reinterpreted to a binding pattern but not vice versa. // therefore a parenthesized identifier is ambiguous until we are sure it is an assignment expression // i.e. `([(a) = []] = []) => {}` // see also `recordParenthesizedIdentifierError` signature in packages/babel-parser/src/util/expression-scope.js if (parenthesized.type === "Identifier") { this.expressionScope.recordParenthesizedIdentifierError( node.start, Errors.InvalidParenthesizedAssignment, ); } else if (parenthesized.type !== "MemberExpression") { // A parenthesized member expression can be in LHS but not in pattern. // If the LHS is later interpreted as a pattern, `checkLVal` will throw for member expression binding // i.e. `([(a.b) = []] = []) => {}` this.raise(node.start, Errors.InvalidParenthesizedAssignment); } } else { this.raise(node.start, Errors.InvalidParenthesizedAssignment); } } 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, isLHS); if ( isLast && prop.type === "RestElement" && node.extra?.trailingComma ) { this.raiseRestNotLast(node.extra.trailingComma); } } break; case "ObjectProperty": this.toAssignable(node.value, isLHS); break; case "SpreadElement": { this.checkToRestConversion(node); node.type = "RestElement"; const arg = node.argument; this.toAssignable(arg, isLHS); break; } case "ArrayExpression": node.type = "ArrayPattern"; this.toAssignableList(node.elements, node.extra?.trailingComma, isLHS); break; case "AssignmentExpression": if (node.operator !== "=") { this.raise(node.left.end, Errors.MissingEqInAssignment); } node.type = "AssignmentPattern"; delete node.operator; this.toAssignable(node.left, isLHS); break; case "ParenthesizedExpression": /*::invariant (parenthesized !== undefined) */ this.toAssignable(parenthesized, isLHS); break; 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, isLast: boolean, isLHS: boolean, ) { if (prop.type === "ObjectMethod") { const error = prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod; /* eslint-disable @babel/development-internal/dry-error-messages */ this.raise(prop.key.start, error); /* eslint-enable @babel/development-internal/dry-error-messages */ } else if (prop.type === "SpreadElement" && !isLast) { this.raiseRestNotLast(prop.start); } else { this.toAssignable(prop, isLHS); } } // Convert list of expression atoms to binding list. toAssignableList( exprList: Expression[], trailingCommaPos?: ?number, isLHS: boolean, ): $ReadOnlyArray { let end = exprList.length; if (end) { const last = exprList[end - 1]; if (last?.type === "RestElement") { --end; } else if (last?.type === "SpreadElement") { last.type = "RestElement"; let arg = last.argument; this.toAssignable(arg, isLHS); arg = unwrapParenthesizedExpression(arg); if ( arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern" && arg.type !== "ObjectPattern" ) { 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, isLHS); if (elt.type === "RestElement") { this.raiseRestNotLast(elt.start); } } } return exprList; } // Convert list of expression atoms to a list of toReferencedList( exprList: $ReadOnlyArray, isParenthesizedExpr?: boolean, // eslint-disable-line no-unused-vars ): $ReadOnlyArray { return exprList; } toReferencedListDeep( exprList: $ReadOnlyArray, isParenthesizedExpr?: boolean, ): void { this.toReferencedList(exprList, isParenthesizedExpr); for (const expr of exprList) { if (expr?.type === "ArrayExpression") { this.toReferencedListDeep(expr.elements); } } } // Parses spread element. parseSpread( refExpressionErrors: ?ExpressionErrors, refNeedsArrowPos?: ?Pos, ): SpreadElement { const node = this.startNode(); this.next(); node.argument = this.parseMaybeAssignAllowIn( refExpressionErrors, undefined, refNeedsArrowPos, ); return this.finishNode(node, "SpreadElement"); } // https://tc39.es/ecma262/#prod-BindingRestProperty // https://tc39.es/ecma262/#prod-BindingRestElement parseRestBinding(): RestElement { const node = this.startNode(); this.next(); // eat `...` node.argument = this.parseBindingAtom(); return this.finishNode(node, "RestElement"); } // Parses lvalue (assignable) atom. parseBindingAtom(): Pattern { // https://tc39.es/ecma262/#prod-BindingPattern switch (this.state.type) { case tt.bracketL: { const node = this.startNode(); this.next(); node.elements = this.parseBindingList( tt.bracketR, charCodes.rightSquareBracket, true, ); return this.finishNode(node, "ArrayPattern"); } case tt.braceL: return this.parseObjectLike(tt.braceR, true); } // https://tc39.es/ecma262/#prod-BindingIdentifier return this.parseIdentifier(); } // https://tc39.es/ecma262/#prod-BindingElementList parseBindingList( close: TokenType, closeCharCode: $Values, allowEmpty?: boolean, allowModifiers?: boolean, ): $ReadOnlyArray { const elts: Array = []; let first = true; while (!this.eat(close)) { if (first) { first = false; } else { this.expect(tt.comma); } if (allowEmpty && this.match(tt.comma)) { // $FlowFixMe This method returns `$ReadOnlyArray` if `allowEmpty` is set. elts.push(null); } else if (this.eat(close)) { break; } else if (this.match(tt.ellipsis)) { elts.push(this.parseAssignableListItemTypes(this.parseRestBinding())); this.checkCommaAfterRest(closeCharCode); this.expect(close); break; } else { const decorators = []; if (this.match(tt.at) && this.hasPlugin("decorators")) { this.raise(this.state.start, Errors.UnsupportedParameterDecorator); } // invariant: hasPlugin("decorators-legacy") while (this.match(tt.at)) { decorators.push(this.parseDecorator()); } elts.push(this.parseAssignableListItem(allowModifiers, decorators)); } } return elts; } parseAssignableListItem( allowModifiers: ?boolean, decorators: Decorator[], ): Pattern | TSParameterProperty { const left = this.parseMaybeDefault(); this.parseAssignableListItemTypes(left); const elt = this.parseMaybeDefault(left.start, left.loc.start, left); if (decorators.length) { left.decorators = decorators; } return elt; } // Used by flow/typescript plugin to add type annotations to binding elements parseAssignableListItemTypes(param: Pattern): Pattern { return param; } // Parses assignment pattern around given atom if possible. // https://tc39.es/ecma262/#prod-BindingElement parseMaybeDefault( startPos?: ?number, startLoc?: ?Position, left?: ?Pattern, ): Pattern { startLoc = startLoc ?? this.state.startLoc; startPos = startPos ?? this.state.start; // $FlowIgnore left = left ?? this.parseBindingAtom(); if (!this.eat(tt.eq)) return left; const node = this.startNodeAt(startPos, startLoc); node.left = left; node.right = this.parseMaybeAssignAllowIn(); return this.finishNode(node, "AssignmentPattern"); } /** * Verify that if a node is an lval - something that can be assigned to. * * @param {Expression} expr The given node * @param {string} contextDescription The auxiliary context information printed when error is thrown * @param {BindingTypes} [bindingType=BIND_NONE] The desired binding type. If the given node is an identifier and `bindingType` is not BIND_NONE, `checkLVal` will register binding to the parser scope See also src/util/scopeflags.js * @param {?Set} checkClashes An optional string set to check if an identifier name is included. `checkLVal` will add checked identifier name to `checkClashes` It is used in tracking duplicates in function parameter lists. If it is nullish, `checkLVal` will skip duplicate checks * @param {boolean} [disallowLetBinding] Whether an identifier named "let" should be disallowed * @param {boolean} [strictModeChanged=false] Whether an identifier has been parsed in a sloppy context but should be reinterpreted as strict-mode. e.g. `(arguments) => { "use strict "}` * @memberof LValParser */ checkLVal( expr: Expression, contextDescription: string, bindingType: BindingTypes = BIND_NONE, checkClashes: ?Set, disallowLetBinding?: boolean, strictModeChanged?: boolean = false, ): void { switch (expr.type) { case "Identifier": { const { name } = expr; if ( this.state.strict && // "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(name, this.inModule) : isStrictBindOnlyReservedWord(name)) ) { this.raise( expr.start, bindingType === BIND_NONE ? Errors.StrictEvalArguments : Errors.StrictEvalArgumentsBinding, name, ); } if (checkClashes) { if (checkClashes.has(name)) { this.raise(expr.start, Errors.ParamDupe); } else { checkClashes.add(name); } } if (disallowLetBinding && name === "let") { this.raise(expr.start, Errors.LetInLexicalBinding); } if (!(bindingType & BIND_NONE)) { this.scope.declareName(name, bindingType, expr.start); } break; } case "MemberExpression": if (bindingType !== BIND_NONE) { this.raise(expr.start, Errors.InvalidPropertyBindingPattern); } break; case "ObjectPattern": for (let prop of expr.properties) { if (this.isObjectProperty(prop)) 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 (this.isObjectMethod(prop)) continue; this.checkLVal( prop, "object destructuring pattern", bindingType, checkClashes, disallowLetBinding, ); } break; case "ArrayPattern": for (const elem of expr.elements) { if (elem) { this.checkLVal( elem, "array destructuring pattern", bindingType, checkClashes, disallowLetBinding, ); } } break; case "AssignmentPattern": this.checkLVal( expr.left, "assignment pattern", bindingType, checkClashes, ); break; case "RestElement": this.checkLVal( expr.argument, "rest element", bindingType, checkClashes, ); break; case "ParenthesizedExpression": this.checkLVal( expr.expression, "parenthesized expression", bindingType, checkClashes, ); break; default: { this.raise( expr.start, bindingType === BIND_NONE ? Errors.InvalidLhs : Errors.InvalidLhsBinding, contextDescription, ); } } } checkToRestConversion(node: SpreadElement): void { if ( node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression" ) { this.raise(node.argument.start, Errors.InvalidRestAssignmentPattern); } } checkCommaAfterRest(close: $Values): void { if (this.match(tt.comma)) { if (this.lookaheadCharCode() === close) { this.raiseTrailingCommaAfterRest(this.state.start); } else { this.raiseRestNotLast(this.state.start); } } } raiseRestNotLast(pos: number) { throw this.raise(pos, Errors.ElementAfterRest); } raiseTrailingCommaAfterRest(pos: number) { this.raise(pos, Errors.RestTrailingComma); } } babel-7.12.12/packages/babel-parser/src/parser/node.js000066400000000000000000000062571377064615700224460ustar00rootroot00000000000000// @flow import type Parser from "./index"; import UtilParser from "./util"; import { SourceLocation, type Position } from "../util/location"; import type { Comment, Node as NodeType, NodeBase } from "../types"; // Start an AST node, attaching a start offset. class Node implements NodeBase { constructor(parser: Parser, pos: number, loc: Position) { this.type = ""; this.start = pos; this.end = 0; this.loc = new SourceLocation(loc); if (parser?.options.ranges) this.range = [pos, 0]; if (parser?.filename) this.loc.filename = parser.filename; } type: string; start: number; end: number; loc: SourceLocation; range: [number, number]; leadingComments: Array; trailingComments: Array; innerComments: Array; extra: { [key: string]: any }; __clone(): this { // $FlowIgnore const newNode: any = new Node(); const keys = Object.keys(this); for (let i = 0, length = keys.length; i < length; i++) { const key = keys[i]; // Do not clone comments that are already attached to the node if ( key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments" ) { // $FlowIgnore newNode[key] = this[key]; } } return newNode; } } export class NodeUtils extends UtilParser { startNode(): T { // $FlowIgnore return new Node(this, this.state.start, this.state.startLoc); } startNodeAt(pos: number, loc: Position): T { // $FlowIgnore return new Node(this, pos, loc); } /** Start a new node with a previous node's location. */ startNodeAtNode(type: NodeType): T { return this.startNodeAt(type.start, type.loc.start); } // Finish an AST node, adding `type` and `end` properties. finishNode(node: T, type: string): T { return this.finishNodeAt( node, type, this.state.lastTokEnd, this.state.lastTokEndLoc, ); } // Finish node at given position finishNodeAt( node: T, type: string, pos: number, loc: Position, ): T { if (process.env.NODE_ENV !== "production" && node.end > 0) { throw new Error( "Do not call finishNode*() twice on the same node." + " Instead use resetEndLocation() or change type directly.", ); } node.type = type; node.end = pos; node.loc.end = loc; if (this.options.ranges) node.range[1] = pos; this.processComment(node); return node; } resetStartLocation(node: NodeBase, start: number, startLoc: Position): void { node.start = start; node.loc.start = startLoc; if (this.options.ranges) node.range[0] = start; } resetEndLocation( node: NodeBase, end?: number = this.state.lastTokEnd, endLoc?: Position = this.state.lastTokEndLoc, ): void { node.end = end; node.loc.end = endLoc; if (this.options.ranges) node.range[1] = end; } /** * Reset the start location of node to the start location of locationNode */ resetStartLocationFromNode(node: NodeBase, locationNode: NodeBase): void { this.resetStartLocation(node, locationNode.start, locationNode.loc.start); } } babel-7.12.12/packages/babel-parser/src/parser/statement.js000066400000000000000000002115111377064615700235140ustar00rootroot00000000000000// @flow import * as N from "../types"; import { types as tt, type TokenType } from "../tokenizer/types"; import ExpressionParser from "./expression"; import { Errors } from "./error"; import { isIdentifierChar, isIdentifierStart, keywordRelationalOperator, } from "../util/identifier"; import { lineBreak } from "../util/whitespace"; import * as charCodes from "charcodes"; import { BIND_CLASS, BIND_LEXICAL, BIND_VAR, BIND_FUNCTION, 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"; import { newExpressionScope, newParameterDeclarationScope, } from "../util/expression-scope"; const loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" }; const FUNC_NO_FLAGS = 0b000, FUNC_STATEMENT = 0b001, FUNC_HANGING_STATEMENT = 0b010, FUNC_NULLABLE_ID = 0b100; const loneSurrogate = /[\uD800-\uDFFF]/u; export default class StatementParser extends ExpressionParser { // ### Statement parsing // Parse a program. Initializes the parser, reads any number of // statements, and wraps them in a Program node. Optionally takes a // `program` argument. If present, the statements will be appended // to its body instead of creating a new node. parseTopLevel(file: N.File, program: N.Program): N.File { program.sourceType = this.options.sourceType; program.interpreter = this.parseInterpreterDirective(); this.parseBlockBody(program, true, true, tt.eof); if ( this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0 ) { for (const [name] of Array.from(this.scope.undefinedExports)) { const pos = this.scope.undefinedExports.get(name); // $FlowIssue this.raise(pos, Errors.ModuleExportUndefined, name); } } file.program = this.finishNode(program, "Program"); file.comments = this.state.comments; if (this.options.tokens) file.tokens = this.tokens; return this.finishNode(file, "File"); } // TODO stmtToDirective(stmt: N.Statement): N.Directive { const expr = stmt.expression; const directiveLiteral = this.startNodeAt(expr.start, expr.loc.start); const directive = this.startNodeAt(stmt.start, stmt.loc.start); const raw = this.input.slice(expr.start, expr.end); const val = (directiveLiteral.value = raw.slice(1, -1)); // remove quotes this.addExtra(directiveLiteral, "raw", raw); this.addExtra(directiveLiteral, "rawValue", val); directive.value = this.finishNodeAt( directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end, ); return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end); } parseInterpreterDirective(): N.InterpreterDirective | null { if (!this.match(tt.interpreterDirective)) { return null; } const node = this.startNode(); node.value = this.state.value; this.next(); return this.finishNode(node, "InterpreterDirective"); } isLet(context: ?string): boolean { if (!this.isContextual("let")) { return false; } 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 // is allowed. However, `let [` is an explicit negative lookahead for // ExpressionStatement, so special-case it first. if (nextCh === charCodes.leftSquareBracket) return true; if (context) return false; if (nextCh === charCodes.leftCurlyBrace) return true; if (isIdentifierStart(nextCh)) { let pos = next + 1; while (isIdentifierChar(this.input.charCodeAt(pos))) { ++pos; } const ident = this.input.slice(next, pos); if (!keywordRelationalOperator.test(ident)) return true; } return false; } // Parse a single statement. // // If expecting a statement and finding a slash operator, parse a // regular expression literal. This is to handle cases like // `if (foo) /blah/.exec(foo)`, where looking at the previous token // does not help. // https://tc39.es/ecma262/#prod-Statement // ImportDeclaration and ExportDeclaration are also handled here so we can throw recoverable errors // when they are not at the top level parseStatement(context: ?string, topLevel?: boolean): N.Statement { if (this.match(tt.at)) { this.parseDecorators(true); } return this.parseStatementContent(context, topLevel); } parseStatementContent(context: ?string, topLevel: ?boolean): N.Statement { let starttype = this.state.type; const node = this.startNode(); let kind; if (this.isLet(context)) { starttype = tt._var; kind = "let"; } // Most types of statements are recognized by the keyword they // start with. Many are trivial to parse, some require a bit of // complexity. switch (starttype) { case tt._break: case tt._continue: // $FlowFixMe return this.parseBreakContinueStatement(node, starttype.keyword); case tt._debugger: return this.parseDebuggerStatement(node); case tt._do: return this.parseDoStatement(node); case tt._for: return this.parseForStatement(node); case tt._function: if (this.lookaheadCharCode() === charCodes.dot) break; if (context) { if (this.state.strict) { this.raise(this.state.start, Errors.StrictFunction); } else if (context !== "if" && context !== "label") { this.raise(this.state.start, Errors.SloppyFunction); } } return this.parseFunctionStatement(node, false, !context); case tt._class: if (context) this.unexpected(); return this.parseClass(node, true); case tt._if: return this.parseIfStatement(node); case tt._return: return this.parseReturnStatement(node); case tt._switch: return this.parseSwitchStatement(node); case tt._throw: return this.parseThrowStatement(node); case tt._try: return this.parseTryStatement(node); case tt._const: case tt._var: kind = kind || this.state.value; if (context && kind !== "var") { this.raise(this.state.start, Errors.UnexpectedLexicalDeclaration); } return this.parseVarStatement(node, kind); case tt._while: return this.parseWhileStatement(node); case tt._with: return this.parseWithStatement(node); case tt.braceL: return this.parseBlock(); case tt.semi: return this.parseEmptyStatement(node); case tt._import: { const nextTokenCharCode = this.lookaheadCharCode(); if ( nextTokenCharCode === charCodes.leftParenthesis || // import() nextTokenCharCode === charCodes.dot // import.meta ) { break; } } // fall through case tt._export: { if (!this.options.allowImportExportEverywhere && !topLevel) { this.raise(this.state.start, Errors.UnexpectedImportExport); } this.next(); // eat `import`/`export` let result; if (starttype === tt._import) { result = this.parseImport(node); if ( result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value") ) { this.sawUnambiguousESM = true; } } else { result = this.parseExport(node); if ( (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value")) || (result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value")) || result.type === "ExportDefaultDeclaration" ) { this.sawUnambiguousESM = true; } } this.assertModuleNodeAllowed(node); return result; } default: { if (this.isAsyncFunction()) { if (context) { this.raise( this.state.start, Errors.AsyncFunctionInSingleStatementContext, ); } this.next(); return this.parseFunctionStatement(node, true, !context); } } } // If the statement does not start with a statement keyword or a // brace, it's an ExpressionStatement or LabeledStatement. We // simply start parsing an expression, and afterwards, if the // next token is a colon and the expression was a simple // Identifier node, we switch to interpreting it as a label. const maybeName = this.state.value; const expr = this.parseExpression(); if ( starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon) ) { return this.parseLabeledStatement(node, maybeName, expr, context); } else { return this.parseExpressionStatement(node, expr); } } assertModuleNodeAllowed(node: N.Node): void { if (!this.options.allowImportExportEverywhere && !this.inModule) { this.raiseWithData( node.start, { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED", }, Errors.ImportOutsideModule, ); } } takeDecorators(node: N.HasDecorators): void { const decorators = this.state.decoratorStack[ this.state.decoratorStack.length - 1 ]; if (decorators.length) { node.decorators = decorators; this.resetStartLocationFromNode(node, decorators[0]); this.state.decoratorStack[this.state.decoratorStack.length - 1] = []; } } canHaveLeadingDecorator(): boolean { return this.match(tt._class); } parseDecorators(allowExport?: boolean): void { const currentContextDecorators = this.state.decoratorStack[ this.state.decoratorStack.length - 1 ]; while (this.match(tt.at)) { const decorator = this.parseDecorator(); currentContextDecorators.push(decorator); } if (this.match(tt._export)) { if (!allowExport) { this.unexpected(); } if ( this.hasPlugin("decorators") && !this.getPluginOption("decorators", "decoratorsBeforeExport") ) { this.raise(this.state.start, Errors.DecoratorExportClass); } } else if (!this.canHaveLeadingDecorator()) { throw this.raise(this.state.start, Errors.UnexpectedLeadingDecorator); } } parseDecorator(): N.Decorator { this.expectOnePlugin(["decorators-legacy", "decorators"]); const node = this.startNode(); this.next(); if (this.hasPlugin("decorators")) { // Every time a decorator class expression is evaluated, a new empty array is pushed onto the stack // So that the decorators of any nested class expressions will be dealt with separately this.state.decoratorStack.push([]); const startPos = this.state.start; const startLoc = this.state.startLoc; let expr: N.Expression; if (this.eat(tt.parenL)) { expr = this.parseExpression(); this.expect(tt.parenR); } else { expr = this.parseIdentifier(false); while (this.eat(tt.dot)) { const node = this.startNodeAt(startPos, startLoc); node.object = expr; node.property = this.parseIdentifier(true); node.computed = false; expr = this.finishNode(node, "MemberExpression"); } } node.expression = this.parseMaybeDecoratorArguments(expr); this.state.decoratorStack.pop(); } else { node.expression = this.parseExprSubscripts(); } return this.finishNode(node, "Decorator"); } parseMaybeDecoratorArguments(expr: N.Expression): N.Expression { if (this.eat(tt.parenL)) { const node = this.startNodeAtNode(expr); node.callee = expr; node.arguments = this.parseCallExpressionArguments(tt.parenR, false); this.toReferencedList(node.arguments); return this.finishNode(node, "CallExpression"); } return expr; } parseBreakContinueStatement( node: N.BreakStatement | N.ContinueStatement, keyword: string, ): N.BreakStatement | N.ContinueStatement { const isBreak = keyword === "break"; this.next(); if (this.isLineTerminator()) { node.label = null; } else { node.label = this.parseIdentifier(); this.semicolon(); } this.verifyBreakContinue(node, keyword); return this.finishNode( node, isBreak ? "BreakStatement" : "ContinueStatement", ); } verifyBreakContinue( node: N.BreakStatement | N.ContinueStatement, keyword: string, ) { const isBreak = keyword === "break"; let i; for (i = 0; i < this.state.labels.length; ++i) { const lab = this.state.labels[i]; if (node.label == null || lab.name === node.label.name) { if (lab.kind != null && (isBreak || lab.kind === "loop")) break; if (node.label && isBreak) break; } } if (i === this.state.labels.length) { this.raise(node.start, Errors.IllegalBreakContinue, keyword); } } parseDebuggerStatement(node: N.DebuggerStatement): N.DebuggerStatement { this.next(); this.semicolon(); return this.finishNode(node, "DebuggerStatement"); } parseHeaderExpression(): N.Expression { this.expect(tt.parenL); const val = this.parseExpression(); this.expect(tt.parenR); return val; } parseDoStatement(node: N.DoWhileStatement): N.DoWhileStatement { this.next(); this.state.labels.push(loopLabel); node.body = // For the smartPipelines plugin: Disable topic references from outer // contexts within the loop body. They are permitted in test expressions, // outside of the loop body. this.withTopicForbiddingContext(() => // Parse the loop body's body. this.parseStatement("do"), ); this.state.labels.pop(); this.expect(tt._while); node.test = this.parseHeaderExpression(); this.eat(tt.semi); return this.finishNode(node, "DoWhileStatement"); } // Disambiguating between a `for` and a `for`/`in` or `for`/`of` // loop is non-trivial. Basically, we have to parse the init `var` // statement or expression, disallowing the `in` operator (see // the second parameter to `parseExpression`), and then check // whether the next token is `in` or `of`. When there is no init // part (semicolon immediately after the opening parenthesis), it // is a regular `for` loop. parseForStatement(node: N.Node): N.ForLike { this.next(); this.state.labels.push(loopLabel); let awaitAt = -1; if (this.isAwaitAllowed() && this.eatContextual("await")) { awaitAt = this.state.lastTokStart; } this.scope.enter(SCOPE_OTHER); this.expect(tt.parenL); if (this.match(tt.semi)) { if (awaitAt > -1) { this.unexpected(awaitAt); } return this.parseFor(node, null); } const isLet = this.isLet(); if (this.match(tt._var) || this.match(tt._const) || isLet) { const init = this.startNode(); const kind = isLet ? "let" : this.state.value; this.next(); this.parseVar(init, true, kind); this.finishNode(init, "VariableDeclaration"); if ( (this.match(tt._in) || this.isContextual("of")) && init.declarations.length === 1 ) { return this.parseForIn(node, init, awaitAt); } if (awaitAt > -1) { this.unexpected(awaitAt); } return this.parseFor(node, init); } const refExpressionErrors = new ExpressionErrors(); const init = this.parseExpression(true, refExpressionErrors); if (this.match(tt._in) || this.isContextual("of")) { this.toAssignable(init, /* isLHS */ true); const description = this.isContextual("of") ? "for-of statement" : "for-in statement"; this.checkLVal(init, description); return this.parseForIn(node, init, awaitAt); } else { this.checkExpressionErrors(refExpressionErrors, true); } if (awaitAt > -1) { this.unexpected(awaitAt); } return this.parseFor(node, init); } parseFunctionStatement( node: N.FunctionDeclaration, isAsync?: boolean, declarationPosition?: boolean, ): N.FunctionDeclaration { this.next(); return this.parseFunction( node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), isAsync, ); } parseIfStatement(node: N.IfStatement): N.IfStatement { this.next(); node.test = this.parseHeaderExpression(); node.consequent = this.parseStatement("if"); node.alternate = this.eat(tt._else) ? this.parseStatement("if") : null; return this.finishNode(node, "IfStatement"); } parseReturnStatement(node: N.ReturnStatement): N.ReturnStatement { if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) { this.raise(this.state.start, Errors.IllegalReturn); } this.next(); // In `return` (and `break`/`continue`), the keywords with // optional arguments, we eagerly look for a semicolon or the // possibility to insert one. if (this.isLineTerminator()) { node.argument = null; } else { node.argument = this.parseExpression(); this.semicolon(); } return this.finishNode(node, "ReturnStatement"); } parseSwitchStatement(node: N.SwitchStatement): N.SwitchStatement { this.next(); node.discriminant = this.parseHeaderExpression(); const cases = (node.cases = []); this.expect(tt.braceL); this.state.labels.push(switchLabel); this.scope.enter(SCOPE_OTHER); // Statements under must be grouped (by label) in SwitchCase // nodes. `cur` is used to keep the node that we are currently // adding statements to. let cur; for (let sawDefault; !this.match(tt.braceR); ) { if (this.match(tt._case) || this.match(tt._default)) { const isCase = this.match(tt._case); if (cur) this.finishNode(cur, "SwitchCase"); cases.push((cur = this.startNode())); cur.consequent = []; this.next(); if (isCase) { cur.test = this.parseExpression(); } else { if (sawDefault) { this.raise( this.state.lastTokStart, Errors.MultipleDefaultsInSwitch, ); } sawDefault = true; cur.test = null; } this.expect(tt.colon); } else { if (cur) { cur.consequent.push(this.parseStatement(null)); } else { this.unexpected(); } } } this.scope.exit(); if (cur) this.finishNode(cur, "SwitchCase"); this.next(); // Closing brace this.state.labels.pop(); return this.finishNode(node, "SwitchStatement"); } parseThrowStatement(node: N.ThrowStatement): N.ThrowStatement { this.next(); if (this.hasPrecedingLineBreak()) { this.raise(this.state.lastTokEnd, Errors.NewlineAfterThrow); } node.argument = this.parseExpression(); this.semicolon(); return this.finishNode(node, "ThrowStatement"); } parseCatchClauseParam(): N.Pattern { const param = this.parseBindingAtom(); const simple = param.type === "Identifier"; this.scope.enter(simple ? SCOPE_SIMPLE_CATCH : 0); this.checkLVal(param, "catch clause", BIND_LEXICAL); return param; } parseTryStatement(node: N.TryStatement): N.TryStatement { this.next(); node.block = this.parseBlock(); node.handler = null; if (this.match(tt._catch)) { const clause = this.startNode(); this.next(); if (this.match(tt.parenL)) { this.expect(tt.parenL); clause.param = this.parseCatchClauseParam(); this.expect(tt.parenR); } else { clause.param = null; this.scope.enter(SCOPE_OTHER); } clause.body = // For the smartPipelines plugin: Disable topic references from outer // contexts within the catch clause's body. this.withTopicForbiddingContext(() => // Parse the catch clause's body. this.parseBlock(false, false), ); this.scope.exit(); node.handler = this.finishNode(clause, "CatchClause"); } node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null; if (!node.handler && !node.finalizer) { this.raise(node.start, Errors.NoCatchOrFinally); } return this.finishNode(node, "TryStatement"); } parseVarStatement( node: N.VariableDeclaration, kind: "var" | "let" | "const", ): N.VariableDeclaration { this.next(); this.parseVar(node, false, kind); this.semicolon(); return this.finishNode(node, "VariableDeclaration"); } parseWhileStatement(node: N.WhileStatement): N.WhileStatement { this.next(); node.test = this.parseHeaderExpression(); this.state.labels.push(loopLabel); node.body = // For the smartPipelines plugin: // Disable topic references from outer contexts within the loop body. // They are permitted in test expressions, outside of the loop body. this.withTopicForbiddingContext(() => // Parse loop body. this.parseStatement("while"), ); this.state.labels.pop(); return this.finishNode(node, "WhileStatement"); } parseWithStatement(node: N.WithStatement): N.WithStatement { if (this.state.strict) { this.raise(this.state.start, Errors.StrictWith); } this.next(); node.object = this.parseHeaderExpression(); node.body = // For the smartPipelines plugin: // Disable topic references from outer contexts within the with statement's body. // They are permitted in function default-parameter expressions, which are // part of the outer context, outside of the with statement's body. this.withTopicForbiddingContext(() => // Parse the statement body. this.parseStatement("with"), ); return this.finishNode(node, "WithStatement"); } parseEmptyStatement(node: N.EmptyStatement): N.EmptyStatement { this.next(); return this.finishNode(node, "EmptyStatement"); } parseLabeledStatement( node: N.LabeledStatement, maybeName: string, expr: N.Identifier, context: ?string, ): N.LabeledStatement { for (const label of this.state.labels) { if (label.name === maybeName) { this.raise(expr.start, Errors.LabelRedeclaration, maybeName); } } const kind = this.state.type.isLoop ? "loop" : this.match(tt._switch) ? "switch" : null; for (let i = this.state.labels.length - 1; i >= 0; i--) { const label = this.state.labels[i]; if (label.statementStart === node.start) { label.statementStart = this.state.start; label.kind = kind; } else { break; } } this.state.labels.push({ name: maybeName, kind: kind, statementStart: this.state.start, }); node.body = this.parseStatement( context ? context.indexOf("label") === -1 ? context + "label" : context : "label", ); this.state.labels.pop(); node.label = expr; return this.finishNode(node, "LabeledStatement"); } parseExpressionStatement( node: N.ExpressionStatement, expr: N.Expression, ): N.Statement { node.expression = expr; this.semicolon(); return this.finishNode(node, "ExpressionStatement"); } // Parse a semicolon-enclosed block of statements, handling `"use // strict"` declarations when `allowDirectives` is true (used for // function bodies). parseBlock( allowDirectives?: boolean = false, createNewLexicalScope?: boolean = true, afterBlockParse?: (hasStrictModeDirective: boolean) => void, ): N.BlockStatement { const node = this.startNode(); if (allowDirectives) { this.state.strictErrors.clear(); } this.expect(tt.braceL); if (createNewLexicalScope) { this.scope.enter(SCOPE_OTHER); } this.parseBlockBody( node, allowDirectives, false, tt.braceR, afterBlockParse, ); if (createNewLexicalScope) { this.scope.exit(); } return this.finishNode(node, "BlockStatement"); } isValidDirective(stmt: N.Statement): boolean { return ( stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized ); } parseBlockBody( node: N.BlockStatementLike, allowDirectives: ?boolean, topLevel: boolean, end: TokenType, afterBlockParse?: (hasStrictModeDirective: boolean) => void, ): void { const body = (node.body = []); const directives = (node.directives = []); this.parseBlockOrModuleBlockBody( body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse, ); } // Undefined directives means that directives are not allowed. // https://tc39.es/ecma262/#prod-Block // https://tc39.es/ecma262/#prod-ModuleBody parseBlockOrModuleBlockBody( body: N.Statement[], directives: ?(N.Directive[]), topLevel: boolean, end: TokenType, afterBlockParse?: (hasStrictModeDirective: boolean) => void, ): void { const oldStrict = this.state.strict; let hasStrictModeDirective = false; let parsedNonDirective = false; while (!this.match(end)) { const stmt = this.parseStatement(null, topLevel); if (directives && !parsedNonDirective) { if (this.isValidDirective(stmt)) { const directive = this.stmtToDirective(stmt); directives.push(directive); if ( !hasStrictModeDirective && directive.value.value === "use strict" ) { hasStrictModeDirective = true; this.setStrict(true); } continue; } parsedNonDirective = true; // clear strict errors since the strict mode will not change within the block this.state.strictErrors.clear(); } body.push(stmt); } if (afterBlockParse) { afterBlockParse.call(this, hasStrictModeDirective); } if (!oldStrict) { this.setStrict(false); } this.next(); } // Parse a regular `for` loop. The disambiguation code in // `parseStatement` will already have parsed the init statement or // expression. parseFor( node: N.ForStatement, init: ?(N.VariableDeclaration | N.Expression), ): N.ForStatement { node.init = init; this.expect(tt.semi); node.test = this.match(tt.semi) ? null : this.parseExpression(); this.expect(tt.semi); node.update = this.match(tt.parenR) ? null : this.parseExpression(); this.expect(tt.parenR); node.body = // For the smartPipelines plugin: Disable topic references from outer // contexts within the loop body. They are permitted in test expressions, // outside of the loop body. this.withTopicForbiddingContext(() => // Parse the loop body. this.parseStatement("for"), ); this.scope.exit(); this.state.labels.pop(); return this.finishNode(node, "ForStatement"); } // Parse a `for`/`in` and `for`/`of` loop, which are almost // same from parser's perspective. parseForIn( node: N.ForInOf, init: N.VariableDeclaration | N.AssignmentPattern, awaitAt: number, ): N.ForInOf { const isForIn = this.match(tt._in); this.next(); if (isForIn) { if (awaitAt > -1) this.unexpected(awaitAt); } else { node.await = awaitAt > -1; } if ( init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier") ) { this.raise( init.start, Errors.ForInOfLoopInitializer, isForIn ? "for-in" : "for-of", ); } else if (init.type === "AssignmentPattern") { this.raise(init.start, Errors.InvalidLhs, "for-loop"); } node.left = init; node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn(); this.expect(tt.parenR); node.body = // For the smartPipelines plugin: // Disable topic references from outer contexts within the loop body. // They are permitted in test expressions, outside of the loop body. this.withTopicForbiddingContext(() => // Parse loop body. this.parseStatement("for"), ); this.scope.exit(); this.state.labels.pop(); return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement"); } // Parse a list of variable declarations. parseVar( node: N.VariableDeclaration, isFor: boolean, kind: "var" | "let" | "const", ): N.VariableDeclaration { const declarations = (node.declarations = []); const isTypescript = this.hasPlugin("typescript"); node.kind = kind; for (;;) { const decl = this.startNode(); this.parseVarId(decl, kind); if (this.eat(tt.eq)) { decl.init = isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn(); } else { if ( kind === "const" && !(this.match(tt._in) || this.isContextual("of")) ) { // `const` with no initializer is allowed in TypeScript. // It could be a declaration like `const x: number;`. if (!isTypescript) { this.raise( this.state.lastTokEnd, Errors.DeclarationMissingInitializer, "Const declarations", ); } } else if ( decl.id.type !== "Identifier" && !(isFor && (this.match(tt._in) || this.isContextual("of"))) ) { this.raise( this.state.lastTokEnd, Errors.DeclarationMissingInitializer, "Complex binding patterns", ); } decl.init = null; } declarations.push(this.finishNode(decl, "VariableDeclarator")); if (!this.eat(tt.comma)) break; } return node; } parseVarId(decl: N.VariableDeclarator, kind: "var" | "let" | "const"): void { decl.id = this.parseBindingAtom(); this.checkLVal( decl.id, "variable declaration", kind === "var" ? BIND_VAR : BIND_LEXICAL, undefined, kind !== "var", ); } // Parse a function declaration or literal (depending on the // `isStatement` parameter). parseFunction( node: T, statement?: number = FUNC_NO_FLAGS, isAsync?: boolean = false, ): T { const isStatement = statement & FUNC_STATEMENT; const isHangingStatement = statement & FUNC_HANGING_STATEMENT; const requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID); this.initFunction(node, isAsync); if (this.match(tt.star) && isHangingStatement) { this.raise(this.state.start, Errors.GeneratorInSingleStatementContext); } node.generator = this.eat(tt.star); if (isStatement) { node.id = this.parseFunctionId(requireId); } const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; this.state.maybeInArrowParameters = false; this.scope.enter(SCOPE_FUNCTION); this.prodParam.enter(functionFlags(isAsync, node.generator)); if (!isStatement) { node.id = this.parseFunctionId(); } this.parseFunctionParams(node, /* allowModifiers */ false); // For the smartPipelines plugin: Disable topic references from outer // contexts within the function body. They are permitted in function // default-parameter expressions, outside of the function body. this.withTopicForbiddingContext(() => { // Parse the function body. this.parseFunctionBodyAndFinish( node, isStatement ? "FunctionDeclaration" : "FunctionExpression", ); }); this.prodParam.exit(); this.scope.exit(); if (isStatement && !isHangingStatement) { // 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.registerFunctionStatementId(node); } this.state.maybeInArrowParameters = oldMaybeInArrowParameters; return node; } parseFunctionId(requireId?: boolean): ?N.Identifier { return requireId || this.match(tt.name) ? this.parseIdentifier() : null; } parseFunctionParams(node: N.Function, allowModifiers?: boolean): void { this.expect(tt.parenL); this.expressionScope.enter(newParameterDeclarationScope()); node.params = this.parseBindingList( tt.parenR, charCodes.rightParenthesis, /* allowEmpty */ false, allowModifiers, ); this.expressionScope.exit(); } 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.scope.declareName( node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, node.id.start, ); } // Parse a class declaration or literal (depending on the // `isStatement` parameter). parseClass( node: T, isStatement: /* T === ClassDeclaration */ boolean, optionalId?: boolean, ): T { this.next(); this.takeDecorators(node); // A class definition is always strict mode code. const oldStrict = this.state.strict; this.state.strict = true; this.parseClassId(node, isStatement, optionalId); this.parseClassSuper(node); // this.state.strict is restored in parseClassBody node.body = this.parseClassBody(!!node.superClass, oldStrict); return this.finishNode( node, isStatement ? "ClassDeclaration" : "ClassExpression", ); } isClassProperty(): boolean { return this.match(tt.eq) || this.match(tt.semi) || this.match(tt.braceR); } isClassMethod(): boolean { return this.match(tt.parenL); } isNonstaticConstructor(method: N.ClassMethod | N.ClassProperty): boolean { return ( !method.computed && !method.static && (method.key.name === "constructor" || // Identifier method.key.value === "constructor") // String literal ); } // https://tc39.es/ecma262/#prod-ClassBody parseClassBody( constructorAllowsSuper: boolean, oldStrict: boolean, ): N.ClassBody { this.classScope.enter(); const state: N.ParseClassMemberState = { constructorAllowsSuper, hadConstructor: false, hadStaticBlock: false, }; let decorators: N.Decorator[] = []; const classBody: N.ClassBody = this.startNode(); classBody.body = []; this.expect(tt.braceL); // For the smartPipelines plugin: Disable topic references from outer // contexts within the class body. this.withTopicForbiddingContext(() => { while (!this.match(tt.braceR)) { if (this.eat(tt.semi)) { if (decorators.length > 0) { throw this.raise(this.state.lastTokEnd, Errors.DecoratorSemicolon); } continue; } if (this.match(tt.at)) { decorators.push(this.parseDecorator()); continue; } const member = this.startNode(); // steal the decorators if there are any if (decorators.length) { member.decorators = decorators; this.resetStartLocationFromNode(member, decorators[0]); decorators = []; } this.parseClassMember(classBody, member, state); if ( member.kind === "constructor" && member.decorators && member.decorators.length > 0 ) { this.raise(member.start, Errors.DecoratorConstructor); } } }); this.state.strict = oldStrict; this.next(); // eat `}` if (decorators.length) { throw this.raise(this.state.start, Errors.TrailingDecorator); } this.classScope.exit(); return this.finishNode(classBody, "ClassBody"); } // returns true if the current identifier is a method/field name, // false if it is a modifier parseClassMemberFromModifier( classBody: N.ClassBody, member: N.ClassMember, ): boolean { const key = this.parseIdentifier(true); // eats the modifier 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 property named like the modifier prop.computed = false; prop.key = key; prop.static = false; classBody.body.push(this.parseClassProperty(prop)); return true; } return false; } parseClassMember( classBody: N.ClassBody, member: N.ClassMember, state: N.ParseClassMemberState, ): void { const isStatic = this.isContextual("static"); if (isStatic) { if (this.parseClassMemberFromModifier(classBody, member)) { // a class element named 'static' return; } if (this.eat(tt.braceL)) { this.parseClassStaticBlock( classBody, ((member: any): N.StaticBlock), state, ); return; } } this.parseClassMemberWithIsStatic(classBody, member, state, isStatic); } parseClassMemberWithIsStatic( classBody: N.ClassBody, member: N.ClassMember, state: N.ParseClassMemberState, isStatic: boolean, ) { const publicMethod: $FlowSubtype = member; const privateMethod: $FlowSubtype = member; const publicProp: $FlowSubtype = member; const privateProp: $FlowSubtype = member; const method: typeof publicMethod | typeof privateMethod = publicMethod; const publicMember: typeof publicMethod | typeof publicProp = publicMethod; member.static = isStatic; if (this.eat(tt.star)) { // a generator method.kind = "method"; this.parseClassElementName(method); if (this.isPrivateName(method.key)) { // Private generator method this.pushClassPrivateMethod(classBody, privateMethod, true, false); return; } if (this.isNonstaticConstructor(publicMethod)) { this.raise(publicMethod.key.start, Errors.ConstructorIsGenerator); } this.pushClassMethod( classBody, publicMethod, true, false, /* isConstructor */ false, false, ); return; } const containsEsc = this.state.containsEsc; const key = this.parseClassElementName(member); const isPrivate = this.isPrivateName(key); // Check the key is not a computed expression or string literal. const isSimple = key.type === "Identifier"; const maybeQuestionTokenStart = this.state.start; this.parsePostMemberNameModifiers(publicMember); if (this.isClassMethod()) { method.kind = "method"; if (isPrivate) { this.pushClassPrivateMethod(classBody, privateMethod, false, false); return; } // a normal method const isConstructor = this.isNonstaticConstructor(publicMethod); let allowsDirectSuper = false; if (isConstructor) { publicMethod.kind = "constructor"; // TypeScript allows multiple overloaded constructor declarations. if (state.hadConstructor && !this.hasPlugin("typescript")) { this.raise(key.start, Errors.DuplicateConstructor); } state.hadConstructor = true; allowsDirectSuper = state.constructorAllowsSuper; } this.pushClassMethod( classBody, publicMethod, false, false, isConstructor, allowsDirectSuper, ); } else if (this.isClassProperty()) { if (isPrivate) { this.pushClassPrivateProperty(classBody, privateProp); } else { this.pushClassProperty(classBody, publicProp); } } else if ( isSimple && key.name === "async" && !containsEsc && !this.isLineTerminator() ) { // 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.parseClassElementName(method); this.parsePostMemberNameModifiers(publicMember); if (this.isPrivateName(method.key)) { // private async method this.pushClassPrivateMethod( classBody, privateMethod, isGenerator, true, ); } else { if (this.isNonstaticConstructor(publicMethod)) { this.raise(publicMethod.key.start, Errors.ConstructorIsAsync); } this.pushClassMethod( classBody, publicMethod, isGenerator, true, /* isConstructor */ false, false, ); } } else if ( isSimple && (key.name === "get" || key.name === "set") && !containsEsc && !(this.match(tt.star) && this.isLineTerminator()) ) { // `get\n*` is an uninitialized property named 'get' followed by a generator. // a getter or setter method.kind = key.name; // The so-called parsed name would have been "get/set": get the real name. this.parseClassElementName(publicMethod); if (this.isPrivateName(method.key)) { // private getter/setter this.pushClassPrivateMethod(classBody, privateMethod, false, false); } else { if (this.isNonstaticConstructor(publicMethod)) { this.raise(publicMethod.key.start, Errors.ConstructorIsAccessor); } this.pushClassMethod( classBody, publicMethod, false, false, /* isConstructor */ false, false, ); } this.checkGetterSetterParams(publicMethod); } else if (this.isLineTerminator()) { // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token) if (isPrivate) { this.pushClassPrivateProperty(classBody, privateProp); } else { this.pushClassProperty(classBody, publicProp); } } else { this.unexpected(); } } // https://tc39.es/proposal-class-fields/#prod-ClassElementName parseClassElementName(member: N.ClassMember): N.Expression | N.Identifier { const key = this.parsePropertyName(member, /* isPrivateNameAllowed */ true); if ( !member.computed && member.static && ((key: $FlowSubtype).name === "prototype" || (key: $FlowSubtype).value === "prototype") ) { this.raise(key.start, Errors.StaticPrototype); } if ( this.isPrivateName(key) && this.getPrivateNameSV(key) === "constructor" ) { this.raise(key.start, Errors.ConstructorClassPrivateField); } return key; } parseClassStaticBlock( classBody: N.ClassBody, member: N.StaticBlock & { decorators?: Array }, state: N.ParseClassMemberState, ) { this.expectPlugin("classStaticBlock", member.start); // Start a new lexical scope this.scope.enter(SCOPE_CLASS | SCOPE_SUPER); // Start a new expression scope, this is required for parsing edge cases like: // async (x = class { static { await; } }) => {} this.expressionScope.enter(newExpressionScope()); // Start a new scope with regard to loop labels const oldLabels = this.state.labels; this.state.labels = []; // ClassStaticBlockStatementList: // StatementList[~Yield, ~Await, ~Return] opt this.prodParam.enter(PARAM); const body = (member.body = []); this.parseBlockOrModuleBlockBody(body, undefined, false, tt.braceR); this.prodParam.exit(); this.expressionScope.exit(); this.scope.exit(); this.state.labels = oldLabels; classBody.body.push(this.finishNode(member, "StaticBlock")); if (state.hadStaticBlock) { this.raise(member.start, Errors.DuplicateStaticBlock); } if (member.decorators?.length) { this.raise(member.start, Errors.DecoratorStaticBlock); } state.hadStaticBlock = true; } pushClassProperty(classBody: N.ClassBody, prop: N.ClassProperty) { 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)); } pushClassPrivateProperty( classBody: N.ClassBody, prop: N.ClassPrivateProperty, ) { this.expectPlugin("classPrivateProperties", prop.key.start); const node = this.parseClassPrivateProperty(prop); classBody.body.push(node); this.classScope.declarePrivateName( this.getPrivateNameSV(node.key), CLASS_ELEMENT_OTHER, node.key.start, ); } pushClassMethod( classBody: N.ClassBody, method: N.ClassMethod, isGenerator: boolean, isAsync: boolean, isConstructor: boolean, allowsDirectSuper: boolean, ): void { classBody.body.push( this.parseMethod( method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true, ), ); } pushClassPrivateMethod( classBody: N.ClassBody, method: N.ClassPrivateMethod, isGenerator: boolean, isAsync: boolean, ): void { this.expectPlugin("classPrivateMethods", method.key.start); 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( this.getPrivateNameSV(node.key), kind, node.key.start, ); } // Overridden in typescript.js parsePostMemberNameModifiers( // eslint-disable-next-line no-unused-vars methodOrProp: N.ClassMethod | N.ClassProperty, ): void {} // https://tc39.es/proposal-class-fields/#prod-FieldDefinition parseClassPrivateProperty( node: N.ClassPrivateProperty, ): N.ClassPrivateProperty { this.parseInitializer(node); this.semicolon(); return this.finishNode(node, "ClassPrivateProperty"); } // https://tc39.es/proposal-class-fields/#prod-FieldDefinition parseClassProperty(node: N.ClassProperty): N.ClassProperty { if (!node.typeAnnotation || this.match(tt.eq)) { this.expectPlugin("classProperties"); } this.parseInitializer(node); this.semicolon(); return this.finishNode(node, "ClassProperty"); } // https://tc39.es/proposal-class-fields/#prod-Initializer parseInitializer(node: N.ClassProperty | N.ClassPrivateProperty): void { this.scope.enter(SCOPE_CLASS | SCOPE_SUPER); this.expressionScope.enter(newExpressionScope()); this.prodParam.enter(PARAM); node.value = this.eat(tt.eq) ? this.parseMaybeAssignAllowIn() : null; this.expressionScope.exit(); this.prodParam.exit(); this.scope.exit(); } parseClassId( 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, "class name", bindingType); } } else { if (optionalId || !isStatement) { node.id = null; } else { this.unexpected(null, Errors.MissingClassName); } } } // https://tc39.es/ecma262/#prod-ClassHeritage parseClassSuper(node: N.Class): void { node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null; } // Parses module export declaration. // https://tc39.es/ecma262/#prod-ExportDeclaration parseExport(node: N.Node): N.AnyExport { const hasDefault = this.maybeParseExportDefaultSpecifier(node); const parseAfterDefault = !hasDefault || this.eat(tt.comma); const hasStar = parseAfterDefault && this.eatExportStar(node); const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node); const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(tt.comma)); const isFromRequired = hasDefault || hasStar; if (hasStar && !hasNamespace) { if (hasDefault) this.unexpected(); this.parseExportFrom(node, true); return this.finishNode(node, "ExportAllDeclaration"); } const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node); if ( (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) || (hasNamespace && parseAfterNamespace && !hasSpecifiers) ) { throw this.unexpected(null, tt.braceL); } let hasDeclaration; if (isFromRequired || hasSpecifiers) { hasDeclaration = false; this.parseExportFrom(node, isFromRequired); } else { hasDeclaration = this.maybeParseExportDeclaration(node); } if (isFromRequired || hasSpecifiers || hasDeclaration) { this.checkExport(node, true, false, !!node.source); return this.finishNode(node, "ExportNamedDeclaration"); } if (this.eat(tt._default)) { // export default ... node.declaration = this.parseExportDefaultExpression(); this.checkExport(node, true, true); return this.finishNode(node, "ExportDefaultDeclaration"); } throw this.unexpected(null, tt.braceL); } // eslint-disable-next-line no-unused-vars eatExportStar(node: N.Node): boolean { return this.eat(tt.star); } maybeParseExportDefaultSpecifier(node: N.Node): boolean { if (this.isExportDefaultSpecifier()) { // export defaultObj ... this.expectPlugin("exportDefaultFrom"); const specifier = this.startNode(); specifier.exported = this.parseIdentifier(true); node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")]; return true; } return false; } maybeParseExportNamespaceSpecifier(node: N.Node): boolean { if (this.isContextual("as")) { if (!node.specifiers) node.specifiers = []; const specifier = this.startNodeAt( this.state.lastTokStart, this.state.lastTokStartLoc, ); this.next(); specifier.exported = this.parseModuleExportName(); node.specifiers.push( this.finishNode(specifier, "ExportNamespaceSpecifier"), ); return true; } return false; } maybeParseExportNamedSpecifiers(node: N.Node): boolean { if (this.match(tt.braceL)) { if (!node.specifiers) node.specifiers = []; node.specifiers.push(...this.parseExportSpecifiers()); node.source = null; node.declaration = null; return true; } return false; } maybeParseExportDeclaration(node: N.Node): boolean { if (this.shouldParseExportDeclaration()) { node.specifiers = []; node.source = null; node.declaration = this.parseExportDeclaration(node); return true; } return false; } isAsyncFunction(): boolean { if (!this.isContextual("async")) return false; const next = this.nextTokenStart(); return ( !lineBreak.test(this.input.slice(this.state.pos, next)) && this.isUnparsedContextual(next, "function") ); } parseExportDefaultExpression(): N.Expression | N.Declaration { const expr = this.startNode(); const isAsync = this.isAsyncFunction(); if (this.match(tt._function) || isAsync) { this.next(); if (isAsync) { this.next(); } return this.parseFunction( expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync, ); } else if (this.match(tt._class)) { return this.parseClass(expr, true, true); } else if (this.match(tt.at)) { if ( this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") ) { 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()) { throw this.raise(this.state.start, Errors.UnsupportedDefaultExport); } else { const res = this.parseMaybeAssignAllowIn(); this.semicolon(); return res; } } // eslint-disable-next-line no-unused-vars parseExportDeclaration(node: N.ExportNamedDeclaration): ?N.Declaration { return this.parseStatement(null); } isExportDefaultSpecifier(): boolean { if (this.match(tt.name)) { const value = this.state.value; if ((value === "async" && !this.state.containsEsc) || 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 next = this.nextTokenStart(); const hasFrom = this.isUnparsedContextual(next, "from"); if ( this.input.charCodeAt(next) === charCodes.comma || (this.match(tt.name) && hasFrom) ) { return true; } // lookahead again when `export default from` is seen if (this.match(tt._default) && hasFrom) { const nextAfterFrom = this.input.charCodeAt( this.nextTokenStartSince(next + 4), ); return ( nextAfterFrom === charCodes.quotationMark || nextAfterFrom === charCodes.apostrophe ); } return false; } parseExportFrom(node: N.ExportNamedDeclaration, expect?: boolean): void { if (this.eatContextual("from")) { node.source = this.parseImportSource(); this.checkExport(node); const assertions = this.maybeParseImportAssertions(); if (assertions) { node.assertions = assertions; } } else { if (expect) { this.unexpected(); } else { node.source = null; } } this.semicolon(); } shouldParseExportDeclaration(): boolean { if (this.match(tt.at)) { this.expectOnePlugin(["decorators", "decorators-legacy"]); if (this.hasPlugin("decorators")) { if (this.getPluginOption("decorators", "decoratorsBeforeExport")) { this.unexpected(this.state.start, Errors.DecoratorBeforeExport); } else { return true; } } } return ( this.state.type.keyword === "var" || this.state.type.keyword === "const" || this.state.type.keyword === "function" || this.state.type.keyword === "class" || this.isLet() || this.isAsyncFunction() ); } checkExport( node: N.ExportNamedDeclaration, checkNames?: boolean, isDefault?: boolean, isFrom?: boolean, ): void { if (checkNames) { // Check for duplicate exports if (isDefault) { // Default exports this.checkDuplicateExports(node, "default"); if (this.hasPlugin("exportDefaultFrom")) { const declaration = ((node: any): N.ExportDefaultDeclaration) .declaration; if ( declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && // does not contain escape !declaration.extra?.parenthesized ) { this.raise(declaration.start, Errors.ExportDefaultFromAsIdentifier); } } } else if (node.specifiers && node.specifiers.length) { // Named exports for (const specifier of node.specifiers) { const { exported } = specifier; const exportedName = exported.type === "Identifier" ? exported.name : exported.value; this.checkDuplicateExports(specifier, exportedName); // $FlowIgnore if (!isFrom && specifier.local) { const { local } = specifier; if (local.type === "StringLiteral") { this.raise( specifier.start, Errors.ExportBindingIsString, local.value, exportedName, ); } else { // check for keywords used as local names this.checkReservedWord(local.name, local.start, true, false); // check if export is defined this.scope.checkLocalExport(local); } } } } else if (node.declaration) { // Exported declarations if ( node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration" ) { const id = node.declaration.id; if (!id) throw new Error("Assertion failure"); this.checkDuplicateExports(node, id.name); } else if (node.declaration.type === "VariableDeclaration") { for (const declaration of node.declaration.declarations) { this.checkDeclaration(declaration.id); } } } } const currentContextDecorators = this.state.decoratorStack[ this.state.decoratorStack.length - 1 ]; // If node.declaration is a class, it will take all decorators in the current context. // Thus we should throw if we see non-empty decorators here. if (currentContextDecorators.length) { throw this.raise(node.start, Errors.UnsupportedDecoratorExport); } } checkDeclaration(node: N.Pattern | N.ObjectProperty): void { if (node.type === "Identifier") { this.checkDuplicateExports(node, node.name); } else if (node.type === "ObjectPattern") { for (const prop of node.properties) { this.checkDeclaration(prop); } } else if (node.type === "ArrayPattern") { for (const elem of node.elements) { if (elem) { this.checkDeclaration(elem); } } } else if (node.type === "ObjectProperty") { this.checkDeclaration(node.value); } else if (node.type === "RestElement") { this.checkDeclaration(node.argument); } else if (node.type === "AssignmentPattern") { this.checkDeclaration(node.left); } } checkDuplicateExports( node: | N.Identifier | N.StringLiteral | N.ExportNamedDeclaration | N.ExportSpecifier | N.ExportDefaultSpecifier, name: string, ): void { if (this.state.exportedIdentifiers.indexOf(name) > -1) { this.raise( node.start, name === "default" ? Errors.DuplicateDefaultExport : Errors.DuplicateExport, name, ); } this.state.exportedIdentifiers.push(name); } // Parses a comma-separated list of module exports. parseExportSpecifiers(): Array { const nodes = []; let first = true; // export { x, y as z } [from '...'] this.expect(tt.braceL); while (!this.eat(tt.braceR)) { if (first) { first = false; } else { this.expect(tt.comma); if (this.eat(tt.braceR)) break; } const node = this.startNode(); node.local = this.parseModuleExportName(); node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local.__clone(); nodes.push(this.finishNode(node, "ExportSpecifier")); } return nodes; } // https://tc39.es/ecma262/#prod-ModuleExportName parseModuleExportName(): N.StringLiteral | N.Identifier { if (this.match(tt.string)) { this.expectPlugin("moduleStringNames"); const result = this.parseLiteral( this.state.value, "StringLiteral", ); const surrogate = result.value.match(loneSurrogate); if (surrogate) { this.raise( result.start, Errors.ModuleExportNameHasLoneSurrogate, surrogate[0].charCodeAt(0).toString(16), ); } return result; } return this.parseIdentifier(true); } // Parses import declaration. // https://tc39.es/ecma262/#prod-ImportDeclaration parseImport(node: N.Node): N.AnyImport { // import '...' node.specifiers = []; if (!this.match(tt.string)) { // check if we have a default import like // import React from "react"; const hasDefault = this.maybeParseDefaultImportSpecifier(node); /* we are checking if we do not have a default import, then it is obvious that we need named imports * import { get } from "axios"; * but if we do have a default import * we need to check if we have a comma after that and * that is where this `|| this.eat` condition comes into play */ const parseNext = !hasDefault || this.eat(tt.comma); // if we do have to parse the next set of specifiers, we first check for star imports // import React, * from "react"; const hasStar = parseNext && this.maybeParseStarImportSpecifier(node); // now we check if we need to parse the next imports // but only if they are not importing * (everything) if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node); this.expectContextual("from"); } node.source = this.parseImportSource(); // https://github.com/tc39/proposal-import-assertions // parse module import assertions if the next token is `assert` or ignore // and finish the ImportDeclaration node. const assertions = this.maybeParseImportAssertions(); if (assertions) { node.assertions = assertions; } // todo(Babel 8): remove module attributes support else { const attributes = this.maybeParseModuleAttributes(); if (attributes) { node.attributes = attributes; } } this.semicolon(); return this.finishNode(node, "ImportDeclaration"); } parseImportSource(): N.StringLiteral { if (!this.match(tt.string)) this.unexpected(); return this.parseExprAtom(); } // eslint-disable-next-line no-unused-vars shouldParseDefaultImport(node: N.ImportDeclaration): boolean { return this.match(tt.name); } parseImportSpecifierLocal( node: N.ImportDeclaration, specifier: N.Node, type: string, contextDescription: string, ): void { specifier.local = this.parseIdentifier(); this.checkLVal(specifier.local, contextDescription, BIND_LEXICAL); node.specifiers.push(this.finishNode(specifier, type)); } /** * parse assert entries * * @see {@link https://tc39.es/proposal-import-assertions/#prod-AssertEntries |AssertEntries} * @returns {N.ImportAttribute[]} * @memberof StatementParser */ parseAssertEntries(): N.ImportAttribute[] { const attrs = []; const attrNames = new Set(); do { if (this.match(tt.braceR)) { break; } const node = this.startNode(); // parse AssertionKey : IdentifierName, StringLiteral const keyName = this.state.value; if (this.match(tt.string)) { node.key = this.parseLiteral(keyName, "StringLiteral"); } else { node.key = this.parseIdentifier(true); } this.expect(tt.colon); // for now we are only allowing `type` as the only allowed module attribute if (keyName !== "type") { this.raise( node.key.start, Errors.ModuleAttributeDifferentFromType, keyName, ); } // check if we already have an entry for an attribute // if a duplicate entry is found, throw an error // for now this logic will come into play only when someone declares `type` twice if (attrNames.has(keyName)) { this.raise( node.key.start, Errors.ModuleAttributesWithDuplicateKeys, keyName, ); } attrNames.add(keyName); if (!this.match(tt.string)) { throw this.unexpected( this.state.start, Errors.ModuleAttributeInvalidValue, ); } node.value = this.parseLiteral( this.state.value, "StringLiteral", ); this.finishNode(node, "ImportAttribute"); attrs.push(node); } while (this.eat(tt.comma)); return attrs; } /** * parse module attributes * @deprecated It will be removed in Babel 8 * @returns * @memberof StatementParser */ maybeParseModuleAttributes() { if (this.match(tt._with) && !this.hasPrecedingLineBreak()) { this.expectPlugin("moduleAttributes"); this.next(); } else { if (this.hasPlugin("moduleAttributes")) return []; return null; } const attrs = []; const attributes = new Set(); do { const node = this.startNode(); node.key = this.parseIdentifier(true); if (node.key.name !== "type") { this.raise( node.key.start, Errors.ModuleAttributeDifferentFromType, node.key.name, ); } if (attributes.has(node.key.name)) { this.raise( node.key.start, Errors.ModuleAttributesWithDuplicateKeys, node.key.name, ); } attributes.add(node.key.name); this.expect(tt.colon); if (!this.match(tt.string)) { throw this.unexpected( this.state.start, Errors.ModuleAttributeInvalidValue, ); } node.value = this.parseLiteral(this.state.value, "StringLiteral"); this.finishNode(node, "ImportAttribute"); attrs.push(node); } while (this.eat(tt.comma)); return attrs; } maybeParseImportAssertions() { // [no LineTerminator here] AssertClause if (this.isContextual("assert") && !this.hasPrecedingLineBreak()) { this.expectPlugin("importAssertions"); this.next(); // eat `assert` } else { if (this.hasPlugin("importAssertions")) return []; return null; } // https://tc39.es/proposal-import-assertions/#prod-AssertClause this.eat(tt.braceL); const attrs = this.parseAssertEntries(); this.eat(tt.braceR); return attrs; } maybeParseDefaultImportSpecifier(node: N.ImportDeclaration): boolean { if (this.shouldParseDefaultImport(node)) { // import defaultObj, { x, y as z } from '...' this.parseImportSpecifierLocal( node, this.startNode(), "ImportDefaultSpecifier", "default import specifier", ); return true; } return false; } maybeParseStarImportSpecifier(node: N.ImportDeclaration): boolean { if (this.match(tt.star)) { const specifier = this.startNode(); this.next(); this.expectContextual("as"); this.parseImportSpecifierLocal( node, specifier, "ImportNamespaceSpecifier", "import namespace specifier", ); return true; } return false; } parseNamedImportSpecifiers(node: N.ImportDeclaration) { let first = true; this.expect(tt.braceL); while (!this.eat(tt.braceR)) { if (first) { first = false; } else { // Detect an attempt to deep destructure if (this.eat(tt.colon)) { throw this.raise(this.state.start, Errors.DestructureNamedImport); } this.expect(tt.comma); if (this.eat(tt.braceR)) break; } this.parseImportSpecifier(node); } } // https://tc39.es/ecma262/#prod-ImportSpecifier parseImportSpecifier(node: N.ImportDeclaration): void { const specifier = this.startNode(); specifier.imported = this.parseModuleExportName(); if (this.eatContextual("as")) { specifier.local = this.parseIdentifier(); } else { const { imported } = specifier; if (imported.type === "StringLiteral") { throw this.raise( specifier.start, Errors.ImportBindingIsString, imported.value, ); } this.checkReservedWord(imported.name, specifier.start, true, true); specifier.local = imported.__clone(); } this.checkLVal(specifier.local, "import specifier", BIND_LEXICAL); node.specifiers.push(this.finishNode(specifier, "ImportSpecifier")); } } babel-7.12.12/packages/babel-parser/src/parser/util.js000066400000000000000000000212301377064615700224620ustar00rootroot00000000000000// @flow 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 } from "../util/whitespace"; import { isIdentifierChar } from "../util/identifier"; import { Errors } from "./error"; type TryParse = { node: Node, error: Error, thrown: Thrown, aborted: Aborted, failState: FailState, }; // ## Parser utilities export default class UtilParser extends Tokenizer { // TODO addExtra(node: Node, key: string, val: any): void { if (!node) return; const extra = (node.extra = node.extra || {}); extra[key] = val; } // TODO isRelational(op: "<" | ">"): boolean { return this.match(tt.relational) && this.state.value === op; } // TODO expectRelational(op: "<" | ">"): void { if (this.isRelational(op)) { this.next(); } else { this.unexpected(null, tt.relational); } } // Tests whether parsed token is a contextual keyword. isContextual(name: string): boolean { return ( this.match(tt.name) && this.state.value === name && !this.state.containsEsc ); } 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 next = this.nextTokenStart(); return this.isUnparsedContextual(next, name); } // Consumes contextual keyword if possible. eatContextual(name: string): boolean { return this.isContextual(name) && this.eat(tt.name); } // Asserts that following token is given contextual keyword. expectContextual(name: string, message?: string): void { if (!this.eatContextual(name)) this.unexpected(null, message); } // Test whether a semicolon can be inserted at the current position. canInsertSemicolon(): boolean { return ( this.match(tt.eof) || this.match(tt.braceR) || this.hasPrecedingLineBreak() ); } hasPrecedingLineBreak(): boolean { return lineBreak.test( this.input.slice(this.state.lastTokEnd, this.state.start), ); } // TODO isLineTerminator(): boolean { return this.eat(tt.semi) || this.canInsertSemicolon(); } // Consume a semicolon, or, failing that, see if we are allowed to // pretend that there is a semicolon at this position. semicolon(): void { if (!this.isLineTerminator()) this.unexpected(null, tt.semi); } // Expect a token of a given type. If found, consume it, otherwise, // raise an unexpected token error at given pos. expect(type: TokenType, pos?: ?number): void { this.eat(type) || this.unexpected(pos, type); } // Throws if the current token and the prev one are separated by a space. assertNoSpace(message: string = "Unexpected space."): void { if (this.state.start > this.state.lastTokEnd) { /* eslint-disable @babel/development-internal/dry-error-messages */ this.raise(this.state.lastTokEnd, message); /* eslint-enable @babel/development-internal/dry-error-messages */ } } // Raise an unexpected token error. Can take the expected token type // instead of a message string. unexpected( pos: ?number, messageOrType: string | TokenType = "Unexpected token", ): empty { if (typeof messageOrType !== "string") { messageOrType = `Unexpected token, expected "${messageOrType.label}"`; } /* eslint-disable @babel/development-internal/dry-error-messages */ throw this.raise(pos != null ? pos : this.state.start, messageOrType); /* eslint-enable @babel/development-internal/dry-error-messages */ } expectPlugin(name: string, pos?: ?number): true { if (!this.hasPlugin(name)) { throw this.raiseWithData( pos != null ? pos : this.state.start, { missingPlugin: [name] }, `This experimental syntax requires enabling the parser plugin: '${name}'`, ); } return true; } expectOnePlugin(names: Array, pos?: ?number): void { if (!names.some(n => this.hasPlugin(n))) { 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( ", ", )}'`, ); } } // 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; } } 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); } } /** * Test if current token is a literal property name * https://tc39.es/ecma262/#prod-LiteralPropertyName * LiteralPropertyName: * IdentifierName * StringLiteral * NumericLiteral * BigIntLiteral */ isLiteralPropertyName(): boolean { return ( this.match(tt.name) || !!this.state.type.keyword || this.match(tt.string) || this.match(tt.num) || this.match(tt.bigint) || this.match(tt.decimal) ); } /* * Test if given node is a PrivateName * will be overridden in ESTree plugin */ isPrivateName(node: Node): boolean { return node.type === "PrivateName"; } /* * Return the string value of a given private name * WITHOUT `#` * @see {@link https://tc39.es/proposal-class-fields/#sec-private-names-static-semantics-stringvalue} */ getPrivateNameSV(node: Node): string { return node.id.name; } /* * Return whether the given node is a member/optional chain that * contains a private name as its property * It is overridden in ESTree plugin */ hasPropertyAsPrivateName(node: Node): boolean { return ( (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property) ); } isOptionalChain(node: Node): boolean { return ( node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression" ); } isObjectProperty(node: Node): boolean { return node.type === "ObjectProperty"; } isObjectMethod(node: Node): boolean { return node.type === "ObjectMethod"; } } /** * 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; } babel-7.12.12/packages/babel-parser/src/plugin-utils.js000066400000000000000000000100231377064615700226430ustar00rootroot00000000000000// @flow import type Parser from "./parser"; export type Plugin = string | [string, Object]; export type PluginList = $ReadOnlyArray; export type MixinPlugin = (superClass: Class) => Class; export function hasPlugin(plugins: PluginList, name: string): boolean { return plugins.some(plugin => { if (Array.isArray(plugin)) { return plugin[0] === name; } else { return plugin === name; } }); } export function getPluginOption( plugins: PluginList, name: string, option: string, ) { const plugin = plugins.find(plugin => { if (Array.isArray(plugin)) { return plugin[0] === name; } else { return plugin === name; } }); if (plugin && Array.isArray(plugin)) { return plugin[1][option]; } return null; } const PIPELINE_PROPOSALS = ["minimal", "smart", "fsharp"]; const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"]; export function validatePlugins(plugins: PluginList) { if (hasPlugin(plugins, "decorators")) { if (hasPlugin(plugins, "decorators-legacy")) { throw new Error( "Cannot use the decorators and decorators-legacy plugin together", ); } const decoratorsBeforeExport = getPluginOption( plugins, "decorators", "decoratorsBeforeExport", ); if (decoratorsBeforeExport == null) { throw new Error( "The 'decorators' plugin requires a 'decoratorsBeforeExport' option," + " whose value must be a boolean. If you are migrating from" + " Babylon/Babel 6 or want to use the old decorators proposal, you" + " should use the 'decorators-legacy' plugin instead of 'decorators'.", ); } else if (typeof decoratorsBeforeExport !== "boolean") { throw new Error("'decoratorsBeforeExport' must be a boolean."); } } if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) { 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( getPluginOption(plugins, "pipelineOperator", "proposal"), ) ) { throw new Error( "'pipelineOperator' requires 'proposal' option whose value should be one of: " + PIPELINE_PROPOSALS.map(p => `'${p}'`).join(", "), ); } if (hasPlugin(plugins, "moduleAttributes")) { if (hasPlugin(plugins, "importAssertions")) { throw new Error( "Cannot combine importAssertions and moduleAttributes plugins.", ); } const moduleAttributesVerionPluginOption = getPluginOption( plugins, "moduleAttributes", "version", ); if (moduleAttributesVerionPluginOption !== "may-2020") { throw new Error( "The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.", ); } } 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. import estree from "./plugins/estree"; 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 } = { estree, jsx, flow, typescript, v8intrinsic, placeholders, }; export const mixinPluginNames: $ReadOnlyArray = Object.keys( mixinPlugins, ); babel-7.12.12/packages/babel-parser/src/plugins/000077500000000000000000000000001377064615700213365ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/src/plugins/estree.js000066400000000000000000000270511377064615700231700ustar00rootroot00000000000000// @flow 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 { Position } from "../util/location"; import { Errors } from "../parser/error"; export default (superClass: Class): Class => class extends superClass { estreeParseRegExpLiteral({ pattern, flags }: N.RegExpLiteral): N.Node { let regex = null; try { regex = new RegExp(pattern, flags); } catch (e) { // In environments that don't support these flags value will // be null as the regex can't be represented natively. } const node = this.estreeParseLiteral(regex); node.regex = { pattern, flags }; return node; } estreeParseBigIntLiteral(value: any): N.Node { // https://github.com/estree/estree/blob/master/es2020.md#bigintliteral let bigInt; try { // $FlowIgnore bigInt = BigInt(value); } catch { bigInt = null; } const node = this.estreeParseLiteral(bigInt); node.bigint = String(node.value || value); return node; } estreeParseDecimalLiteral(value: any): N.Node { // https://github.com/estree/estree/blob/master/experimental/decimal.md // todo: use BigDecimal when node supports it. const decimal = null; const node = this.estreeParseLiteral(decimal); node.decimal = String(node.value || value); return node; } estreeParseLiteral(value: any): N.Node { return this.parseLiteral(value, "Literal"); } directiveToStmt(directive: N.Directive): N.ExpressionStatement { const directiveLiteral = directive.value; const stmt = this.startNodeAt(directive.start, directive.loc.start); const expression = this.startNodeAt( directiveLiteral.start, directiveLiteral.loc.start, ); expression.value = directiveLiteral.extra.expressionValue; expression.raw = directiveLiteral.extra.raw; stmt.expression = this.finishNodeAt( expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end, ); stmt.directive = directiveLiteral.extra.raw.slice(1, -1); return this.finishNodeAt( stmt, "ExpressionStatement", directive.end, directive.loc.end, ); } // ================================== // Overrides // ================================== initFunction( node: N.BodilessFunctionOrMethodBase, isAsync: ?boolean, ): void { super.initFunction(node, isAsync); node.expression = false; } checkDeclaration(node: N.Pattern | N.ObjectProperty): void { if (node != null && this.isObjectProperty(node)) { this.checkDeclaration(((node: any): N.EstreeProperty).value); } else { super.checkDeclaration(node); } } getObjectOrClassMethodParams(method: N.ObjectMethod | N.ClassMethod) { return ((method: any): N.EstreeProperty | N.EstreeMethodDefinition).value .params; } isValidDirective(stmt: N.Statement): boolean { return ( stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !stmt.expression.extra?.parenthesized ); } stmtToDirective(stmt: N.Statement): N.Directive { const directive = super.stmtToDirective(stmt); const value = stmt.expression.value; // Record the expression value as in estree mode we want // the stmt to have the real value e.g. ("use strict") and // not the raw value e.g. ("use\\x20strict") this.addExtra(directive.value, "expressionValue", value); return directive; } parseBlockBody( node: N.BlockStatementLike, ...args: [?boolean, boolean, TokenType, void | (boolean => void)] ): void { super.parseBlockBody(node, ...args); const directiveStatements = node.directives.map(d => this.directiveToStmt(d), ); node.body = directiveStatements.concat(node.body); // $FlowIgnore - directives isn't optional in the type definition delete node.directives; } pushClassMethod( classBody: N.ClassBody, method: N.ClassMethod, isGenerator: boolean, isAsync: boolean, isConstructor: boolean, allowsDirectSuper: boolean, ): void { this.parseMethod( method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true, ); if (method.typeParameters) { // $FlowIgnore method.value.typeParameters = method.typeParameters; delete method.typeParameters; } classBody.body.push(method); } parseExprAtom(refExpressionErrors?: ?ExpressionErrors): N.Expression { switch (this.state.type) { 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.decimal: return this.estreeParseDecimalLiteral(this.state.value); case tt._null: return this.estreeParseLiteral(null); case tt._true: return this.estreeParseLiteral(true); case tt._false: return this.estreeParseLiteral(false); default: return super.parseExprAtom(refExpressionErrors); } } parseLiteral( value: any, type: /*T["kind"]*/ string, startPos?: number, startLoc?: Position, ): T { const node = super.parseLiteral(value, type, startPos, startLoc); node.raw = node.extra.raw; delete node.extra; return node; } parseFunctionBody( node: N.Function, allowExpression: ?boolean, isMethod?: boolean = false, ): void { super.parseFunctionBody(node, allowExpression, isMethod); node.expression = node.body.type !== "BlockStatement"; } parseMethod( node: T, isGenerator: boolean, isAsync: boolean, isConstructor: boolean, allowDirectSuper: boolean, type: string, inClassScope: boolean = false, ): T { let funcNode = this.startNode(); funcNode.kind = node.kind; // provide kind, so super method correctly sets state funcNode = super.parseMethod( funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope, ); funcNode.type = "FunctionExpression"; delete funcNode.kind; // $FlowIgnore node.value = funcNode; type = type === "ClassMethod" ? "MethodDefinition" : type; return this.finishNode(node, type); } parseObjectMethod( prop: N.ObjectMethod, isGenerator: boolean, isAsync: boolean, isPattern: boolean, isAccessor: boolean, ): ?N.ObjectMethod { const node: N.EstreeProperty = (super.parseObjectMethod( prop, isGenerator, isAsync, isPattern, isAccessor, ): any); if (node) { node.type = "Property"; if (((node: any): N.ClassMethod).kind === "method") node.kind = "init"; node.shorthand = false; } return (node: any); } parseObjectProperty( prop: N.ObjectProperty, startPos: ?number, startLoc: ?Position, isPattern: boolean, refExpressionErrors: ?ExpressionErrors, ): ?N.ObjectProperty { const node: N.EstreeProperty = (super.parseObjectProperty( prop, startPos, startLoc, isPattern, refExpressionErrors, ): any); if (node) { node.kind = "init"; node.type = "Property"; } return (node: any); } toAssignable(node: N.Node, isLHS: boolean = false): N.Node { if (node != null && this.isObjectProperty(node)) { this.toAssignable(node.value, isLHS); return node; } return super.toAssignable(node, isLHS); } toAssignableObjectExpressionProp(prop: N.Node, ...args) { if (prop.kind === "get" || prop.kind === "set") { this.raise(prop.key.start, Errors.PatternHasAccessor); } else if (prop.method) { this.raise(prop.key.start, Errors.PatternHasMethod); } else { super.toAssignableObjectExpressionProp(prop, ...args); } } 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]; // $FlowIgnore - arguments isn't optional in the type definition delete node.arguments; // $FlowIgnore - callee isn't optional in the type definition delete node.callee; } return node; } toReferencedArguments( node: | N.CallExpression | N.OptionalCallExpression | N.EstreeImportExpression, /* isParenthesizedExpr?: boolean, */ ) { // ImportExpressions do not have an arguments array. if (node.type === "ImportExpression") { return; } super.toReferencedArguments(node); } 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; } parseSubscript( base: N.Expression, startPos: number, startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, ) { const node = super.parseSubscript( base, startPos, startLoc, noCalls, state, ); if (state.optionalChainMember) { // https://github.com/estree/estree/blob/master/es2020.md#chainexpression if ( node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression" ) { node.type = node.type.substring(8); // strip Optional prefix } if (state.stop) { const chain = this.startNodeAtNode(node); chain.expression = node; return this.finishNode(chain, "ChainExpression"); } } else if ( node.type === "MemberExpression" || node.type === "CallExpression" ) { node.optional = false; } return node; } hasPropertyAsPrivateName(node: N.Node): boolean { if (node.type === "ChainExpression") { node = node.expression; } return super.hasPropertyAsPrivateName(node); } isOptionalChain(node: N.Node): boolean { return node.type === "ChainExpression"; } isObjectProperty(node: N.Node): boolean { return node.type === "Property" && node.kind === "init" && !node.method; } isObjectMethod(node: N.Node): boolean { return node.method || node.kind === "get" || node.kind === "set"; } }; babel-7.12.12/packages/babel-parser/src/plugins/flow.js000066400000000000000000003272761377064615700226640ustar00rootroot00000000000000// @flow /*:: declare var invariant; */ // Error messages are colocated with the plugin. /* eslint-disable @babel/development-internal/dry-error-messages */ import type Parser from "../parser"; import { types as tt, type TokenType } from "../tokenizer/types"; import * as N from "../types"; import type { Options } from "../options"; import type { Pos, Position } from "../util/location"; import type State from "../tokenizer/state"; import { types as tc } from "../tokenizer/context"; import * as charCodes from "charcodes"; import { isIteratorStart, isKeyword } from "../util/identifier"; import { type BindingTypes, 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/error"; const reservedTypes = new Set([ "_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void", ]); /* 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", UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`", 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 ( bodyElement.type === "DeclareExportAllDeclaration" || (bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || (bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration"))) ); } function hasTypeImportKind(node: N.Node): boolean { return node.importKind === "type" || node.importKind === "typeof"; } function isMaybeDefaultImport(state: State): boolean { return ( (state.type === tt.name || !!state.type.keyword) && state.value !== "from" ); } const exportSuggestions = { const: "declare export var", let: "declare export var", type: "export type", interface: "export interface", }; // Like Array#filter, but returns a tuple [ acceptedElements, discardedElements ] function partition( list: T[], test: (T, number, T[]) => ?boolean, ): [T[], T[]] { const list1 = []; const list2 = []; for (let i = 0; i < list.length; i++) { (test(list[i], i, list) ? list1 : list2).push(list[i]); } return [list1, list2]; } 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 // to "@flow" or "@noflow" if we see a pragma. Transitions to null if we are // past the initial comment. flowPragma: void | null | "flow" | "noflow"; constructor(options: ?Options, input: string) { super(options, input); this.flowPragma = undefined; } shouldParseTypes(): boolean { 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 && type !== tt.semi && type !== tt.interpreterDirective ) { if (this.flowPragma === undefined) { this.flowPragma = null; } } return super.finishToken(type, val); } addComment(comment: N.Comment): void { if (this.flowPragma === undefined) { // Try to parse a flow pragma. const matches = FLOW_PRAGMA_REGEX.exec(comment.value); if (!matches) { // do nothing } else if (matches[1] === "flow") { this.flowPragma = "flow"; } else if (matches[1] === "noflow") { this.flowPragma = "noflow"; } else { throw new Error("Unexpected flow pragma"); } } return super.addComment(comment); } flowParseTypeInitialiser(tok?: TokenType): N.FlowType { const oldInType = this.state.inType; this.state.inType = true; this.expect(tok || tt.colon); const type = this.flowParseType(); this.state.inType = oldInType; return type; } flowParsePredicate(): N.FlowType { const node = this.startNode(); const moduloLoc = this.state.startLoc; const moduloPos = this.state.start; this.expect(tt.modulo); const checksLoc = this.state.startLoc; this.expectContextual("checks"); // Force '%' and 'checks' to be adjacent if ( moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1 ) { this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks); } if (this.eat(tt.parenL)) { node.value = this.parseExpression(); this.expect(tt.parenR); return this.finishNode(node, "DeclaredPredicate"); } else { return this.finishNode(node, "InferredPredicate"); } } flowParseTypeAndPredicateInitialiser(): [?N.FlowType, ?N.FlowPredicate] { const oldInType = this.state.inType; this.state.inType = true; this.expect(tt.colon); let type = null; let predicate = null; if (this.match(tt.modulo)) { this.state.inType = oldInType; predicate = this.flowParsePredicate(); } else { type = this.flowParseType(); this.state.inType = oldInType; if (this.match(tt.modulo)) { predicate = this.flowParsePredicate(); } } return [type, predicate]; } flowParseDeclareClass(node: N.FlowDeclareClass): N.FlowDeclareClass { this.next(); this.flowParseInterfaceish(node, /*isClass*/ true); return this.finishNode(node, "DeclareClass"); } flowParseDeclareFunction( node: N.FlowDeclareFunction, ): N.FlowDeclareFunction { this.next(); const id = (node.id = this.parseIdentifier()); const typeNode = this.startNode(); const typeContainer = this.startNode(); if (this.isRelational("<")) { typeNode.typeParameters = this.flowParseTypeParameterDeclaration(); } else { typeNode.typeParameters = null; } this.expect(tt.parenL); const tmp = this.flowParseFunctionTypeParams(); typeNode.params = tmp.params; typeNode.rest = tmp.rest; this.expect(tt.parenR); [ // $FlowFixMe (destructuring not supported yet) typeNode.returnType, // $FlowFixMe (destructuring not supported yet) node.predicate, ] = this.flowParseTypeAndPredicateInitialiser(); typeContainer.typeAnnotation = this.finishNode( typeNode, "FunctionTypeAnnotation", ); id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation"); this.resetEndLocation(id); this.semicolon(); return this.finishNode(node, "DeclareFunction"); } flowParseDeclare( node: N.FlowDeclare, insideModule?: boolean, ): N.FlowDeclare { if (this.match(tt._class)) { return this.flowParseDeclareClass(node); } else if (this.match(tt._function)) { return this.flowParseDeclareFunction(node); } else if (this.match(tt._var)) { return this.flowParseDeclareVariable(node); } else if (this.eatContextual("module")) { if (this.match(tt.dot)) { return this.flowParseDeclareModuleExports(node); } else { if (insideModule) { this.raise(this.state.lastTokStart, FlowErrors.NestedDeclareModule); } return this.flowParseDeclareModule(node); } } else if (this.isContextual("type")) { return this.flowParseDeclareTypeAlias(node); } else if (this.isContextual("opaque")) { return this.flowParseDeclareOpaqueType(node); } else if (this.isContextual("interface")) { return this.flowParseDeclareInterface(node); } else if (this.match(tt._export)) { return this.flowParseDeclareExportDeclaration(node, insideModule); } else { throw this.unexpected(); } } flowParseDeclareVariable( node: N.FlowDeclareVariable, ): N.FlowDeclareVariable { this.next(); node.id = this.flowParseTypeAnnotatableIdentifier( /*allowPrimitiveOverride*/ true, ); this.scope.declareName(node.id.name, BIND_VAR, node.id.start); this.semicolon(); return this.finishNode(node, "DeclareVariable"); } flowParseDeclareModule(node: N.FlowDeclareModule): N.FlowDeclareModule { this.scope.enter(SCOPE_OTHER); if (this.match(tt.string)) { node.id = this.parseExprAtom(); } else { node.id = this.parseIdentifier(); } const bodyNode = (node.body = this.startNode()); const body = (bodyNode.body = []); this.expect(tt.braceL); while (!this.match(tt.braceR)) { let bodyNode = this.startNode(); if (this.match(tt._import)) { this.next(); if (!this.isContextual("type") && !this.match(tt._typeof)) { this.raise( this.state.lastTokStart, FlowErrors.InvalidNonTypeImportInDeclareModule, ); } this.parseImport(bodyNode); } else { this.expectContextual( "declare", FlowErrors.UnsupportedStatementInDeclareModule, ); bodyNode = this.flowParseDeclare(bodyNode, true); } body.push(bodyNode); } this.scope.exit(); this.expect(tt.braceR); this.finishNode(bodyNode, "BlockStatement"); let kind = null; let hasModuleExport = false; body.forEach(bodyElement => { if (isEsModuleType(bodyElement)) { if (kind === "CommonJS") { this.raise( bodyElement.start, FlowErrors.AmbiguousDeclareModuleKind, ); } kind = "ES"; } else if (bodyElement.type === "DeclareModuleExports") { if (hasModuleExport) { this.raise( bodyElement.start, FlowErrors.DuplicateDeclareModuleExports, ); } if (kind === "ES") { this.raise( bodyElement.start, FlowErrors.AmbiguousDeclareModuleKind, ); } kind = "CommonJS"; hasModuleExport = true; } }); node.kind = kind || "CommonJS"; return this.finishNode(node, "DeclareModule"); } flowParseDeclareExportDeclaration( node: N.FlowDeclareExportDeclaration, insideModule: ?boolean, ): N.FlowDeclareExportDeclaration { this.expect(tt._export); if (this.eat(tt._default)) { if (this.match(tt._function) || this.match(tt._class)) { // declare export default class ... // declare export default function ... node.declaration = this.flowParseDeclare(this.startNode()); } else { // declare export default [type]; node.declaration = this.flowParseType(); this.semicolon(); } node.default = true; return this.finishNode(node, "DeclareExportDeclaration"); } else { if ( this.match(tt._const) || this.isLet() || ((this.isContextual("type") || this.isContextual("interface")) && !insideModule) ) { const label = this.state.value; const suggestion = exportSuggestions[label]; throw this.raise( this.state.start, FlowErrors.UnsupportedDeclareExportKind, label, suggestion, ); } if ( this.match(tt._var) || // declare export var ... this.match(tt._function) || // declare export function ... this.match(tt._class) || // declare export class ... this.isContextual("opaque") // declare export opaque .. ) { node.declaration = this.flowParseDeclare(this.startNode()); node.default = false; return this.finishNode(node, "DeclareExportDeclaration"); } else if ( this.match(tt.star) || // declare export * from '' this.match(tt.braceL) || // declare export {} ... this.isContextual("interface") || // declare export interface ... this.isContextual("type") || // declare export type ... this.isContextual("opaque") // declare export opaque type ... ) { node = this.parseExport(node); if (node.type === "ExportNamedDeclaration") { // flow does not support the ExportNamedDeclaration // $FlowIgnore node.type = "ExportDeclaration"; // $FlowFixMe node.default = false; delete node.exportKind; } // $FlowIgnore node.type = "Declare" + node.type; return node; } } throw this.unexpected(); } flowParseDeclareModuleExports( node: N.FlowDeclareModuleExports, ): N.FlowDeclareModuleExports { this.next(); this.expectContextual("exports"); node.typeAnnotation = this.flowParseTypeAnnotation(); this.semicolon(); return this.finishNode(node, "DeclareModuleExports"); } flowParseDeclareTypeAlias( node: N.FlowDeclareTypeAlias, ): N.FlowDeclareTypeAlias { this.next(); this.flowParseTypeAlias(node); // Don't do finishNode as we don't want to process comments twice node.type = "DeclareTypeAlias"; return node; } flowParseDeclareOpaqueType( node: N.FlowDeclareOpaqueType, ): N.FlowDeclareOpaqueType { this.next(); this.flowParseOpaqueType(node, true); // Don't do finishNode as we don't want to process comments twice node.type = "DeclareOpaqueType"; return node; } flowParseDeclareInterface( node: N.FlowDeclareInterface, ): N.FlowDeclareInterface { this.next(); this.flowParseInterfaceish(node); return this.finishNode(node, "DeclareInterface"); } // Interfaces flowParseInterfaceish( node: N.FlowDeclare, isClass?: boolean = false, ): void { 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(); } else { node.typeParameters = null; } node.extends = []; node.implements = []; node.mixins = []; if (this.eat(tt._extends)) { do { node.extends.push(this.flowParseInterfaceExtends()); } while (!isClass && this.eat(tt.comma)); } if (this.isContextual("mixins")) { this.next(); do { node.mixins.push(this.flowParseInterfaceExtends()); } while (this.eat(tt.comma)); } if (this.isContextual("implements")) { this.next(); do { node.implements.push(this.flowParseInterfaceExtends()); } while (this.eat(tt.comma)); } node.body = this.flowParseObjectType({ allowStatic: isClass, allowExact: false, allowSpread: false, allowProto: isClass, allowInexact: false, }); } flowParseInterfaceExtends(): N.FlowInterfaceExtends { const node = this.startNode(); node.id = this.flowParseQualifiedTypeIdentifier(); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterInstantiation(); } else { node.typeParameters = null; } return this.finishNode(node, "InterfaceExtends"); } flowParseInterface(node: N.FlowInterface): N.FlowInterface { this.flowParseInterfaceish(node); return this.finishNode(node, "InterfaceDeclaration"); } checkNotUnderscore(word: string) { if (word === "_") { this.raise(this.state.start, FlowErrors.UnexpectedReservedUnderscore); } } checkReservedType(word: string, startLoc: number, declaration?: boolean) { if (!reservedTypes.has(word)) return; this.raise( startLoc, declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, word, ); } 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( /* liberal */ false, /* declaration */ true, ); this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } else { node.typeParameters = null; } node.right = this.flowParseTypeInitialiser(tt.eq); this.semicolon(); return this.finishNode(node, "TypeAlias"); } flowParseOpaqueType( node: N.FlowOpaqueType, declare: boolean, ): N.FlowOpaqueType { this.expectContextual("type"); node.id = this.flowParseRestrictedIdentifier( /* liberal */ true, /* declaration */ true, ); this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } else { node.typeParameters = null; } // Parse the supertype node.supertype = null; if (this.match(tt.colon)) { node.supertype = this.flowParseTypeInitialiser(tt.colon); } node.impltype = null; if (!declare) { node.impltype = this.flowParseTypeInitialiser(tt.eq); } this.semicolon(); return this.finishNode(node, "OpaqueType"); } // Type annotations flowParseTypeParameter(requireDefault?: boolean = false): N.TypeParameter { const nodeStart = this.state.start; const node = this.startNode(); const variance = this.flowParseVariance(); const ident = this.flowParseTypeAnnotatableIdentifier(); node.name = ident.name; node.variance = variance; node.bound = ident.typeAnnotation; if (this.match(tt.eq)) { this.eat(tt.eq); node.default = this.flowParseType(); } else { if (requireDefault) { this.raise(nodeStart, FlowErrors.MissingTypeParamDefault); } } return this.finishNode(node, "TypeParameter"); } flowParseTypeParameterDeclaration(): N.TypeParameterDeclaration { const oldInType = this.state.inType; const node = this.startNode(); node.params = []; this.state.inType = true; // istanbul ignore else: this condition is already checked at all call sites if (this.isRelational("<") || this.match(tt.jsxTagStart)) { this.next(); } else { this.unexpected(); } let defaultRequired = false; do { const typeParameter = this.flowParseTypeParameter(defaultRequired); node.params.push(typeParameter); if (typeParameter.default) { defaultRequired = true; } if (!this.isRelational(">")) { this.expect(tt.comma); } } while (!this.isRelational(">")); this.expectRelational(">"); this.state.inType = oldInType; return this.finishNode(node, "TypeParameterDeclaration"); } flowParseTypeParameterInstantiation(): N.TypeParameterInstantiation { const node = this.startNode(); const oldInType = this.state.inType; node.params = []; this.state.inType = true; this.expectRelational("<"); const oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = false; while (!this.isRelational(">")) { node.params.push(this.flowParseType()); if (!this.isRelational(">")) { this.expect(tt.comma); } } this.state.noAnonFunctionType = oldNoAnonFunctionType; this.expectRelational(">"); this.state.inType = oldInType; return this.finishNode(node, "TypeParameterInstantiation"); } flowParseTypeParameterInstantiationCallOrNew(): N.TypeParameterInstantiation { const node = this.startNode(); const oldInType = this.state.inType; node.params = []; this.state.inType = true; this.expectRelational("<"); while (!this.isRelational(">")) { node.params.push(this.flowParseTypeOrImplicitInstantiation()); if (!this.isRelational(">")) { this.expect(tt.comma); } } this.expectRelational(">"); this.state.inType = oldInType; return this.finishNode(node, "TypeParameterInstantiation"); } flowParseInterfaceType(): N.FlowInterfaceType { const node = this.startNode(); this.expectContextual("interface"); node.extends = []; if (this.eat(tt._extends)) { do { node.extends.push(this.flowParseInterfaceExtends()); } while (this.eat(tt.comma)); } node.body = this.flowParseObjectType({ allowStatic: false, allowExact: false, allowSpread: false, allowProto: false, allowInexact: false, }); return this.finishNode(node, "InterfaceTypeAnnotation"); } flowParseObjectPropertyKey(): N.Expression { return this.match(tt.num) || this.match(tt.string) ? this.parseExprAtom() : this.parseIdentifier(true); } flowParseObjectTypeIndexer( node: N.FlowObjectTypeIndexer, isStatic: boolean, variance: ?N.FlowVariance, ): N.FlowObjectTypeIndexer { node.static = isStatic; // Note: bracketL has already been consumed if (this.lookahead().type === tt.colon) { node.id = this.flowParseObjectPropertyKey(); node.key = this.flowParseTypeInitialiser(); } else { node.id = null; node.key = this.flowParseType(); } this.expect(tt.bracketR); node.value = this.flowParseTypeInitialiser(); node.variance = variance; return this.finishNode(node, "ObjectTypeIndexer"); } flowParseObjectTypeInternalSlot( node: N.FlowObjectTypeInternalSlot, isStatic: boolean, ): N.FlowObjectTypeInternalSlot { node.static = isStatic; // Note: both bracketL have already been consumed node.id = this.flowParseObjectPropertyKey(); this.expect(tt.bracketR); this.expect(tt.bracketR); if (this.isRelational("<") || this.match(tt.parenL)) { node.method = true; node.optional = false; node.value = this.flowParseObjectTypeMethodish( this.startNodeAt(node.start, node.loc.start), ); } else { node.method = false; if (this.eat(tt.question)) { node.optional = true; } node.value = this.flowParseTypeInitialiser(); } return this.finishNode(node, "ObjectTypeInternalSlot"); } flowParseObjectTypeMethodish( node: N.FlowFunctionTypeAnnotation, ): N.FlowFunctionTypeAnnotation { node.params = []; node.rest = null; node.typeParameters = null; if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } this.expect(tt.parenL); while (!this.match(tt.parenR) && !this.match(tt.ellipsis)) { node.params.push(this.flowParseFunctionTypeParam()); if (!this.match(tt.parenR)) { this.expect(tt.comma); } } if (this.eat(tt.ellipsis)) { node.rest = this.flowParseFunctionTypeParam(); } this.expect(tt.parenR); node.returnType = this.flowParseTypeInitialiser(); return this.finishNode(node, "FunctionTypeAnnotation"); } flowParseObjectTypeCallProperty( node: N.FlowObjectTypeCallProperty, isStatic: boolean, ): N.FlowObjectTypeCallProperty { const valueNode = this.startNode(); node.static = isStatic; node.value = this.flowParseObjectTypeMethodish(valueNode); return this.finishNode(node, "ObjectTypeCallProperty"); } flowParseObjectType({ allowStatic, allowExact, allowSpread, allowProto, allowInexact, }: { allowStatic: boolean, allowExact: boolean, allowSpread: boolean, allowProto: boolean, allowInexact: boolean, }): N.FlowObjectTypeAnnotation { const oldInType = this.state.inType; this.state.inType = true; const nodeStart = this.startNode(); nodeStart.callProperties = []; nodeStart.properties = []; nodeStart.indexers = []; nodeStart.internalSlots = []; let endDelim; let exact; let inexact = false; if (allowExact && this.match(tt.braceBarL)) { this.expect(tt.braceBarL); endDelim = tt.braceBarR; exact = true; } else { this.expect(tt.braceL); endDelim = tt.braceR; exact = false; } nodeStart.exact = exact; while (!this.match(endDelim)) { let isStatic = false; let protoStart: ?number = null; let inexactStart: ?number = null; const node = this.startNode(); if (allowProto && this.isContextual("proto")) { const lookahead = this.lookahead(); if (lookahead.type !== tt.colon && lookahead.type !== tt.question) { this.next(); protoStart = this.state.start; allowStatic = false; } } if (allowStatic && this.isContextual("static")) { const lookahead = this.lookahead(); // static is a valid identifier name if (lookahead.type !== tt.colon && lookahead.type !== tt.question) { this.next(); isStatic = true; } } const variance = this.flowParseVariance(); if (this.eat(tt.bracketL)) { if (protoStart != null) { this.unexpected(protoStart); } if (this.eat(tt.bracketL)) { if (variance) { this.unexpected(variance.start); } nodeStart.internalSlots.push( this.flowParseObjectTypeInternalSlot(node, isStatic), ); } else { nodeStart.indexers.push( this.flowParseObjectTypeIndexer(node, isStatic, variance), ); } } else if (this.match(tt.parenL) || this.isRelational("<")) { if (protoStart != null) { this.unexpected(protoStart); } if (variance) { this.unexpected(variance.start); } nodeStart.callProperties.push( this.flowParseObjectTypeCallProperty(node, isStatic), ); } else { let kind = "init"; if (this.isContextual("get") || this.isContextual("set")) { const lookahead = this.lookahead(); if ( lookahead.type === tt.name || lookahead.type === tt.string || lookahead.type === tt.num ) { kind = this.state.value; this.next(); } } const propOrInexact = this.flowParseObjectTypeProperty( node, isStatic, protoStart, variance, kind, allowSpread, 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); /* The inexact flag should only be added on ObjectTypeAnnotations that * are not the body of an interface, declare interface, or declare class. * Since spreads are only allowed in object types, checking that is * sufficient here. */ if (allowSpread) { nodeStart.inexact = inexact; } const out = this.finishNode(nodeStart, "ObjectTypeAnnotation"); this.state.inType = oldInType; return out; } flowParseObjectTypeProperty( node: N.FlowObjectTypeProperty | N.FlowObjectTypeSpreadProperty, isStatic: boolean, protoStart: ?number, variance: ?N.FlowVariance, kind: string, allowSpread: boolean, allowInexact: boolean, ): (N.FlowObjectTypeProperty | N.FlowObjectTypeSpreadProperty) | null { 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.raise(this.state.lastTokStart, FlowErrors.UnexpectedSpreadType); } if (protoStart != null) { this.unexpected(protoStart); } if (variance) { this.raise(variance.start, FlowErrors.SpreadVariance); } node.argument = this.flowParseType(); return this.finishNode(node, "ObjectTypeSpreadProperty"); } else { node.key = this.flowParseObjectPropertyKey(); node.static = isStatic; node.proto = protoStart != null; node.kind = kind; let optional = false; if (this.isRelational("<") || this.match(tt.parenL)) { // This is a method property node.method = true; if (protoStart != null) { this.unexpected(protoStart); } if (variance) { this.unexpected(variance.start); } node.value = this.flowParseObjectTypeMethodish( this.startNodeAt(node.start, node.loc.start), ); if (kind === "get" || kind === "set") { this.flowCheckGetterSetterParams(node); } } else { if (kind !== "init") this.unexpected(); node.method = false; if (this.eat(tt.question)) { optional = true; } node.value = this.flowParseTypeInitialiser(); node.variance = variance; } node.optional = optional; return this.finishNode(node, "ObjectTypeProperty"); } } // This is similar to checkGetterSetterParams, but as // @babel/parser uses non estree properties we cannot reuse it here flowCheckGetterSetterParams( property: N.FlowObjectTypeProperty | N.FlowObjectTypeSpreadProperty, ): void { const paramCount = property.kind === "get" ? 0 : 1; const start = property.start; const length = property.value.params.length + (property.value.rest ? 1 : 0); if (length !== paramCount) { if (property.kind === "get") { this.raise(start, Errors.BadGetterArity); } else { this.raise(start, Errors.BadSetterArity); } } if (property.kind === "set" && property.value.rest) { this.raise(start, Errors.BadSetterRestParameter); } } flowObjectTypeSemicolon(): void { if ( !this.eat(tt.semi) && !this.eat(tt.comma) && !this.match(tt.braceR) && !this.match(tt.braceBarR) ) { this.unexpected(); } } flowParseQualifiedTypeIdentifier( startPos?: number, startLoc?: Position, id?: N.Identifier, ): N.FlowQualifiedTypeIdentifier { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; let node = id || this.flowParseRestrictedIdentifier(true); while (this.eat(tt.dot)) { const node2 = this.startNodeAt(startPos, startLoc); node2.qualification = node; node2.id = this.flowParseRestrictedIdentifier(true); node = this.finishNode(node2, "QualifiedTypeIdentifier"); } return node; } flowParseGenericType( startPos: number, startLoc: Position, id: N.Identifier, ): N.FlowGenericTypeAnnotation { const node = this.startNodeAt(startPos, startLoc); node.typeParameters = null; node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterInstantiation(); } return this.finishNode(node, "GenericTypeAnnotation"); } flowParseTypeofType(): N.FlowTypeofTypeAnnotation { const node = this.startNode(); this.expect(tt._typeof); node.argument = this.flowParsePrimaryType(); return this.finishNode(node, "TypeofTypeAnnotation"); } flowParseTupleType(): N.FlowTupleTypeAnnotation { const node = this.startNode(); node.types = []; this.expect(tt.bracketL); // We allow trailing commas while (this.state.pos < this.length && !this.match(tt.bracketR)) { node.types.push(this.flowParseType()); if (this.match(tt.bracketR)) break; this.expect(tt.comma); } this.expect(tt.bracketR); return this.finishNode(node, "TupleTypeAnnotation"); } flowParseFunctionTypeParam(): N.FlowFunctionTypeParam { let name = null; let optional = false; let typeAnnotation = null; const node = this.startNode(); const lh = this.lookahead(); if (lh.type === tt.colon || lh.type === tt.question) { name = this.parseIdentifier(); if (this.eat(tt.question)) { optional = true; } typeAnnotation = this.flowParseTypeInitialiser(); } else { typeAnnotation = this.flowParseType(); } node.name = name; node.optional = optional; node.typeAnnotation = typeAnnotation; return this.finishNode(node, "FunctionTypeParam"); } reinterpretTypeAsFunctionTypeParam( type: N.FlowType, ): N.FlowFunctionTypeParam { const node = this.startNodeAt(type.start, type.loc.start); node.name = null; node.optional = false; node.typeAnnotation = type; return this.finishNode(node, "FunctionTypeParam"); } flowParseFunctionTypeParams( params: N.FlowFunctionTypeParam[] = [], ): { params: N.FlowFunctionTypeParam[], rest: ?N.FlowFunctionTypeParam } { let rest: ?N.FlowFunctionTypeParam = null; while (!this.match(tt.parenR) && !this.match(tt.ellipsis)) { params.push(this.flowParseFunctionTypeParam()); if (!this.match(tt.parenR)) { this.expect(tt.comma); } } if (this.eat(tt.ellipsis)) { rest = this.flowParseFunctionTypeParam(); } return { params, rest }; } flowIdentToTypeAnnotation( startPos: number, startLoc: Position, node: N.FlowTypeAnnotation, id: N.Identifier, ): N.FlowTypeAnnotation { switch (id.name) { case "any": return this.finishNode(node, "AnyTypeAnnotation"); case "bool": case "boolean": return this.finishNode(node, "BooleanTypeAnnotation"); case "mixed": return this.finishNode(node, "MixedTypeAnnotation"); case "empty": return this.finishNode(node, "EmptyTypeAnnotation"); case "number": return this.finishNode(node, "NumberTypeAnnotation"); 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); } } // The parsing of types roughly parallels the parsing of expressions, and // primary types are kind of like primary expressions...they're the // primitives with which other types are constructed. flowParsePrimaryType(): N.FlowTypeAnnotation { const startPos = this.state.start; const startLoc = this.state.startLoc; const node = this.startNode(); let tmp; let type; let isGroupedType = false; const oldNoAnonFunctionType = this.state.noAnonFunctionType; switch (this.state.type) { case tt.name: if (this.isContextual("interface")) { return this.flowParseInterfaceType(); } return this.flowIdentToTypeAnnotation( startPos, startLoc, node, this.parseIdentifier(), ); case tt.braceL: return this.flowParseObjectType({ allowStatic: false, allowExact: false, allowSpread: true, allowProto: false, allowInexact: true, }); case tt.braceBarL: return this.flowParseObjectType({ allowStatic: false, allowExact: true, allowSpread: true, allowProto: false, allowInexact: false, }); case tt.bracketL: this.state.noAnonFunctionType = false; type = this.flowParseTupleType(); this.state.noAnonFunctionType = oldNoAnonFunctionType; return type; case tt.relational: if (this.state.value === "<") { node.typeParameters = this.flowParseTypeParameterDeclaration(); this.expect(tt.parenL); tmp = this.flowParseFunctionTypeParams(); node.params = tmp.params; node.rest = tmp.rest; this.expect(tt.parenR); this.expect(tt.arrow); node.returnType = this.flowParseType(); return this.finishNode(node, "FunctionTypeAnnotation"); } break; case tt.parenL: this.next(); // Check to see if this is actually a grouped type if (!this.match(tt.parenR) && !this.match(tt.ellipsis)) { if (this.match(tt.name)) { const token = this.lookahead().type; isGroupedType = token !== tt.question && token !== tt.colon; } else { isGroupedType = true; } } if (isGroupedType) { this.state.noAnonFunctionType = false; type = this.flowParseType(); this.state.noAnonFunctionType = oldNoAnonFunctionType; // A `,` or a `) =>` means this is an anonymous function type if ( this.state.noAnonFunctionType || !( this.match(tt.comma) || (this.match(tt.parenR) && this.lookahead().type === tt.arrow) ) ) { this.expect(tt.parenR); return type; } else { // Eat a comma if there is one this.eat(tt.comma); } } if (type) { tmp = this.flowParseFunctionTypeParams([ this.reinterpretTypeAsFunctionTypeParam(type), ]); } else { tmp = this.flowParseFunctionTypeParams(); } node.params = tmp.params; node.rest = tmp.rest; this.expect(tt.parenR); this.expect(tt.arrow); node.returnType = this.flowParseType(); node.typeParameters = null; return this.finishNode(node, "FunctionTypeAnnotation"); case tt.string: return this.parseLiteral( this.state.value, "StringLiteralTypeAnnotation", ); case tt._true: case tt._false: node.value = this.match(tt._true); this.next(); return this.finishNode(node, "BooleanLiteralTypeAnnotation"); case tt.plusMin: if (this.state.value === "-") { this.next(); if (this.match(tt.num)) { return this.parseLiteral( -this.state.value, "NumberLiteralTypeAnnotation", node.start, node.loc.start, ); } if (this.match(tt.bigint)) { return this.parseLiteral( -this.state.value, "BigIntLiteralTypeAnnotation", node.start, node.loc.start, ); } throw this.raise( this.state.start, FlowErrors.UnexpectedSubtractionOperand, ); } throw this.unexpected(); case tt.num: return this.parseLiteral( this.state.value, "NumberLiteralTypeAnnotation", ); case tt.bigint: return this.parseLiteral( this.state.value, "BigIntLiteralTypeAnnotation", ); case tt._void: this.next(); return this.finishNode(node, "VoidTypeAnnotation"); case tt._null: this.next(); return this.finishNode(node, "NullLiteralTypeAnnotation"); case tt._this: this.next(); return this.finishNode(node, "ThisTypeAnnotation"); case tt.star: this.next(); return this.finishNode(node, "ExistsTypeAnnotation"); default: if (this.state.type.keyword === "typeof") { return this.flowParseTypeofType(); } else if (this.state.type.keyword) { const label = this.state.type.label; this.next(); return super.createIdentifier(node, label); } } throw this.unexpected(); } flowParsePostfixType(): N.FlowTypeAnnotation { const startPos = this.state.start, startLoc = this.state.startLoc; let type = this.flowParsePrimaryType(); while (this.match(tt.bracketL) && !this.canInsertSemicolon()) { const node = this.startNodeAt(startPos, startLoc); node.elementType = type; this.expect(tt.bracketL); this.expect(tt.bracketR); type = this.finishNode(node, "ArrayTypeAnnotation"); } return type; } flowParsePrefixType(): N.FlowTypeAnnotation { const node = this.startNode(); if (this.eat(tt.question)) { node.typeAnnotation = this.flowParsePrefixType(); return this.finishNode(node, "NullableTypeAnnotation"); } else { return this.flowParsePostfixType(); } } flowParseAnonFunctionWithoutParens(): N.FlowTypeAnnotation { const param = this.flowParsePrefixType(); if (!this.state.noAnonFunctionType && this.eat(tt.arrow)) { // TODO: This should be a type error. Passing in a SourceLocation, and it expects a Position. const node = this.startNodeAt(param.start, param.loc.start); node.params = [this.reinterpretTypeAsFunctionTypeParam(param)]; node.rest = null; node.returnType = this.flowParseType(); node.typeParameters = null; return this.finishNode(node, "FunctionTypeAnnotation"); } return param; } flowParseIntersectionType(): N.FlowTypeAnnotation { const node = this.startNode(); this.eat(tt.bitwiseAND); const type = this.flowParseAnonFunctionWithoutParens(); node.types = [type]; while (this.eat(tt.bitwiseAND)) { node.types.push(this.flowParseAnonFunctionWithoutParens()); } return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation"); } flowParseUnionType(): N.FlowTypeAnnotation { const node = this.startNode(); this.eat(tt.bitwiseOR); const type = this.flowParseIntersectionType(); node.types = [type]; while (this.eat(tt.bitwiseOR)) { node.types.push(this.flowParseIntersectionType()); } return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation"); } flowParseType(): N.FlowTypeAnnotation { const oldInType = this.state.inType; this.state.inType = true; const type = this.flowParseUnionType(); this.state.inType = oldInType; // Ensure that a brace after a function generic type annotation is a // statement, except in arrow functions (noAnonFunctionType) this.state.exprAllowed = this.state.exprAllowed || this.state.noAnonFunctionType; return type; } flowParseTypeOrImplicitInstantiation(): N.FlowTypeAnnotation { if (this.state.type === tt.name && this.state.value === "_") { const startPos = this.state.start; const startLoc = this.state.startLoc; const node = this.parseIdentifier(); return this.flowParseGenericType(startPos, startLoc, node); } else { return this.flowParseType(); } } flowParseTypeAnnotation(): N.FlowTypeAnnotation { const node = this.startNode(); node.typeAnnotation = this.flowParseTypeInitialiser(); return this.finishNode(node, "TypeAnnotation"); } flowParseTypeAnnotatableIdentifier( allowPrimitiveOverride?: boolean, ): N.Identifier { const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier(); if (this.match(tt.colon)) { ident.typeAnnotation = this.flowParseTypeAnnotation(); this.resetEndLocation(ident); } return ident; } typeCastToParameter(node: N.Node): N.Node { node.expression.typeAnnotation = node.typeAnnotation; this.resetEndLocation( node.expression, node.typeAnnotation.end, node.typeAnnotation.loc.end, ); return node.expression; } flowParseVariance(): ?N.FlowVariance { let variance = null; if (this.match(tt.plusMin)) { variance = this.startNode(); if (this.state.value === "+") { variance.kind = "plus"; } else { variance.kind = "minus"; } this.next(); this.finishNode(variance, "Variance"); } return variance; } // ================================== // Overrides // ================================== parseFunctionBody( node: N.Function, allowExpressionBody: ?boolean, isMethod?: boolean = false, ): void { if (allowExpressionBody) { return this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod), ); } return super.parseFunctionBody(node, false, isMethod); } parseFunctionBodyAndFinish( node: N.BodilessFunctionOrMethodBase, type: string, isMethod?: boolean = false, ): void { if (this.match(tt.colon)) { const typeNode = this.startNode(); [ // $FlowFixMe (destructuring not supported yet) typeNode.typeAnnotation, // $FlowFixMe (destructuring not supported yet) node.predicate, ] = this.flowParseTypeAndPredicateInitialiser(); node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null; } super.parseFunctionBodyAndFinish(node, type, isMethod); } // interfaces and enums parseStatement(context: ?string, topLevel?: boolean): N.Statement { // strict mode handling of `interface` since it's a reserved word if ( this.state.strict && this.match(tt.name) && this.state.value === "interface" ) { const lookahead = this.lookahead(); if (lookahead.type === tt.name || isKeyword(lookahead.value)) { 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); } const stmt = super.parseStatement(context, topLevel); // We will parse a flow pragma in any comment before the first statement. if (this.flowPragma === undefined && !this.isValidDirective(stmt)) { this.flowPragma = null; } return stmt; } // declares, interfaces and type aliases parseExpressionStatement( node: N.ExpressionStatement, expr: N.Expression, ): N.ExpressionStatement { if (expr.type === "Identifier") { if (expr.name === "declare") { if ( this.match(tt._class) || this.match(tt.name) || this.match(tt._function) || this.match(tt._var) || this.match(tt._export) ) { return this.flowParseDeclare(node); } } else if (this.match(tt.name)) { if (expr.name === "interface") { return this.flowParseInterface(node); } else if (expr.name === "type") { return this.flowParseTypeAlias(node); } else if (expr.name === "opaque") { return this.flowParseOpaqueType(node, false); } } } return super.parseExpressionStatement(node, expr); } // export type shouldParseExportDeclaration(): boolean { return ( this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || (this.shouldParseEnums() && this.isContextual("enum")) || super.shouldParseExportDeclaration() ); } isExportDefaultSpecifier(): boolean { if ( this.match(tt.name) && (this.state.value === "type" || this.state.value === "interface" || this.state.value === "opaque" || (this.shouldParseEnums() && this.state.value === "enum")) ) { return false; } 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, startPos: number, startLoc: Position, refNeedsArrowPos?: ?Pos, ): N.Expression { if (!this.match(tt.question)) return expr; // only use the expensive "tryParse" method if there is a question mark // and if we come from inside parens if (refNeedsArrowPos) { const result = this.tryParse(() => super.parseConditional(expr, 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; const node = this.startNodeAt(startPos, startLoc); let { consequent, failed } = this.tryParseConditionalConsequent(); let [valid, invalid] = this.getArrowLikeExpressions(consequent); if (failed || invalid.length > 0) { const noArrowAt = [...originalNoArrowAt]; if (invalid.length > 0) { this.state = state; this.state.noArrowAt = noArrowAt; for (let i = 0; i < invalid.length; i++) { noArrowAt.push(invalid[i].start); } ({ consequent, failed } = this.tryParseConditionalConsequent()); [valid, invalid] = this.getArrowLikeExpressions(consequent); } if (failed && valid.length > 1) { // if there are two or more possible correct ways of parsing, throw an // error. // 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, FlowErrors.AmbiguousConditionalArrow); } if (failed && valid.length === 1) { this.state = state; this.state.noArrowAt = noArrowAt.concat(valid[0].start); ({ consequent, failed } = this.tryParseConditionalConsequent()); } } this.getArrowLikeExpressions(consequent, true); this.state.noArrowAt = originalNoArrowAt; this.expect(tt.colon); node.test = expr; node.consequent = consequent; node.alternate = this.forwardNoArrowParamsConversionAt(node, () => this.parseMaybeAssign(undefined, undefined, undefined), ); return this.finishNode(node, "ConditionalExpression"); } tryParseConditionalConsequent(): { consequent: N.Expression, failed: boolean, } { this.state.noArrowParamsConversionAt.push(this.state.start); const consequent = this.parseMaybeAssignAllowIn(); const failed = !this.match(tt.colon); this.state.noArrowParamsConversionAt.pop(); return { consequent, failed }; } // Given an expression, walks through out its arrow functions whose body is // an expression and through out conditional expressions. It returns every // function which has been parsed with a return type but could have been // parenthesized expressions. // These functions are separated into two arrays: one containing the ones // whose parameters can be converted to assignable lists, one containing the // others. getArrowLikeExpressions( node: N.Expression, disallowInvalid?: boolean, ): [N.ArrowFunctionExpression[], N.ArrowFunctionExpression[]] { const stack = [node]; const arrows: N.ArrowFunctionExpression[] = []; while (stack.length !== 0) { const node = stack.pop(); if (node.type === "ArrowFunctionExpression") { if (node.typeParameters || !node.returnType) { // This is an arrow expression without ambiguity, so check its parameters this.finishArrowValidation(node); } else { arrows.push(node); } stack.push(node.body); } else if (node.type === "ConditionalExpression") { stack.push(node.consequent); stack.push(node.alternate); } } if (disallowInvalid) { arrows.forEach(node => this.finishArrowValidation(node)); return [arrows, []]; } 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, /* isLHS */ false, ); // 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 { let result: T; if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) { this.state.noArrowParamsConversionAt.push(this.state.start); result = parse(); this.state.noArrowParamsConversionAt.pop(); } else { result = parse(); } return result; } parseParenItem( node: N.Expression, startPos: number, startLoc: Position, ): N.Expression { node = super.parseParenItem(node, startPos, startLoc); if (this.eat(tt.question)) { node.optional = true; // Include questionmark in location of node // Don't use this.finishNode() as otherwise we might process comments twice and // include already consumed parens this.resetEndLocation(node); } if (this.match(tt.colon)) { const typeCastNode = this.startNodeAt(startPos, startLoc); typeCastNode.expression = node; typeCastNode.typeAnnotation = this.flowParseTypeAnnotation(); return this.finishNode(typeCastNode, "TypeCastExpression"); } return node; } assertModuleNodeAllowed(node: N.Node) { if ( (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof")) || (node.type === "ExportNamedDeclaration" && node.exportKind === "type") || (node.type === "ExportAllDeclaration" && node.exportKind === "type") ) { // Allow Flowtype imports and exports in all conditions because // Flow itself does not care about 'sourceType'. return; } super.assertModuleNodeAllowed(node); } parseExport(node: N.Node): N.AnyExport { const decl = super.parseExport(node); if ( decl.type === "ExportNamedDeclaration" || decl.type === "ExportAllDeclaration" ) { decl.exportKind = decl.exportKind || "value"; } return decl; } parseExportDeclaration(node: N.ExportNamedDeclaration): ?N.Declaration { if (this.isContextual("type")) { node.exportKind = "type"; const declarationNode = this.startNode(); this.next(); if (this.match(tt.braceL)) { // export type { foo, bar }; node.specifiers = this.parseExportSpecifiers(); this.parseExportFrom(node); return null; } else { // export type Foo = Bar; return this.flowParseTypeAlias(declarationNode); } } else if (this.isContextual("opaque")) { node.exportKind = "type"; const declarationNode = this.startNode(); this.next(); // export opaque type Foo = Bar; return this.flowParseOpaqueType(declarationNode, false); } else if (this.isContextual("interface")) { node.exportKind = "type"; 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); } } eatExportStar(node: N.Node): boolean { if (super.eatExportStar(...arguments)) return true; if (this.isContextual("type") && this.lookahead().type === tt.star) { node.exportKind = "type"; this.next(); this.next(); return true; } return false; } maybeParseExportNamespaceSpecifier(node: N.Node): boolean { const pos = this.state.start; const hasNamespace = super.maybeParseExportNamespaceSpecifier(node); if (hasNamespace && node.exportKind === "type") { this.unexpected(pos); } return hasNamespace; } parseClassId(node: N.Class, isStatement: boolean, optionalId: ?boolean) { super.parseClassId(node, isStatement, optionalId); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } } parseClassMember( classBody: N.ClassBody, member: any, state: N.ParseClassMemberState, ): 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); 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); if (code === charCodes.leftCurlyBrace && next === charCodes.verticalBar) { return this.finishOp(tt.braceBarL, 2); } else if ( this.state.inType && (code === charCodes.greaterThan || code === charCodes.lessThan) ) { return this.finishOp(tt.relational, 1); } else if (this.state.inType && code === charCodes.questionMark) { // allow double nullable types in Flow: ??string return this.finishOp(tt.question, 1); } else if (isIteratorStart(code, next)) { this.state.isIterator = true; return super.readWord(); } else { return super.getTokenFromCode(code); } } 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, isLHS: boolean = false): N.Node { if (node.type === "TypeCastExpression") { return super.toAssignable(this.typeCastToParameter(node), isLHS); } else { return super.toAssignable(node, isLHS); } } // turn type casts that we found in function parameter head into type annotated params toAssignableList( exprList: N.Expression[], trailingCommaPos?: ?number, isLHS: boolean, ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; if (expr?.type === "TypeCastExpression") { exprList[i] = this.typeCastToParameter(expr); } } return super.toAssignableList(exprList, trailingCommaPos, isLHS); } // this is a list of nodes, from something like a call expression, we need to filter the // type casts that we've found that are illegal in this context toReferencedList( exprList: $ReadOnlyArray, isParenthesizedExpr?: boolean, ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; if ( expr && expr.type === "TypeCastExpression" && !expr.extra?.parenthesized && (exprList.length > 1 || !isParenthesizedExpr) ) { this.raise(expr.typeAnnotation.start, FlowErrors.TypeCastInPattern); } } return exprList; } parseArrayLike( close: TokenType, canBePattern: boolean, isTuple: boolean, refExpressionErrors: ?ExpressionErrors, ): N.ArrayExpression | N.TupleExpression { const node = super.parseArrayLike( close, canBePattern, isTuple, refExpressionErrors, ); // This could be an array pattern: // ([a: string, b: string]) => {} // In this case, we don't have to call toReferencedList. We will // call it, if needed, when we are sure that it is a parenthesized // expression by calling toReferencedListDeep. if (canBePattern && !this.state.maybeInArrowParameters) { this.toReferencedList(node.elements); } return node; } checkLVal( expr: N.Expression, ...args: | [string, BindingTypes | void] | [ string, BindingTypes | void, ?Set, boolean | void, boolean | void, ] ): void { if (expr.type !== "TypeCastExpression") { return super.checkLVal(expr, ...args); } } // parse class property type annotations parseClassProperty(node: N.ClassProperty): N.ClassProperty { if (this.match(tt.colon)) { node.typeAnnotation = this.flowParseTypeAnnotation(); } return super.parseClassProperty(node); } parseClassPrivateProperty( node: N.ClassPrivateProperty, ): N.ClassPrivateProperty { if (this.match(tt.colon)) { node.typeAnnotation = this.flowParseTypeAnnotation(); } return super.parseClassPrivateProperty(node); } // determine whether or not we're currently in the position where a class method would appear isClassMethod(): boolean { return this.isRelational("<") || super.isClassMethod(); } // determine whether or not we're currently in the position where a class property would appear isClassProperty(): boolean { return this.match(tt.colon) || super.isClassProperty(); } isNonstaticConstructor(method: N.ClassMethod | N.ClassProperty): boolean { return !this.match(tt.colon) && super.isNonstaticConstructor(method); } // parse type parameters for class methods pushClassMethod( classBody: N.ClassBody, method: N.ClassMethod, isGenerator: boolean, isAsync: boolean, isConstructor: boolean, allowsDirectSuper: boolean, ): void { if ((method: $FlowFixMe).variance) { this.unexpected((method: $FlowFixMe).variance.start); } delete (method: $FlowFixMe).variance; if (this.isRelational("<")) { method.typeParameters = this.flowParseTypeParameterDeclaration(); } super.pushClassMethod( classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper, ); } pushClassPrivateMethod( classBody: N.ClassBody, method: N.ClassPrivateMethod, isGenerator: boolean, isAsync: boolean, ): void { if ((method: $FlowFixMe).variance) { this.unexpected((method: $FlowFixMe).variance.start); } delete (method: $FlowFixMe).variance; if (this.isRelational("<")) { method.typeParameters = this.flowParseTypeParameterDeclaration(); } super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync); } // parse a the super class type parameters and implements parseClassSuper(node: N.Class): void { super.parseClassSuper(node); if (node.superClass && this.isRelational("<")) { node.superTypeParameters = this.flowParseTypeParameterInstantiation(); } if (this.isContextual("implements")) { this.next(); const implemented: N.FlowClassImplements[] = (node.implements = []); do { const node = this.startNode(); node.id = this.flowParseRestrictedIdentifier(/*liberal*/ true); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterInstantiation(); } else { node.typeParameters = null; } implemented.push(this.finishNode(node, "ClassImplements")); } while (this.eat(tt.comma)); } } parsePropertyName( node: N.ObjectOrClassMember | N.ClassMember | N.TsNamedTypeElementBase, isPrivateNameAllowed: boolean, ): N.Identifier { const variance = this.flowParseVariance(); const key = super.parsePropertyName(node, isPrivateNameAllowed); // $FlowIgnore ("variance" not defined on TsNamedTypeElementBase) node.variance = variance; return key; } // parse type parameters for object method shorthand parseObjPropValue( prop: N.ObjectMember, startPos: ?number, startLoc: ?Position, isGenerator: boolean, isAsync: boolean, isPattern: boolean, isAccessor: boolean, refExpressionErrors: ?ExpressionErrors, ): void { if ((prop: $FlowFixMe).variance) { this.unexpected((prop: $FlowFixMe).variance.start); } delete (prop: $FlowFixMe).variance; let typeParameters; // method shorthand if (this.isRelational("<") && !isAccessor) { typeParameters = this.flowParseTypeParameterDeclaration(); if (!this.match(tt.parenL)) this.unexpected(); } super.parseObjPropValue( prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors, ); // add typeParameters if we found them if (typeParameters) { (prop.value || prop).typeParameters = typeParameters; } } parseAssignableListItemTypes(param: N.Pattern): N.Pattern { if (this.eat(tt.question)) { if (param.type !== "Identifier") { this.raise(param.start, FlowErrors.OptionalBindingPattern); } ((param: any): N.Identifier).optional = true; } if (this.match(tt.colon)) { param.typeAnnotation = this.flowParseTypeAnnotation(); } this.resetEndLocation(param); return param; } parseMaybeDefault( startPos?: ?number, startLoc?: ?Position, left?: ?N.Pattern, ): N.Pattern { const node = super.parseMaybeDefault(startPos, startLoc, left); if ( node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start ) { this.raise(node.typeAnnotation.start, FlowErrors.TypeBeforeInitializer); } return node; } shouldParseDefaultImport(node: N.ImportDeclaration): boolean { if (!hasTypeImportKind(node)) { return super.shouldParseDefaultImport(node); } return isMaybeDefaultImport(this.state); } parseImportSpecifierLocal( node: N.ImportDeclaration, specifier: N.Node, type: string, contextDescription: string, ): void { specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier( /* liberal */ true, /* declaration */ true, ) : this.parseIdentifier(); this.checkLVal(specifier.local, contextDescription, BIND_LEXICAL); node.specifiers.push(this.finishNode(specifier, type)); } // parse typeof and type imports maybeParseDefaultImportSpecifier(node: N.ImportDeclaration): boolean { node.importKind = "value"; let kind = null; if (this.match(tt._typeof)) { kind = "typeof"; } else if (this.isContextual("type")) { kind = "type"; } if (kind) { const lh = this.lookahead(); // import type * is not allowed if (kind === "type" && lh.type === tt.star) { this.unexpected(lh.start); } if ( isMaybeDefaultImport(lh) || lh.type === tt.braceL || lh.type === tt.star ) { this.next(); node.importKind = kind; } } return super.maybeParseDefaultImportSpecifier(node); } // parse import-type/typeof shorthand parseImportSpecifier(node: N.ImportDeclaration): void { const specifier = this.startNode(); const firstIdentLoc = this.state.start; const firstIdent = this.parseModuleExportName(); let specifierTypeKind = null; if (firstIdent.type === "Identifier") { if (firstIdent.name === "type") { specifierTypeKind = "type"; } else if (firstIdent.name === "typeof") { specifierTypeKind = "typeof"; } } let isBinding = false; if (this.isContextual("as") && !this.isLookaheadContextual("as")) { const as_ident = this.parseIdentifier(true); if ( specifierTypeKind !== null && !this.match(tt.name) && !this.state.type.keyword ) { // `import {type as ,` or `import {type as }` specifier.imported = as_ident; specifier.importKind = specifierTypeKind; specifier.local = as_ident.__clone(); } else { // `import {type as foo` specifier.imported = firstIdent; specifier.importKind = null; specifier.local = this.parseIdentifier(); } } else if ( specifierTypeKind !== null && (this.match(tt.name) || this.state.type.keyword) ) { // `import {type foo` specifier.imported = this.parseIdentifier(true); specifier.importKind = specifierTypeKind; if (this.eatContextual("as")) { specifier.local = this.parseIdentifier(); } else { isBinding = true; specifier.local = specifier.imported.__clone(); } } else { if (firstIdent.type === "StringLiteral") { throw this.raise( specifier.start, Errors.ImportBindingIsString, firstIdent.value, ); } isBinding = true; specifier.imported = firstIdent; specifier.importKind = null; specifier.local = specifier.imported.__clone(); } const nodeIsTypeImport = hasTypeImportKind(node); const specifierIsTypeImport = hasTypeImportKind(specifier); if (nodeIsTypeImport && specifierIsTypeImport) { this.raise( firstIdentLoc, FlowErrors.ImportTypeShorthandOnlyInPureImport, ); } if (nodeIsTypeImport || specifierIsTypeImport) { this.checkReservedType( specifier.local.name, specifier.local.start, /* declaration */ true, ); } if (isBinding && !nodeIsTypeImport && !specifierIsTypeImport) { this.checkReservedWord( specifier.local.name, specifier.start, true, true, ); } this.checkLVal(specifier.local, "import specifier", BIND_LEXICAL); node.specifiers.push(this.finishNode(specifier, "ImportSpecifier")); } // parse function type parameters - function foo() {} parseFunctionParams(node: N.Function, allowModifiers?: boolean): void { // $FlowFixMe const kind = node.kind; if (kind !== "get" && kind !== "set" && this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } super.parseFunctionParams(node, allowModifiers); } // parse flow type annotations on variable declarator heads - let foo: string = bar parseVarId( decl: N.VariableDeclarator, kind: "var" | "let" | "const", ): void { super.parseVarId(decl, kind); if (this.match(tt.colon)) { decl.id.typeAnnotation = this.flowParseTypeAnnotation(); this.resetEndLocation(decl.id); // set end position to end of type } } // parse the return type of an async arrow function - let foo = (async (): number => {}); parseAsyncArrowFromCallExpression( node: N.ArrowFunctionExpression, call: N.CallExpression, ): N.ArrowFunctionExpression { if (this.match(tt.colon)) { const oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = true; node.returnType = this.flowParseTypeAnnotation(); this.state.noAnonFunctionType = oldNoAnonFunctionType; } return super.parseAsyncArrowFromCallExpression(node, call); } // todo description shouldParseAsyncArrow(): boolean { return this.match(tt.colon) || super.shouldParseAsyncArrow(); } // We need to support type parameter declarations for arrow functions. This // is tricky. There are three situations we need to handle // // 1. This is either JSX or an arrow function. We'll try JSX first. If that // fails, we'll try an arrow function. If that fails, we'll throw the JSX // error. // 2. This is an arrow function. We'll parse the type parameter declaration, // parse the rest, make sure the rest is an arrow function, and go from // there // 3. This is neither. Just call the super method parseMaybeAssign( refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ): N.Expression { let state = null; let jsx; if ( this.hasPlugin("jsx") && (this.match(tt.jsxTagStart) || this.isRelational("<")) ) { state = this.state.clone(); jsx = this.tryParse( () => super.parseMaybeAssign( 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 (jsx?.error || this.isRelational("<")) { state = state || this.state.clone(); let typeParameters; const arrow = this.tryParse(abort => { typeParameters = this.flowParseTypeParameterDeclaration(); const arrowExpression = this.forwardNoArrowParamsConversionAt( typeParameters, () => { const result = super.parseMaybeAssign( refExpressionErrors, afterLeftParse, refNeedsArrowPos, ); this.resetStartLocationFromNode(result, typeParameters); return result; }, ); // (() => {}: any); if ( arrowExpression.type !== "ArrowFunctionExpression" && arrowExpression.extra?.parenthesized ) { abort(); } // The above can return a TypeCastExpression when the arrow // expression is not wrapped in parens. See also `this.parseParenItem`. const expr = this.maybeUnwrapTypeCastExpression(arrowExpression); expr.typeParameters = typeParameters; this.resetStartLocationFromNode(expr, typeParameters); return arrowExpression; }, state); let arrowExpression: ?( | N.ArrowFunctionExpression | N.TypeCastExpression ) = null; if ( arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression" ) { if (!arrow.error && !arrow.aborted) { // async () => {} if (arrow.node.async) { /*:: invariant(typeParameters) */ this.raise( typeParameters.start, FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, ); } return arrow.node; } arrowExpression = arrow.node; } // If we are here, both JSX and Flow parsing attempts 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?.node) { /*:: invariant(jsx.failState) */ this.state = jsx.failState; return jsx.node; } if (arrowExpression) { /*:: invariant(arrow.failState) */ this.state = arrow.failState; return arrowExpression; } if (jsx?.thrown) throw jsx.error; if (arrow.thrown) throw arrow.error; /*:: invariant(typeParameters) */ throw this.raise( typeParameters.start, FlowErrors.UnexpectedTokenAfterTypeParameter, ); } return super.parseMaybeAssign( refExpressionErrors, afterLeftParse, refNeedsArrowPos, ); } // handle return types for arrow functions parseArrow(node: N.ArrowFunctionExpression): ?N.ArrowFunctionExpression { if (this.match(tt.colon)) { const result = this.tryParse(() => { const oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = true; const typeNode = this.startNode(); [ // $FlowFixMe (destructuring not supported yet) typeNode.typeAnnotation, // $FlowFixMe (destructuring not supported yet) node.predicate, ] = this.flowParseTypeAndPredicateInitialiser(); this.state.noAnonFunctionType = oldNoAnonFunctionType; if (this.canInsertSemicolon()) this.unexpected(); if (!this.match(tt.arrow)) this.unexpected(); 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); } shouldParseArrow(): boolean { return this.match(tt.colon) || super.shouldParseArrow(); } setArrowFunctionParameters( node: N.ArrowFunctionExpression, params: N.Expression[], ): void { if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) { node.params = params; } else { super.setArrowFunctionParameters(node, params); } } checkParams( node: N.Function, allowDuplicates: boolean, isArrowFunction: ?boolean, ): void { if ( isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1 ) { return; } return super.checkParams(...arguments); } parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression { return super.parseParenAndDistinguishExpression( canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1, ); } parseSubscripts( base: N.Expression, startPos: number, startLoc: Position, noCalls?: ?boolean, ): N.Expression { if ( base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startPos) !== -1 ) { this.next(); const node = this.startNodeAt(startPos, startLoc); node.callee = base; node.arguments = this.parseCallExpressionArguments(tt.parenR, false); base = this.finishNode(node, "CallExpression"); } else if ( base.type === "Identifier" && base.name === "async" && this.isRelational("<") ) { const state = this.state.clone(); 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; } if (result.node) { this.state = result.failState; return result.node; } throw arrow.error || result.error; } return super.parseSubscripts(base, startPos, startLoc, noCalls); } parseSubscript( base: N.Expression, startPos: number, startLoc: Position, noCalls: ?boolean, subscriptState: N.ParseSubscriptState, ): N.Expression { if (this.match(tt.questionDot) && this.isLookaheadToken_lt()) { subscriptState.optionalChainMember = true; if (noCalls) { subscriptState.stop = true; return base; } this.next(); const node: N.OptionalCallExpression = this.startNodeAt( startPos, startLoc, ); node.callee = base; node.typeArguments = this.flowParseTypeParameterInstantiation(); this.expect(tt.parenL); // $FlowFixMe node.arguments = this.parseCallExpressionArguments(tt.parenR, false); node.optional = true; return this.finishCallExpression(node, /* optional */ true); } else if ( !noCalls && this.shouldParseTypes() && this.isRelational("<") ) { const node = this.startNodeAt(startPos, startLoc); node.callee = base; 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.finishCallExpression( node, subscriptState.optionalChainMember, ); }); if (result.node) { if (result.error) this.state = result.failState; return result.node; } } return super.parseSubscript( base, startPos, startLoc, noCalls, subscriptState, ); } parseNewArguments(node: N.NewExpression): void { let targs = null; if (this.shouldParseTypes() && this.isRelational("<")) { targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew(), ).node; } node.typeArguments = targs; super.parseNewArguments(node); } parseAsyncArrowWithTypeParameters( startPos: number, startLoc: Position, ): ?N.ArrowFunctionExpression { const node = this.startNodeAt(startPos, startLoc); this.parseFunctionParams(node); if (!this.parseArrow(node)) return; return this.parseArrowExpression( node, /* params */ undefined, /* isAsync */ true, ); } readToken_mult_modulo(code: number): void { const next = this.input.charCodeAt(this.state.pos + 1); if ( code === charCodes.asterisk && next === charCodes.slash && this.state.hasFlowComment ) { this.state.hasFlowComment = false; this.state.pos += 2; this.nextToken(); return; } super.readToken_mult_modulo(code); } readToken_pipe_amp(code: number): void { const next = this.input.charCodeAt(this.state.pos + 1); if ( code === charCodes.verticalBar && next === charCodes.rightCurlyBrace ) { // '|}' this.finishOp(tt.braceBarR, 2); return; } super.readToken_pipe_amp(code); } parseTopLevel(file: N.File, program: N.Program): N.File { const fileNode = super.parseTopLevel(file, program); if (this.state.hasFlowComment) { this.raise(this.state.pos, FlowErrors.UnterminatedFlowComment); } return fileNode; } skipBlockComment(): void { if (this.hasPlugin("flowComments") && this.skipFlowComment()) { if (this.state.hasFlowComment) { this.unexpected(null, FlowErrors.NestedFlowComment); } this.hasFlowCommentCompletion(); this.state.pos += this.skipFlowComment(); this.state.hasFlowComment = true; return; } if (this.state.hasFlowComment) { const end = this.input.indexOf("*-/", (this.state.pos += 2)); if (end === -1) { throw this.raise(this.state.pos - 2, Errors.UnterminatedComment); } this.state.pos = end + 3; return; } super.skipBlockComment(); } skipFlowComment(): number | boolean { const { pos } = this.state; let shiftToFirstNonWhiteSpace = 2; while ( [charCodes.space, charCodes.tab].includes( this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace), ) ) { shiftToFirstNonWhiteSpace++; } const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos); const ch3 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos + 1); if (ch2 === charCodes.colon && ch3 === charCodes.colon) { return shiftToFirstNonWhiteSpace + 2; // check for /*:: } if ( this.input.slice( shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12, ) === "flow-include" ) { return shiftToFirstNonWhiteSpace + 12; // check for /*flow-include } if (ch2 === charCodes.colon && ch3 !== charCodes.colon) { return shiftToFirstNonWhiteSpace; // check for /*:, advance up to : } return false; } hasFlowCommentCompletion(): void { const end = this.input.indexOf("*/", this.state.pos); if (end === -1) { 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); } } // check if the next token is a tt.relation("<") isLookaheadToken_lt(): boolean { const next = this.nextTokenStart(); if (this.input.charCodeAt(next) === charCodes.lessThan) { const afterNext = this.input.charCodeAt(next + 1); return ( afterNext !== charCodes.lessThan && afterNext !== charCodes.equalsTo ); } return false; } maybeUnwrapTypeCastExpression(node: N.Node) { return node.type === "TypeCastExpression" ? node.expression : node; } }; babel-7.12.12/packages/babel-parser/src/plugins/jsx/000077500000000000000000000000001377064615700221425ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/src/plugins/jsx/index.js000066400000000000000000000461611377064615700236170ustar00rootroot00000000000000// @flow // Error messages are colocated with the plugin. /* eslint-disable @babel/development-internal/dry-error-messages */ 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 { Position } from "../../util/location"; import { isNewLine } from "../../util/whitespace"; import { Errors } from "../../parser/error"; 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>", UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?", 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("...", true, true); tt.jsxName = new TokenType("jsxName"); tt.jsxText = new TokenType("jsxText", { beforeExpr: true }); tt.jsxTagStart = new TokenType("jsxTagStart", { startsExpr: true }); tt.jsxTagEnd = new TokenType("jsxTagEnd"); tt.jsxTagStart.updateContext = function () { this.state.context.push(tc.j_expr); // treat as beginning of JSX expression this.state.context.push(tc.j_oTag); // start opening tag context this.state.exprAllowed = false; }; tt.jsxTagEnd.updateContext = function (prevType) { const out = this.state.context.pop(); if ((out === tc.j_oTag && prevType === tt.slash) || out === tc.j_cTag) { this.state.context.pop(); this.state.exprAllowed = this.curContext() === tc.j_expr; } else { this.state.exprAllowed = true; } }; function isFragment(object: ?N.JSXElement): boolean { return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false; } // Transforms JSX element name to string. function getQualifiedJSXName( object: N.JSXIdentifier | N.JSXNamespacedName | N.JSXMemberExpression, ): string { if (object.type === "JSXIdentifier") { return object.name; } if (object.type === "JSXNamespacedName") { return object.namespace.name + ":" + object.name.name; } if (object.type === "JSXMemberExpression") { return ( getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property) ); } // istanbul ignore next throw new Error("Node had unexpected type: " + object.type); } export default (superClass: Class): Class => class extends superClass { // Reads inline JSX contents token. jsxReadToken(): void { let out = ""; let chunkStart = this.state.pos; for (;;) { if (this.state.pos >= this.length) { throw this.raise(this.state.start, JsxErrors.UnterminatedJsxContent); } const ch = this.input.charCodeAt(this.state.pos); switch (ch) { case charCodes.lessThan: case charCodes.leftCurlyBrace: if (this.state.pos === this.state.start) { if (ch === charCodes.lessThan && this.state.exprAllowed) { ++this.state.pos; return this.finishToken(tt.jsxTagStart); } return super.getTokenFromCode(ch); } out += this.input.slice(chunkStart, this.state.pos); return this.finishToken(tt.jsxText, out); case charCodes.ampersand: out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadEntity(); chunkStart = this.state.pos; break; default: if (isNewLine(ch)) { out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadNewLine(true); chunkStart = this.state.pos; } else { ++this.state.pos; } } } } jsxReadNewLine(normalizeCRLF: boolean): string { const ch = this.input.charCodeAt(this.state.pos); let out; ++this.state.pos; if ( ch === charCodes.carriageReturn && this.input.charCodeAt(this.state.pos) === charCodes.lineFeed ) { ++this.state.pos; out = normalizeCRLF ? "\n" : "\r\n"; } else { out = String.fromCharCode(ch); } ++this.state.curLine; this.state.lineStart = this.state.pos; return out; } jsxReadString(quote: number): void { let out = ""; let chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.length) { throw this.raise(this.state.start, Errors.UnterminatedString); } const ch = this.input.charCodeAt(this.state.pos); if (ch === quote) break; if (ch === charCodes.ampersand) { out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadEntity(); chunkStart = this.state.pos; } else if (isNewLine(ch)) { out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadNewLine(false); chunkStart = this.state.pos; } else { ++this.state.pos; } } out += this.input.slice(chunkStart, this.state.pos++); return this.finishToken(tt.string, out); } jsxReadEntity(): string { let str = ""; let count = 0; let entity; let ch = this.input[this.state.pos]; const startPos = ++this.state.pos; while (this.state.pos < this.length && count++ < 10) { ch = this.input[this.state.pos++]; if (ch === ";") { if (str[0] === "#") { if (str[1] === "x") { str = str.substr(2); if (HEX_NUMBER.test(str)) { entity = String.fromCodePoint(parseInt(str, 16)); } } else { str = str.substr(1); if (DECIMAL_NUMBER.test(str)) { entity = String.fromCodePoint(parseInt(str, 10)); } } } else { entity = XHTMLEntities[str]; } break; } str += ch; } if (!entity) { this.state.pos = startPos; return "&"; } return entity; } // Read a JSX identifier (valid tag or attribute name). // // Optimized version since JSX identifiers can"t contain // escape characters and so can be read as single slice. // Also assumes that first character was already checked // by isIdentifierStart in readToken. jsxReadWord(): void { let ch; const start = this.state.pos; do { ch = this.input.charCodeAt(++this.state.pos); } while (isIdentifierChar(ch) || ch === charCodes.dash); return this.finishToken( tt.jsxName, this.input.slice(start, this.state.pos), ); } // Parse next token as JSX identifier jsxParseIdentifier(): N.JSXIdentifier { const node = this.startNode(); if (this.match(tt.jsxName)) { node.name = this.state.value; } else if (this.state.type.keyword) { node.name = this.state.type.keyword; } else { this.unexpected(); } this.next(); return this.finishNode(node, "JSXIdentifier"); } // Parse namespaced identifier. jsxParseNamespacedName(): N.JSXNamespacedName { const startPos = this.state.start; const startLoc = this.state.startLoc; const name = this.jsxParseIdentifier(); if (!this.eat(tt.colon)) return name; const node = this.startNodeAt(startPos, startLoc); node.namespace = name; node.name = this.jsxParseIdentifier(); return this.finishNode(node, "JSXNamespacedName"); } // Parses element name in any form - namespaced, member // or single identifier. 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; newNode.property = this.jsxParseIdentifier(); node = this.finishNode(newNode, "JSXMemberExpression"); } return node; } // Parses any type of JSX attribute value. jsxParseAttributeValue(): N.Expression { let node; switch (this.state.type) { case tt.braceL: node = this.startNode(); this.next(); node = this.jsxParseExpressionContainer(node); if (node.expression.type === "JSXEmptyExpression") { this.raise(node.start, JsxErrors.AttributeIsEmpty); } return node; case tt.jsxTagStart: case tt.string: return this.parseExprAtom(); default: throw this.raise(this.state.start, JsxErrors.UnsupportedJsxValue); } } // JSXEmptyExpression is unique type since it doesn't actually parse anything, // and so it should start at the end of last read token (left brace) and finish // at the beginning of the next one (right brace). jsxParseEmptyExpression(): N.JSXEmptyExpression { const node = this.startNodeAt( this.state.lastTokEnd, this.state.lastTokEndLoc, ); return this.finishNodeAt( node, "JSXEmptyExpression", this.state.start, this.state.startLoc, ); } // Parse JSX spread child jsxParseSpreadChild(node: N.JSXSpreadChild): N.JSXSpreadChild { this.next(); // ellipsis node.expression = this.parseExpression(); this.expect(tt.braceR); return this.finishNode(node, "JSXSpreadChild"); } // Parses JSX expression enclosed into curly brackets. jsxParseExpressionContainer( node: N.JSXExpressionContainer, ): N.JSXExpressionContainer { if (this.match(tt.braceR)) { node.expression = this.jsxParseEmptyExpression(); } else { const expression = this.parseExpression(); if (process.env.BABEL_8_BREAKING) { if ( expression.type === "SequenceExpression" && !expression.extra?.parenthesized ) { this.raise( expression.expressions[1].start, JsxErrors.UnexpectedSequenceExpression, ); } } node.expression = expression; } this.expect(tt.braceR); return this.finishNode(node, "JSXExpressionContainer"); } // Parses following JSX attribute name-value pair. jsxParseAttribute(): N.JSXAttribute { const node = this.startNode(); if (this.eat(tt.braceL)) { this.expect(tt.ellipsis); node.argument = this.parseMaybeAssignAllowIn(); this.expect(tt.braceR); return this.finishNode(node, "JSXSpreadAttribute"); } node.name = this.jsxParseNamespacedName(); node.value = this.eat(tt.eq) ? this.jsxParseAttributeValue() : null; return this.finishNode(node, "JSXAttribute"); } // Parses JSX opening tag starting after "<". jsxParseOpeningElementAt( startPos: number, startLoc: Position, ): N.JSXOpeningElement { const node = this.startNodeAt(startPos, startLoc); if (this.match(tt.jsxTagEnd)) { this.expect(tt.jsxTagEnd); return this.finishNode(node, "JSXOpeningFragment"); } node.name = this.jsxParseElementName(); return this.jsxParseOpeningElementAfterName(node); } jsxParseOpeningElementAfterName( node: N.JSXOpeningElement, ): N.JSXOpeningElement { const attributes: N.JSXAttribute[] = []; while (!this.match(tt.slash) && !this.match(tt.jsxTagEnd)) { attributes.push(this.jsxParseAttribute()); } node.attributes = attributes; node.selfClosing = this.eat(tt.slash); this.expect(tt.jsxTagEnd); return this.finishNode(node, "JSXOpeningElement"); } // Parses JSX closing tag starting after " JSX open tag -> ... anymore this.state.context.push(tc.j_cTag); // reconsider as closing tag context this.state.exprAllowed = false; } else { return super.updateContext(prevType); } } }; babel-7.12.12/packages/babel-parser/src/plugins/jsx/xhtml.js000066400000000000000000000112541377064615700236370ustar00rootroot00000000000000// @flow const entities: { [name: string]: string } = { quot: "\u0022", amp: "&", apos: "\u0027", lt: "<", gt: ">", nbsp: "\u00A0", iexcl: "\u00A1", cent: "\u00A2", pound: "\u00A3", curren: "\u00A4", yen: "\u00A5", brvbar: "\u00A6", sect: "\u00A7", uml: "\u00A8", copy: "\u00A9", ordf: "\u00AA", laquo: "\u00AB", not: "\u00AC", shy: "\u00AD", reg: "\u00AE", macr: "\u00AF", deg: "\u00B0", plusmn: "\u00B1", sup2: "\u00B2", sup3: "\u00B3", acute: "\u00B4", micro: "\u00B5", para: "\u00B6", middot: "\u00B7", cedil: "\u00B8", sup1: "\u00B9", ordm: "\u00BA", raquo: "\u00BB", frac14: "\u00BC", frac12: "\u00BD", frac34: "\u00BE", iquest: "\u00BF", Agrave: "\u00C0", Aacute: "\u00C1", Acirc: "\u00C2", Atilde: "\u00C3", Auml: "\u00C4", Aring: "\u00C5", AElig: "\u00C6", Ccedil: "\u00C7", Egrave: "\u00C8", Eacute: "\u00C9", Ecirc: "\u00CA", Euml: "\u00CB", Igrave: "\u00CC", Iacute: "\u00CD", Icirc: "\u00CE", Iuml: "\u00CF", ETH: "\u00D0", Ntilde: "\u00D1", Ograve: "\u00D2", Oacute: "\u00D3", Ocirc: "\u00D4", Otilde: "\u00D5", Ouml: "\u00D6", times: "\u00D7", Oslash: "\u00D8", Ugrave: "\u00D9", Uacute: "\u00DA", Ucirc: "\u00DB", Uuml: "\u00DC", Yacute: "\u00DD", THORN: "\u00DE", szlig: "\u00DF", agrave: "\u00E0", aacute: "\u00E1", acirc: "\u00E2", atilde: "\u00E3", auml: "\u00E4", aring: "\u00E5", aelig: "\u00E6", ccedil: "\u00E7", egrave: "\u00E8", eacute: "\u00E9", ecirc: "\u00EA", euml: "\u00EB", igrave: "\u00EC", iacute: "\u00ED", icirc: "\u00EE", iuml: "\u00EF", eth: "\u00F0", ntilde: "\u00F1", ograve: "\u00F2", oacute: "\u00F3", ocirc: "\u00F4", otilde: "\u00F5", ouml: "\u00F6", divide: "\u00F7", oslash: "\u00F8", ugrave: "\u00F9", uacute: "\u00FA", ucirc: "\u00FB", uuml: "\u00FC", yacute: "\u00FD", thorn: "\u00FE", yuml: "\u00FF", OElig: "\u0152", oelig: "\u0153", Scaron: "\u0160", scaron: "\u0161", Yuml: "\u0178", fnof: "\u0192", circ: "\u02C6", tilde: "\u02DC", Alpha: "\u0391", Beta: "\u0392", Gamma: "\u0393", Delta: "\u0394", Epsilon: "\u0395", Zeta: "\u0396", Eta: "\u0397", Theta: "\u0398", Iota: "\u0399", Kappa: "\u039A", Lambda: "\u039B", Mu: "\u039C", Nu: "\u039D", Xi: "\u039E", Omicron: "\u039F", Pi: "\u03A0", Rho: "\u03A1", Sigma: "\u03A3", Tau: "\u03A4", Upsilon: "\u03A5", Phi: "\u03A6", Chi: "\u03A7", Psi: "\u03A8", Omega: "\u03A9", alpha: "\u03B1", beta: "\u03B2", gamma: "\u03B3", delta: "\u03B4", epsilon: "\u03B5", zeta: "\u03B6", eta: "\u03B7", theta: "\u03B8", iota: "\u03B9", kappa: "\u03BA", lambda: "\u03BB", mu: "\u03BC", nu: "\u03BD", xi: "\u03BE", omicron: "\u03BF", pi: "\u03C0", rho: "\u03C1", sigmaf: "\u03C2", sigma: "\u03C3", tau: "\u03C4", upsilon: "\u03C5", phi: "\u03C6", chi: "\u03C7", psi: "\u03C8", omega: "\u03C9", thetasym: "\u03D1", upsih: "\u03D2", piv: "\u03D6", ensp: "\u2002", emsp: "\u2003", thinsp: "\u2009", zwnj: "\u200C", zwj: "\u200D", lrm: "\u200E", rlm: "\u200F", ndash: "\u2013", mdash: "\u2014", lsquo: "\u2018", rsquo: "\u2019", sbquo: "\u201A", ldquo: "\u201C", rdquo: "\u201D", bdquo: "\u201E", dagger: "\u2020", Dagger: "\u2021", bull: "\u2022", hellip: "\u2026", permil: "\u2030", prime: "\u2032", Prime: "\u2033", lsaquo: "\u2039", rsaquo: "\u203A", oline: "\u203E", frasl: "\u2044", euro: "\u20AC", image: "\u2111", weierp: "\u2118", real: "\u211C", trade: "\u2122", alefsym: "\u2135", larr: "\u2190", uarr: "\u2191", rarr: "\u2192", darr: "\u2193", harr: "\u2194", crarr: "\u21B5", lArr: "\u21D0", uArr: "\u21D1", rArr: "\u21D2", dArr: "\u21D3", hArr: "\u21D4", forall: "\u2200", part: "\u2202", exist: "\u2203", empty: "\u2205", nabla: "\u2207", isin: "\u2208", notin: "\u2209", ni: "\u220B", prod: "\u220F", sum: "\u2211", minus: "\u2212", lowast: "\u2217", radic: "\u221A", prop: "\u221D", infin: "\u221E", ang: "\u2220", and: "\u2227", or: "\u2228", cap: "\u2229", cup: "\u222A", int: "\u222B", there4: "\u2234", sim: "\u223C", cong: "\u2245", asymp: "\u2248", ne: "\u2260", equiv: "\u2261", le: "\u2264", ge: "\u2265", sub: "\u2282", sup: "\u2283", nsub: "\u2284", sube: "\u2286", supe: "\u2287", oplus: "\u2295", otimes: "\u2297", perp: "\u22A5", sdot: "\u22C5", lceil: "\u2308", rceil: "\u2309", lfloor: "\u230A", rfloor: "\u230B", lang: "\u2329", rang: "\u232A", loz: "\u25CA", spades: "\u2660", clubs: "\u2663", hearts: "\u2665", diams: "\u2666", }; export default entities; babel-7.12.12/packages/babel-parser/src/plugins/placeholders.js000066400000000000000000000245411377064615700243470ustar00rootroot00000000000000// @flow import * as charCodes from "charcodes"; import { types as tt, TokenType } from "../tokenizer/types"; import type Parser from "../parser"; import * as N from "../types"; tt.placeholder = new TokenType("%%", { startsExpr: true }); export type PlaceholderTypes = | "Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern"; // $PropertyType doesn't support enums. Use a fake "switch" (GetPlaceholderNode) //type MaybePlaceholder = $PropertyType | N.Placeholder; type _Switch = $Call< ( $ElementType<$ElementType, 0>, ) => $ElementType<$ElementType, 1>, Value, >; type $Switch = _Switch; type NodeOf = $Switch< T, [ ["Identifier", N.Identifier], ["StringLiteral", N.StringLiteral], ["Expression", N.Expression], ["Statement", N.Statement], ["Declaration", N.Declaration], ["BlockStatement", N.BlockStatement], ["ClassBody", N.ClassBody], ["Pattern", N.Pattern], ], >; // Placeholder breaks everything, because its type is incompatible with // the substituted nodes. type MaybePlaceholder = NodeOf; // | Placeholder export default (superClass: Class): Class => class extends superClass { parsePlaceholder( expectedNode: T, ): /*?N.Placeholder*/ ?MaybePlaceholder { if (this.match(tt.placeholder)) { const node = this.startNode(); this.next(); this.assertNoSpace("Unexpected space in placeholder."); // We can't use this.parseIdentifier because // we don't want nested placeholders. node.name = super.parseIdentifier(/* liberal */ true); this.assertNoSpace("Unexpected space in placeholder."); this.expect(tt.placeholder); return this.finishPlaceholder(node, expectedNode); } } finishPlaceholder( node: N.Node, expectedNode: T, ): /*N.Placeholder*/ MaybePlaceholder { const isFinished = !!(node.expectedNode && node.type === "Placeholder"); node.expectedNode = expectedNode; return isFinished ? node : this.finishNode(node, "Placeholder"); } /* ============================================================ * * tokenizer/index.js * * ============================================================ */ getTokenFromCode(code: number) { if ( code === charCodes.percentSign && this.input.charCodeAt(this.state.pos + 1) === charCodes.percentSign ) { return this.finishOp(tt.placeholder, 2); } return super.getTokenFromCode(...arguments); } /* ============================================================ * * parser/expression.js * * ============================================================ */ parseExprAtom(): MaybePlaceholder<"Expression"> { return ( this.parsePlaceholder("Expression") || super.parseExprAtom(...arguments) ); } parseIdentifier(): MaybePlaceholder<"Identifier"> { // NOTE: This function only handles identifiers outside of // expressions and binding patterns, since they are already // handled by the parseExprAtom and parseBindingAtom functions. // This is needed, for example, to parse "class %%NAME%% {}". return ( this.parsePlaceholder("Identifier") || super.parseIdentifier(...arguments) ); } checkReservedWord(word: string): void { // Sometimes we call #checkReservedWord(node.name), expecting // that node is an Identifier. If it is a Placeholder, name // will be undefined. if (word !== undefined) super.checkReservedWord(...arguments); } /* ============================================================ * * parser/lval.js * * ============================================================ */ parseBindingAtom(): MaybePlaceholder<"Pattern"> { return ( this.parsePlaceholder("Pattern") || super.parseBindingAtom(...arguments) ); } checkLVal(expr: N.Expression): void { if (expr.type !== "Placeholder") super.checkLVal(...arguments); } toAssignable(node: N.Node): N.Node { if ( node && node.type === "Placeholder" && node.expectedNode === "Expression" ) { node.expectedNode = "Pattern"; return node; } return super.toAssignable(...arguments); } /* ============================================================ * * parser/statement.js * * ============================================================ */ verifyBreakContinue(node: N.BreakStatement | N.ContinueStatement) { if (node.label && node.label.type === "Placeholder") return; super.verifyBreakContinue(...arguments); } parseExpressionStatement( node: MaybePlaceholder<"Statement">, expr: N.Expression, ): MaybePlaceholder<"Statement"> { if ( expr.type !== "Placeholder" || (expr.extra && expr.extra.parenthesized) ) { return super.parseExpressionStatement(...arguments); } if (this.match(tt.colon)) { const stmt: N.LabeledStatement = node; stmt.label = this.finishPlaceholder(expr, "Identifier"); this.next(); stmt.body = this.parseStatement("label"); return this.finishNode(stmt, "LabeledStatement"); } this.semicolon(); node.name = expr.name; return this.finishPlaceholder(node, "Statement"); } parseBlock(): MaybePlaceholder<"BlockStatement"> { return ( this.parsePlaceholder("BlockStatement") || super.parseBlock(...arguments) ); } parseFunctionId(): ?MaybePlaceholder<"Identifier"> { return ( this.parsePlaceholder("Identifier") || super.parseFunctionId(...arguments) ); } parseClass( node: T, isStatement: /* T === ClassDeclaration */ boolean, optionalId?: boolean, ): T { const type = isStatement ? "ClassDeclaration" : "ClassExpression"; this.next(); this.takeDecorators(node); const oldStrict = this.state.strict; const placeholder = this.parsePlaceholder("Identifier"); if (placeholder) { if ( this.match(tt._extends) || this.match(tt.placeholder) || this.match(tt.braceL) ) { node.id = placeholder; } else if (optionalId || !isStatement) { node.id = null; node.body = this.finishPlaceholder(placeholder, "ClassBody"); return this.finishNode(node, type); } else { this.unexpected(null, "A class name is required"); } } else { this.parseClassId(node, isStatement, optionalId); } this.parseClassSuper(node); node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass, oldStrict); return this.finishNode(node, type); } parseExport(node: N.Node): N.Node { const placeholder = this.parsePlaceholder("Identifier"); if (!placeholder) return super.parseExport(...arguments); if (!this.isContextual("from") && !this.match(tt.comma)) { // export %%DECL%%; node.specifiers = []; node.source = null; node.declaration = this.finishPlaceholder(placeholder, "Declaration"); return this.finishNode(node, "ExportNamedDeclaration"); } // export %%NAME%% from "foo"; this.expectPlugin("exportDefaultFrom"); const specifier = this.startNode(); specifier.exported = placeholder; node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")]; return super.parseExport(node); } isExportDefaultSpecifier(): boolean { if (this.match(tt._default)) { const next = this.nextTokenStart(); if (this.isUnparsedContextual(next, "from")) { if ( this.input.startsWith( tt.placeholder.label, this.nextTokenStartSince(next + 4), ) ) { return true; } } } return super.isExportDefaultSpecifier(); } maybeParseExportDefaultSpecifier(node: N.Node): boolean { if (node.specifiers && node.specifiers.length > 0) { // "export %%NAME%%" has already been parsed by #parseExport. return true; } return super.maybeParseExportDefaultSpecifier(...arguments); } checkExport(node: N.ExportNamedDeclaration): void { const { specifiers } = node; if (specifiers?.length) { node.specifiers = specifiers.filter( node => node.exported.type === "Placeholder", ); } super.checkExport(node); node.specifiers = specifiers; } parseImport( node: N.Node, ): N.ImportDeclaration | N.TsImportEqualsDeclaration { const placeholder = this.parsePlaceholder("Identifier"); if (!placeholder) return super.parseImport(...arguments); node.specifiers = []; if (!this.isContextual("from") && !this.match(tt.comma)) { // import %%STRING%%; node.source = this.finishPlaceholder(placeholder, "StringLiteral"); this.semicolon(); return this.finishNode(node, "ImportDeclaration"); } // import %%DEFAULT%% ... const specifier = this.startNodeAtNode(placeholder); specifier.local = placeholder; this.finishNode(specifier, "ImportDefaultSpecifier"); node.specifiers.push(specifier); if (this.eat(tt.comma)) { // import %%DEFAULT%%, * as ... const hasStarImport = this.maybeParseStarImportSpecifier(node); // import %%DEFAULT%%, { ... if (!hasStarImport) this.parseNamedImportSpecifiers(node); } this.expectContextual("from"); node.source = this.parseImportSource(); this.semicolon(); return this.finishNode(node, "ImportDeclaration"); } parseImportSource(): MaybePlaceholder<"StringLiteral"> { // import ... from %%STRING%%; return ( this.parsePlaceholder("StringLiteral") || super.parseImportSource(...arguments) ); } }; babel-7.12.12/packages/babel-parser/src/plugins/typescript/000077500000000000000000000000001377064615700235445ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/src/plugins/typescript/index.js000066400000000000000000002560471377064615700252270ustar00rootroot00000000000000// @flow /*:: declare var invariant; */ // Error messages are colocated with the plugin. /* eslint-disable @babel/development-internal/dry-error-messages */ 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"; import type { Pos, Position } from "../../util/location"; import type Parser from "../../parser"; import { type BindingTypes, SCOPE_TS_MODULE, SCOPE_OTHER, BIND_TS_ENUM, BIND_TS_CONST_ENUM, BIND_TS_TYPE, BIND_TS_INTERFACE, 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/error"; type TsModifier = | "readonly" | "abstract" | "declare" | "static" | "public" | "private" | "protected"; function nonNull(x: ?T): T { if (x == null) { // $FlowIgnore throw new Error(`Unexpected ${x} value.`); } return x; } function assert(x: boolean): void { if (!x) { throw new Error("Assert fail"); } } type ParsingContext = | "EnumMembers" | "HeritageClauseElement" | "TupleElementTypes" | "TypeMembers" | "TypeParametersOrArguments"; const TSErrors = Object.freeze({ ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier", ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier", ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.", DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.", DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.", DuplicateModifier: "Duplicate modifier: '%0'", EmptyHeritageClauseType: "'%0' list cannot be empty.", EmptyTypeArguments: "Type argument list cannot be empty.", EmptyTypeParameters: "Type parameter 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", IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier", InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.", MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.", 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')", TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`", UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.", 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. // It also doesn't handle "intrinsic", since usually it's not a keyword. function keywordTypeFromName( value: string, ): N.TsKeywordTypeType | typeof undefined { switch (value) { case "any": return "TSAnyKeyword"; case "boolean": return "TSBooleanKeyword"; case "bigint": return "TSBigIntKeyword"; case "never": return "TSNeverKeyword"; case "number": return "TSNumberKeyword"; case "object": return "TSObjectKeyword"; case "string": return "TSStringKeyword"; case "symbol": return "TSSymbolKeyword"; case "undefined": return "TSUndefinedKeyword"; case "unknown": return "TSUnknownKeyword"; default: return undefined; } } export default (superClass: Class): Class => class extends superClass { getScopeHandler(): Class { return TypeScriptScopeHandler; } tsIsIdentifier(): boolean { // TODO: actually a bit more complex in TypeScript, but shouldn't matter. // See https://github.com/Microsoft/TypeScript/issues/15008 return this.match(tt.name); } tsNextTokenCanFollowModifier() { // Note: TypeScript's implementation is much more complicated because // more things are considered modifiers there. // This implementation only handles modifiers not handled by @babel/parser itself. And "static". // TODO: Would be nice to avoid lookahead. Want a hasLineBreakUpNext() method... this.next(); return ( (this.match(tt.bracketL) || this.match(tt.braceL) || this.match(tt.star) || this.match(tt.ellipsis) || this.match(tt.hash) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak() ); } /** Parses a modifier matching one the given modifier names. */ tsParseModifier(allowedModifiers: T[]): ?T { if (!this.match(tt.name)) { return undefined; } const modifier = this.state.value; if ( allowedModifiers.indexOf(modifier) !== -1 && this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)) ) { return modifier; } 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": case "TypeMembers": return this.match(tt.braceR); case "HeritageClauseElement": return this.match(tt.braceL); case "TupleElementTypes": return this.match(tt.bracketR); case "TypeParametersOrArguments": return this.isRelational(">"); } throw new Error("Unreachable"); } tsParseList(kind: ParsingContext, parseElement: () => T): T[] { const result: T[] = []; while (!this.tsIsListTerminator(kind)) { // Skipping "parseListElement" from the TS source since that's just for error handling. result.push(parseElement()); } return result; } tsParseDelimitedList( kind: ParsingContext, parseElement: () => T, ): T[] { return nonNull( this.tsParseDelimitedListWorker( kind, parseElement, /* expectSuccess */ true, ), ); } /** * If !expectSuccess, returns undefined instead of failing to parse. * If expectSuccess, parseElement should always return a defined value. */ tsParseDelimitedListWorker( kind: ParsingContext, parseElement: () => ?T, expectSuccess: boolean, ): ?(T[]) { const result = []; for (;;) { if (this.tsIsListTerminator(kind)) { break; } const element = parseElement(); if (element == null) { return undefined; } result.push(element); if (this.eat(tt.comma)) { continue; } if (this.tsIsListTerminator(kind)) { break; } if (expectSuccess) { // This will fail with an error about a missing comma this.expect(tt.comma); } return undefined; } return result; } tsParseBracketedList( kind: ParsingContext, parseElement: () => T, bracket: boolean, skipFirstToken: boolean, ): T[] { if (!skipFirstToken) { if (bracket) { this.expect(tt.bracketL); } else { this.expectRelational("<"); } } const result = this.tsParseDelimitedList(kind, parseElement); if (bracket) { this.expect(tt.bracketR); } else { this.expectRelational(">"); } return result; } tsParseImportType(): N.TsImportType { const node: N.TsImportType = this.startNode(); this.expect(tt._import); this.expect(tt.parenL); if (!this.match(tt.string)) { this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument); } // For compatibility to estree we cannot call parseLiteral directly here node.argument = this.parseExprAtom(); this.expect(tt.parenR); if (this.eat(tt.dot)) { node.qualifier = this.tsParseEntityName(/* allowReservedWords */ true); } if (this.isRelational("<")) { node.typeParameters = this.tsParseTypeArguments(); } return this.finishNode(node, "TSImportType"); } tsParseEntityName(allowReservedWords: boolean): N.TsEntityName { let entity: N.TsEntityName = this.parseIdentifier(); while (this.eat(tt.dot)) { const node: N.TsQualifiedName = this.startNodeAtNode(entity); node.left = entity; node.right = this.parseIdentifier(allowReservedWords); entity = this.finishNode(node, "TSQualifiedName"); } return entity; } tsParseTypeReference(): N.TsTypeReference { const node: N.TsTypeReference = this.startNode(); node.typeName = this.tsParseEntityName(/* allowReservedWords */ false); if (!this.hasPrecedingLineBreak() && this.isRelational("<")) { node.typeParameters = this.tsParseTypeArguments(); } return this.finishNode(node, "TSTypeReference"); } tsParseThisTypePredicate(lhs: N.TsThisType): N.TsTypePredicate { this.next(); const node: N.TsTypePredicate = this.startNodeAtNode(lhs); node.parameterName = lhs; node.typeAnnotation = this.tsParseTypeAnnotation(/* eatColon */ false); node.asserts = false; return this.finishNode(node, "TSTypePredicate"); } tsParseThisTypeNode(): N.TsThisType { const node: N.TsThisType = this.startNode(); this.next(); return this.finishNode(node, "TSThisType"); } tsParseTypeQuery(): N.TsTypeQuery { const node: N.TsTypeQuery = this.startNode(); this.expect(tt._typeof); if (this.match(tt._import)) { node.exprName = this.tsParseImportType(); } else { node.exprName = this.tsParseEntityName(/* allowReservedWords */ true); } return this.finishNode(node, "TSTypeQuery"); } tsParseTypeParameter(): N.TsTypeParameter { const node: N.TsTypeParameter = this.startNode(); node.name = this.parseIdentifierName(node.start); node.constraint = this.tsEatThenParseType(tt._extends); node.default = this.tsEatThenParseType(tt.eq); return this.finishNode(node, "TSTypeParameter"); } tsTryParseTypeParameters(): ?N.TsTypeParameterDeclaration { if (this.isRelational("<")) { return this.tsParseTypeParameters(); } } tsParseTypeParameters() { const node: N.TsTypeParameterDeclaration = this.startNode(); if (this.isRelational("<") || this.match(tt.jsxTagStart)) { this.next(); } else { this.unexpected(); } node.params = this.tsParseBracketedList( "TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), /* bracket */ false, /* skipFirstToken */ true, ); if (node.params.length === 0) { this.raise(node.start, TSErrors.EmptyTypeParameters); } return this.finishNode(node, "TSTypeParameterDeclaration"); } tsTryNextParseConstantContext(): ?N.TsTypeReference { if (this.lookahead().type === tt._const) { this.next(); return this.tsParseTypeReference(); } return null; } // Note: In TypeScript implementation we must provide `yieldContext` and `awaitContext`, // but here it's always false, because this is only used for types. tsFillSignature( returnToken: TokenType, signature: N.TsSignatureDeclaration, ): void { // Arrow fns *must* have return token (`=>`). Normal functions can omit it. const returnTokenRequired = returnToken === tt.arrow; signature.typeParameters = this.tsTryParseTypeParameters(); this.expect(tt.parenL); signature.parameters = this.tsParseBindingListForSignature(); if (returnTokenRequired) { signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation( returnToken, ); } else if (this.match(returnToken)) { signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation( returnToken, ); } } tsParseBindingListForSignature(): $ReadOnlyArray< N.Identifier | N.RestElement | N.ObjectPattern | N.ArrayPattern, > { 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 { if (!this.eat(tt.comma)) { this.semicolon(); } } tsParseSignatureMember( kind: "TSCallSignatureDeclaration" | "TSConstructSignatureDeclaration", node: N.TsCallSignatureDeclaration | N.TsConstructSignatureDeclaration, ): N.TsCallSignatureDeclaration | N.TsConstructSignatureDeclaration { this.tsFillSignature(tt.colon, node); this.tsParseTypeMemberSemicolon(); return this.finishNode(node, kind); } tsIsUnambiguouslyIndexSignature() { this.next(); // Skip '{' return this.eat(tt.name) && this.match(tt.colon); } tsTryParseIndexSignature(node: N.Node): ?N.TsIndexSignature { if ( !( this.match(tt.bracketL) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)) ) ) { return undefined; } this.expect(tt.bracketL); const id = this.parseIdentifier(); id.typeAnnotation = this.tsParseTypeAnnotation(); this.resetEndLocation(id); // set end position to end of type this.expect(tt.bracketR); node.parameters = [id]; const type = this.tsTryParseTypeAnnotation(); if (type) node.typeAnnotation = type; this.tsParseTypeMemberSemicolon(); return this.finishNode(node, "TSIndexSignature"); } tsParsePropertyOrMethodSignature( node: N.TsPropertySignature | N.TsMethodSignature, readonly: boolean, ): N.TsPropertySignature | N.TsMethodSignature { if (this.eat(tt.question)) node.optional = true; const nodeAny: any = node; if (!readonly && (this.match(tt.parenL) || this.isRelational("<"))) { const method: N.TsMethodSignature = nodeAny; this.tsFillSignature(tt.colon, method); this.tsParseTypeMemberSemicolon(); return this.finishNode(method, "TSMethodSignature"); } else { const property: N.TsPropertySignature = nodeAny; if (readonly) property.readonly = true; const type = this.tsTryParseTypeAnnotation(); if (type) property.typeAnnotation = type; this.tsParseTypeMemberSemicolon(); return this.finishNode(property, "TSPropertySignature"); } } tsParseTypeMember(): N.TsTypeElement { const node: any = this.startNode(); if (this.match(tt.parenL) || this.isRelational("<")) { return this.tsParseSignatureMember("TSCallSignatureDeclaration", node); } if (this.match(tt._new)) { const id: N.Identifier = this.startNode(); this.next(); if (this.match(tt.parenL) || this.isRelational("<")) { return this.tsParseSignatureMember( "TSConstructSignatureDeclaration", node, ); } else { node.key = this.createIdentifier(id, "new"); return this.tsParsePropertyOrMethodSignature(node, false); } } const readonly = !!this.tsParseModifier(["readonly"]); const idx = this.tsTryParseIndexSignature(node); if (idx) { if (readonly) node.readonly = true; return idx; } this.parsePropertyName(node, /* isPrivateNameAllowed */ false); return this.tsParsePropertyOrMethodSignature(node, readonly); } tsParseTypeLiteral(): N.TsTypeLiteral { const node: N.TsTypeLiteral = this.startNode(); node.members = this.tsParseObjectTypeMembers(); return this.finishNode(node, "TSTypeLiteral"); } tsParseObjectTypeMembers(): $ReadOnlyArray { this.expect(tt.braceL); const members = this.tsParseList( "TypeMembers", this.tsParseTypeMember.bind(this), ); this.expect(tt.braceR); return members; } tsIsStartOfMappedType(): boolean { this.next(); if (this.eat(tt.plusMin)) { return this.isContextual("readonly"); } if (this.isContextual("readonly")) { this.next(); } if (!this.match(tt.bracketL)) { return false; } this.next(); if (!this.tsIsIdentifier()) { return false; } this.next(); return this.match(tt._in); } tsParseMappedTypeParameter(): N.TsTypeParameter { const node: N.TsTypeParameter = this.startNode(); node.name = this.parseIdentifierName(node.start); node.constraint = this.tsExpectThenParseType(tt._in); return this.finishNode(node, "TSTypeParameter"); } tsParseMappedType(): N.TsMappedType { const node: N.TsMappedType = this.startNode(); this.expect(tt.braceL); if (this.match(tt.plusMin)) { node.readonly = this.state.value; this.next(); this.expectContextual("readonly"); } else if (this.eatContextual("readonly")) { node.readonly = true; } this.expect(tt.bracketL); node.typeParameter = this.tsParseMappedTypeParameter(); node.nameType = this.eatContextual("as") ? this.tsParseType() : null; this.expect(tt.bracketR); if (this.match(tt.plusMin)) { node.optional = this.state.value; this.next(); this.expect(tt.question); } else if (this.eat(tt.question)) { node.optional = true; } node.typeAnnotation = this.tsTryParseType(); this.semicolon(); this.expect(tt.braceR); return this.finishNode(node, "TSMappedType"); } tsParseTupleType(): N.TsTupleType { const node: N.TsTupleType = this.startNode(); node.elementTypes = this.tsParseBracketedList( "TupleElementTypes", this.tsParseTupleElementType.bind(this), /* bracket */ true, /* skipFirstToken */ false, ); // Validate the elementTypes to ensure that no mandatory elements // follow optional elements let seenOptionalElement = false; let labeledElements = null; node.elementTypes.forEach(elementNode => { let { type } = elementNode; if ( seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional) ) { this.raise(elementNode.start, TSErrors.OptionalTypeBeforeRequired); } // Flow doesn't support ||= seenOptionalElement = seenOptionalElement || (type === "TSNamedTupleMember" && elementNode.optional) || type === "TSOptionalType"; // When checking labels, check the argument of the spread operator if (type === "TSRestType") { elementNode = elementNode.typeAnnotation; type = elementNode.type; } const isLabeled = type === "TSNamedTupleMember"; // Flow doesn't support ??= labeledElements = labeledElements ?? isLabeled; if (labeledElements !== isLabeled) { this.raise( elementNode.start, TSErrors.MixedLabeledAndUnlabeledElements, ); } }); return this.finishNode(node, "TSTupleType"); } tsParseTupleElementType(): N.TsType | N.TsNamedTupleMember { // parses `...TsType[]` const { start: startPos, startLoc } = this.state; const rest = this.eat(tt.ellipsis); let type = this.tsParseType(); const optional = this.eat(tt.question); const labeled = this.eat(tt.colon); if (labeled) { const labeledNode: N.TsNamedTupleMember = this.startNodeAtNode(type); labeledNode.optional = optional; if ( type.type === "TSTypeReference" && !type.typeParameters && type.typeName.type === "Identifier" ) { labeledNode.label = (type.typeName: N.Identifier); } else { this.raise(type.start, TSErrors.InvalidTupleMemberLabel); // This produces an invalid AST, but at least we don't drop // nodes representing the invalid source. // $FlowIgnore labeledNode.label = type; } labeledNode.elementType = this.tsParseType(); type = this.finishNode(labeledNode, "TSNamedTupleMember"); } else if (optional) { const optionalTypeNode: N.TsOptionalType = this.startNodeAtNode(type); optionalTypeNode.typeAnnotation = type; type = this.finishNode(optionalTypeNode, "TSOptionalType"); } if (rest) { const restNode: N.TsRestType = this.startNodeAt(startPos, startLoc); restNode.typeAnnotation = type; type = this.finishNode(restNode, "TSRestType"); } return type; } tsParseParenthesizedType(): N.TsParenthesizedType { const node = this.startNode(); this.expect(tt.parenL); node.typeAnnotation = this.tsParseType(); this.expect(tt.parenR); return this.finishNode(node, "TSParenthesizedType"); } tsParseFunctionOrConstructorType( type: "TSFunctionType" | "TSConstructorType", ): N.TsFunctionOrConstructorType { const node: N.TsFunctionOrConstructorType = this.startNode(); if (type === "TSConstructorType") { this.expect(tt._new); } this.tsFillSignature(tt.arrow, node); return this.finishNode(node, type); } tsParseLiteralTypeNode(): N.TsLiteralType { const node: N.TsLiteralType = this.startNode(); node.literal = (() => { switch (this.state.type) { case tt.num: case tt.bigint: case tt.string: case tt._true: case tt._false: // For compatibility to estree we cannot call parseLiteral directly here return this.parseExprAtom(); default: throw this.unexpected(); } })(); return this.finishNode(node, "TSLiteralType"); } tsParseTemplateLiteralType(): N.TsType { const node: N.TsLiteralType = this.startNode(); node.literal = this.parseTemplate(false); return this.finishNode(node, "TSLiteralType"); } parseTemplateSubstitution(): N.TsType { if (this.state.inType) return this.tsParseType(); return super.parseTemplateSubstitution(); } 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: case tt._void: case tt._null: { const type = this.match(tt._void) ? "TSVoidKeyword" : this.match(tt._null) ? "TSNullKeyword" : keywordTypeFromName(this.state.value); if ( type !== undefined && this.lookaheadCharCode() !== charCodes.dot ) { const node: N.TsKeywordType = this.startNode(); this.next(); return this.finishNode(node, type); } return this.tsParseTypeReference(); } case tt.string: case tt.num: case tt.bigint: case tt._true: case tt._false: return this.tsParseLiteralTypeNode(); case tt.plusMin: if (this.state.value === "-") { const node: N.TsLiteralType = this.startNode(); const nextToken = this.lookahead(); if (nextToken.type !== tt.num && nextToken.type !== tt.bigint) { throw this.unexpected(); } node.literal = this.parseMaybeUnary(); return this.finishNode(node, "TSLiteralType"); } break; case tt._this: return this.tsParseThisTypeOrThisTypePredicate(); case tt._typeof: return this.tsParseTypeQuery(); case tt._import: return this.tsParseImportType(); case tt.braceL: return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral(); case tt.bracketL: return this.tsParseTupleType(); case tt.parenL: return this.tsParseParenthesizedType(); case tt.backQuote: return this.tsParseTemplateLiteralType(); } throw this.unexpected(); } tsParseArrayTypeOrHigher(): N.TsType { let type = this.tsParseNonArrayType(); while (!this.hasPrecedingLineBreak() && this.eat(tt.bracketL)) { if (this.match(tt.bracketR)) { const node: N.TsArrayType = this.startNodeAtNode(type); node.elementType = type; this.expect(tt.bracketR); type = this.finishNode(node, "TSArrayType"); } else { const node: N.TsIndexedAccessType = this.startNodeAtNode(type); node.objectType = type; node.indexType = this.tsParseType(); this.expect(tt.bracketR); type = this.finishNode(node, "TSIndexedAccessType"); } } return type; } tsParseTypeOperator( operator: "keyof" | "unique" | "readonly", ): N.TsTypeOperator { const node: N.TsTypeOperator = this.startNode(); this.expectContextual(operator); node.operator = operator; node.typeAnnotation = this.tsParseTypeOperatorOrHigher(); if (operator === "readonly") { this.tsCheckTypeAnnotationForReadOnly(node); } return this.finishNode(node, "TSTypeOperator"); } tsCheckTypeAnnotationForReadOnly(node: N.Node) { switch (node.typeAnnotation.type) { case "TSTupleType": case "TSArrayType": return; default: this.raise(node.start, TSErrors.UnexpectedReadonly); } } tsParseInferType(): N.TsInferType { const node = this.startNode(); this.expectContextual("infer"); const typeParameter = this.startNode(); typeParameter.name = this.parseIdentifierName(typeParameter.start); node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter"); return this.finishNode(node, "TSInferType"); } tsParseTypeOperatorOrHigher(): N.TsType { const operator = ["keyof", "unique", "readonly"].find(kw => this.isContextual(kw), ); return operator ? this.tsParseTypeOperator(operator) : this.isContextual("infer") ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher(); } tsParseUnionOrIntersectionType( kind: "TSUnionType" | "TSIntersectionType", parseConstituentType: () => N.TsType, operator: TokenType, ): N.TsType { this.eat(operator); let type = parseConstituentType(); if (this.match(operator)) { const types = [type]; while (this.eat(operator)) { types.push(parseConstituentType()); } const node: N.TsUnionType | N.TsIntersectionType = this.startNodeAtNode( type, ); node.types = types; type = this.finishNode(node, kind); } return type; } tsParseIntersectionTypeOrHigher(): N.TsType { return this.tsParseUnionOrIntersectionType( "TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), tt.bitwiseAND, ); } tsParseUnionTypeOrHigher() { return this.tsParseUnionOrIntersectionType( "TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), tt.bitwiseOR, ); } tsIsStartOfFunctionType() { if (this.isRelational("<")) { return true; } return ( this.match(tt.parenL) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this)) ); } tsSkipParameterStart(): boolean { if (this.match(tt.name) || this.match(tt._this)) { this.next(); return true; } if (this.match(tt.braceL)) { let braceStackCounter = 1; this.next(); while (braceStackCounter > 0) { if (this.match(tt.braceL)) { ++braceStackCounter; } else if (this.match(tt.braceR)) { --braceStackCounter; } this.next(); } return true; } if (this.match(tt.bracketL)) { let braceStackCounter = 1; this.next(); while (braceStackCounter > 0) { if (this.match(tt.bracketL)) { ++braceStackCounter; } else if (this.match(tt.bracketR)) { --braceStackCounter; } this.next(); } return true; } return false; } tsIsUnambiguouslyStartOfFunctionType(): boolean { this.next(); if (this.match(tt.parenR) || this.match(tt.ellipsis)) { // ( ) // ( ... return true; } if (this.tsSkipParameterStart()) { if ( this.match(tt.colon) || this.match(tt.comma) || this.match(tt.question) || this.match(tt.eq) ) { // ( xxx : // ( xxx , // ( xxx ? // ( xxx = return true; } if (this.match(tt.parenR)) { this.next(); if (this.match(tt.arrow)) { // ( xxx ) => return true; } } } return false; } tsParseTypeOrTypePredicateAnnotation( returnToken: TokenType, ): N.TsTypeAnnotation { return this.tsInType(() => { 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) { 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 = this.startNodeAtNode(t); node.parameterName = typePredicateVariable; node.typeAnnotation = type; node.asserts = asserts; t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); return this.finishNode(t, "TSTypeAnnotation"); }); } tsTryParseTypeOrTypePredicateAnnotation(): ?N.TsTypeAnnotation { return this.match(tt.colon) ? this.tsParseTypeOrTypePredicateAnnotation(tt.colon) : undefined; } tsTryParseTypeAnnotation(): ?N.TsTypeAnnotation { return this.match(tt.colon) ? this.tsParseTypeAnnotation() : undefined; } tsTryParseType(): ?N.TsType { return this.tsEatThenParseType(tt.colon); } tsParseTypePredicatePrefix(): ?N.Identifier { const id = this.parseIdentifier(); if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { this.next(); return id; } } 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(), ): N.TsTypeAnnotation { this.tsInType(() => { if (eatColon) this.expect(tt.colon); t.typeAnnotation = this.tsParseType(); }); return this.finishNode(t, "TSTypeAnnotation"); } /** Be sure to be in a type context before calling this, using `tsInType`. */ tsParseType(): N.TsType { // Need to set `state.inType` so that we don't parse JSX in a type context. assert(this.state.inType); const type = this.tsParseNonConditionalType(); if (this.hasPrecedingLineBreak() || !this.eat(tt._extends)) { return type; } const node: N.TsConditionalType = this.startNodeAtNode(type); node.checkType = type; node.extendsType = this.tsParseNonConditionalType(); this.expect(tt.question); node.trueType = this.tsParseType(); this.expect(tt.colon); node.falseType = this.tsParseType(); return this.finishNode(node, "TSConditionalType"); } tsParseNonConditionalType(): N.TsType { if (this.tsIsStartOfFunctionType()) { return this.tsParseFunctionOrConstructorType("TSFunctionType"); } if (this.match(tt._new)) { // As in `new () => Date` return this.tsParseFunctionOrConstructorType("TSConstructorType"); } return this.tsParseUnionTypeOrHigher(); } tsParseTypeAssertion(): N.TsTypeAssertion { const node: N.TsTypeAssertion = this.startNode(); const _const = this.tsTryNextParseConstantContext(); node.typeAnnotation = _const || this.tsNextThenParseType(); this.expectRelational(">"); node.expression = this.parseMaybeUnary(); return this.finishNode(node, "TSTypeAssertion"); } tsParseHeritageClause( descriptor: string, ): $ReadOnlyArray { const originalStart = this.state.start; const delimitedList = this.tsParseDelimitedList( "HeritageClauseElement", this.tsParseExpressionWithTypeArguments.bind(this), ); if (!delimitedList.length) { this.raise(originalStart, TSErrors.EmptyHeritageClauseType, descriptor); } return delimitedList; } tsParseExpressionWithTypeArguments(): N.TsExpressionWithTypeArguments { const node: N.TsExpressionWithTypeArguments = this.startNode(); // Note: TS uses parseLeftHandSideExpressionOrHigher, // then has grammar errors later if it's not an EntityName. node.expression = this.tsParseEntityName(/* allowReservedWords */ false); if (this.isRelational("<")) { node.typeParameters = this.tsParseTypeArguments(); } return this.finishNode(node, "TSExpressionWithTypeArguments"); } tsParseInterfaceDeclaration( node: N.TsInterfaceDeclaration, ): N.TsInterfaceDeclaration { node.id = this.parseIdentifier(); this.checkLVal( node.id, "typescript interface declaration", BIND_TS_INTERFACE, ); node.typeParameters = this.tsTryParseTypeParameters(); if (this.eat(tt._extends)) { node.extends = this.tsParseHeritageClause("extends"); } const body: N.TSInterfaceBody = this.startNode(); body.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this)); node.body = this.finishNode(body, "TSInterfaceBody"); return this.finishNode(node, "TSInterfaceDeclaration"); } tsParseTypeAliasDeclaration( node: N.TsTypeAliasDeclaration, ): N.TsTypeAliasDeclaration { node.id = this.parseIdentifier(); this.checkLVal(node.id, "typescript type alias", BIND_TS_TYPE); node.typeParameters = this.tsTryParseTypeParameters(); node.typeAnnotation = this.tsInType(() => { this.expect(tt.eq); if ( this.isContextual("intrinsic") && this.lookahead().type !== tt.dot ) { const node: N.TsKeywordType = this.startNode(); this.next(); return this.finishNode(node, "TSIntrinsicKeyword"); } return this.tsParseType(); }); this.semicolon(); return this.finishNode(node, "TSTypeAliasDeclaration"); } tsInNoContext(cb: () => T): T { const oldContext = this.state.context; this.state.context = [oldContext[0]]; try { return cb(); } finally { this.state.context = oldContext; } } /** * Runs `cb` in a type context. * This should be called one token *before* the first type token, * so that the call to `next()` is run in type context. */ tsInType(cb: () => T): T { const oldInType = this.state.inType; this.state.inType = true; try { return cb(); } finally { this.state.inType = oldInType; } } tsEatThenParseType(token: TokenType): N.TsType | typeof undefined { return !this.match(token) ? undefined : this.tsNextThenParseType(); } tsExpectThenParseType(token: TokenType): N.TsType { return this.tsDoThenParseType(() => this.expect(token)); } tsNextThenParseType(): N.TsType { return this.tsDoThenParseType(() => this.next()); } tsDoThenParseType(cb: () => void): N.TsType { return this.tsInType(() => { cb(); return this.tsParseType(); }); } tsParseEnumMember(): N.TsEnumMember { const node: N.TsEnumMember = this.startNode(); // Computed property names are grammar errors in an enum, so accept just string literal or identifier. node.id = this.match(tt.string) ? this.parseExprAtom() : this.parseIdentifier(/* liberal */ true); if (this.eat(tt.eq)) { node.initializer = this.parseMaybeAssignAllowIn(); } return this.finishNode(node, "TSEnumMember"); } tsParseEnumDeclaration( node: N.TsEnumDeclaration, isConst: boolean, ): N.TsEnumDeclaration { if (isConst) node.const = true; node.id = this.parseIdentifier(); this.checkLVal( node.id, "typescript enum declaration", isConst ? BIND_TS_CONST_ENUM : BIND_TS_ENUM, ); this.expect(tt.braceL); node.members = this.tsParseDelimitedList( "EnumMembers", this.tsParseEnumMember.bind(this), ); this.expect(tt.braceR); return this.finishNode(node, "TSEnumDeclaration"); } tsParseModuleBlock(): N.TsModuleBlock { const node: N.TsModuleBlock = this.startNode(); this.scope.enter(SCOPE_OTHER); this.expect(tt.braceL); // Inside of a module block is considered "top-level", meaning it can have imports and exports. this.parseBlockOrModuleBlockBody( (node.body = []), /* directives */ undefined, /* topLevel */ true, /* end */ tt.braceR, ); this.scope.exit(); return this.finishNode(node, "TSModuleBlock"); } tsParseModuleOrNamespaceDeclaration( node: N.TsModuleDeclaration, nested?: boolean = false, ): N.TsModuleDeclaration { node.id = this.parseIdentifier(); if (!nested) { this.checkLVal( node.id, "module or namespace declaration", BIND_TS_NAMESPACE, ); } if (this.eat(tt.dot)) { const inner = this.startNode(); 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"); } tsParseAmbientExternalModuleDeclaration( node: N.TsModuleDeclaration, ): N.TsModuleDeclaration { if (this.isContextual("global")) { node.global = true; node.id = this.parseIdentifier(); } else if (this.match(tt.string)) { node.id = this.parseExprAtom(); } 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(); } return this.finishNode(node, "TSModuleDeclaration"); } tsParseImportEqualsDeclaration( node: N.TsImportEqualsDeclaration, isExport?: boolean, ): N.TsImportEqualsDeclaration { node.isExport = isExport || false; node.id = this.parseIdentifier(); this.checkLVal(node.id, "import equals declaration", BIND_LEXICAL); this.expect(tt.eq); node.moduleReference = this.tsParseModuleReference(); this.semicolon(); return this.finishNode(node, "TSImportEqualsDeclaration"); } tsIsExternalModuleReference(): boolean { return ( this.isContextual("require") && this.lookaheadCharCode() === charCodes.leftParenthesis ); } tsParseModuleReference(): N.TsModuleReference { return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(/* allowReservedWords */ false); } tsParseExternalModuleReference(): N.TsExternalModuleReference { const node: N.TsExternalModuleReference = this.startNode(); this.expectContextual("require"); this.expect(tt.parenL); if (!this.match(tt.string)) { throw this.unexpected(); } // For compatibility to estree we cannot call parseLiteral directly here node.expression = this.parseExprAtom(); this.expect(tt.parenR); return this.finishNode(node, "TSExternalModuleReference"); } // Utilities tsLookAhead(f: () => T): T { const state = this.state.clone(); const res = f(); this.state = state; return res; } 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 { const state = this.state.clone(); const result = f(); if (result !== undefined && result !== false) { return result; } else { this.state = state; return undefined; } } tsTryParseDeclare(nany: any): ?N.Declaration { if (this.isLineTerminator()) { return; } let starttype = this.state.type; let kind; if (this.isContextual("let")) { starttype = tt._var; kind = "let"; } return this.tsInDeclareContext(() => { switch (starttype) { case tt._function: nany.declare = true; return this.parseFunctionStatement( nany, /* async */ false, /* 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, /* optionalId */ false, ); case tt._const: if (this.match(tt._const) && this.isLookaheadContextual("enum")) { // `const enum = 0;` not allowed because "enum" is a strict mode reserved word. this.expect(tt._const); this.expectContextual("enum"); return this.tsParseEnumDeclaration(nany, /* isConst */ true); } // falls through case tt._var: kind = kind || this.state.value; return this.parseVarStatement(nany, kind); case tt.name: { const value = this.state.value; if (value === "global") { return this.tsParseAmbientExternalModuleDeclaration(nany); } else { return this.tsParseDeclaration(nany, value, /* next */ true); } } } }); } // Note: this won't be called unless the keyword is allowed in `shouldParseExportDeclaration`. tsTryParseExportDeclaration(): ?N.Declaration { return this.tsParseDeclaration( this.startNode(), this.state.value, /* next */ true, ); } tsParseExpressionStatement(node: any, expr: N.Identifier): ?N.Declaration { switch (expr.name) { case "declare": { const declaration = this.tsTryParseDeclare(node); if (declaration) { declaration.declare = true; return declaration; } break; } case "global": // `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; default: return this.tsParseDeclaration(node, expr.name, /* next */ false); } } // Common to tsTryParseDeclare, tsTryParseExportDeclaration, and tsParseExpressionStatement. tsParseDeclaration( node: any, value: string, next: boolean, ): ?N.Declaration { switch (value) { case "abstract": if (this.tsCheckLineTerminatorAndMatch(tt._class, next)) { const cls: N.ClassDeclaration = node; cls.abstract = true; if (next) { this.next(); if (!this.match(tt._class)) { this.unexpected(null, tt._class); } } return this.parseClass( cls, /* isStatement */ true, /* optionalId */ false, ); } break; case "enum": if (next || this.match(tt.name)) { if (next) this.next(); return this.tsParseEnumDeclaration(node, /* isConst */ false); } break; case "interface": if (this.tsCheckLineTerminatorAndMatch(tt.name, next)) { if (next) this.next(); return this.tsParseInterfaceDeclaration(node); } break; case "module": if (next) this.next(); if (this.match(tt.string)) { return this.tsParseAmbientExternalModuleDeclaration(node); } else if (this.tsCheckLineTerminatorAndMatch(tt.name, next)) { return this.tsParseModuleOrNamespaceDeclaration(node); } break; case "namespace": if (this.tsCheckLineTerminatorAndMatch(tt.name, next)) { if (next) this.next(); return this.tsParseModuleOrNamespaceDeclaration(node); } break; case "type": if (this.tsCheckLineTerminatorAndMatch(tt.name, next)) { if (next) this.next(); return this.tsParseTypeAliasDeclaration(node); } break; } } tsCheckLineTerminatorAndMatch(tokenType: TokenType, next: boolean) { return (next || this.match(tokenType)) && !this.isLineTerminator(); } tsTryParseGenericAsyncArrowFunction( startPos: number, startLoc: Position, ): ?N.ArrowFunctionExpression { if (!this.isRelational("<")) { return undefined; } const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; this.state.maybeInArrowParameters = true; const res: ?N.ArrowFunctionExpression = this.tsTryParseAndCatch(() => { const node: N.ArrowFunctionExpression = this.startNodeAt( startPos, startLoc, ); node.typeParameters = this.tsParseTypeParameters(); // Don't use overloaded parseFunctionParams which would look for "<" again. super.parseFunctionParams(node); node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation(); this.expect(tt.arrow); return node; }); this.state.maybeInArrowParameters = oldMaybeInArrowParameters; if (!res) { return undefined; } return this.parseArrowExpression( res, /* params are already set */ null, /* async */ true, ); } tsParseTypeArguments(): N.TsTypeParameterInstantiation { const node = this.startNode(); node.params = this.tsInType(() => // Temporarily remove a JSX parsing context, which makes us scan different tokens. this.tsInNoContext(() => { this.expectRelational("<"); return this.tsParseDelimitedList( "TypeParametersOrArguments", this.tsParseType.bind(this), ); }), ); if (node.params.length === 0) { this.raise(node.start, TSErrors.EmptyTypeArguments); } // This reads the next token after the `>` too, so do this in the enclosing context. // But be sure not to parse a regex in the jsx expression ` />`, so set exprAllowed = false this.state.exprAllowed = false; this.expectRelational(">"); return this.finishNode(node, "TSTypeParameterInstantiation"); } tsIsDeclarationStart(): boolean { if (this.match(tt.name)) { switch (this.state.value) { case "abstract": case "declare": case "enum": case "interface": case "module": case "namespace": case "type": return true; } } return false; } // ====================================================== // OVERRIDES // ====================================================== isExportDefaultSpecifier(): boolean { if (this.tsIsDeclarationStart()) return false; return super.isExportDefaultSpecifier(); } parseAssignableListItem( allowModifiers: ?boolean, decorators: N.Decorator[], ): N.Pattern | N.TSParameterProperty { // Store original location/position to include modifiers in range const startPos = this.state.start; const startLoc = this.state.startLoc; let accessibility: ?N.Accessibility; let readonly = false; if (allowModifiers !== undefined) { accessibility = this.parseAccessModifier(); readonly = !!this.tsParseModifier(["readonly"]); if (allowModifiers === false && (accessibility || readonly)) { this.raise(startPos, TSErrors.UnexpectedParameterModifier); } } const left = this.parseMaybeDefault(); this.parseAssignableListItemTypes(left); const elt = this.parseMaybeDefault(left.start, left.loc.start, left); if (accessibility || readonly) { const pp: N.TSParameterProperty = this.startNodeAt(startPos, startLoc); if (decorators.length) { pp.decorators = decorators; } if (accessibility) pp.accessibility = accessibility; if (readonly) pp.readonly = readonly; if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") { this.raise(pp.start, TSErrors.UnsupportedParameterPropertyKind); } pp.parameter = ((elt: any): N.Identifier | N.AssignmentPattern); return this.finishNode(pp, "TSParameterProperty"); } if (decorators.length) { left.decorators = decorators; } return elt; } parseFunctionBodyAndFinish( node: N.BodilessFunctionOrMethodBase, type: string, isMethod?: boolean = false, ): void { if (this.match(tt.colon)) { node.returnType = this.tsParseTypeOrTypePredicateAnnotation(tt.colon); } const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" ? "TSDeclareMethod" : undefined; if (bodilessType && !this.match(tt.braceL) && this.isLineTerminator()) { this.finishNode(node, bodilessType); return; } if (bodilessType === "TSDeclareFunction" && this.state.isDeclareContext) { this.raise(node.start, TSErrors.DeclareFunctionHasImplementation); if ( // $FlowIgnore node.declare ) { super.parseFunctionBodyAndFinish(node, bodilessType, isMethod); return; } } super.parseFunctionBodyAndFinish(node, type, isMethod); } registerFunctionStatementId(node: N.Function): void { if (!node.body && node.id) { // Function ids are validated after parsing their body. // For bodyless function, we need to do it here. this.checkLVal(node.id, "function name", BIND_TS_AMBIENT); } else { super.registerFunctionStatementId(...arguments); } } tsCheckForInvalidTypeCasts(items: $ReadOnlyArray) { items.forEach(node => { if (node?.type === "TSTypeCastExpression") { this.raise( node.typeAnnotation.start, TSErrors.UnexpectedTypeAnnotation, ); } }); } toReferencedList( exprList: $ReadOnlyArray, isInParens?: boolean, // eslint-disable-line no-unused-vars ): $ReadOnlyArray { // Handles invalid scenarios like: `f(a:b)`, `(a:b);`, and `(a:b,c:d)`. // // Note that `f(a:b)` goes through a different path and is handled // in `parseSubscript` directly. this.tsCheckForInvalidTypeCasts(exprList); return exprList; } parseArrayLike(...args): N.ArrayExpression | N.TupleExpression { const node = super.parseArrayLike(...args); if (node.type === "ArrayExpression") { this.tsCheckForInvalidTypeCasts(node.elements); } return node; } parseSubscript( base: N.Expression, startPos: number, startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, ): N.Expression { if (!this.hasPrecedingLineBreak() && this.match(tt.bang)) { this.state.exprAllowed = false; this.next(); const nonNullExpression: N.TsNonNullExpression = this.startNodeAt( startPos, startLoc, ); nonNullExpression.expression = base; return this.finishNode(nonNullExpression, "TSNonNullExpression"); } if (this.isRelational("<")) { // tsTryParseAndCatch is expensive, so avoid if not necessary. // 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.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( startPos, startLoc, ); if (asyncArrowFn) { return asyncArrowFn; } } const node: N.CallExpression = this.startNodeAt(startPos, startLoc); node.callee = base; const typeArguments = this.tsParseTypeArguments(); if (typeArguments) { if (!noCalls && this.eat(tt.parenL)) { // possibleAsync always false here, because we would have handled it above. // $FlowIgnore (won't be any undefined arguments) node.arguments = this.parseCallExpressionArguments( tt.parenR, /* possibleAsync */ false, ); // Handles invalid case: `f(a:b)` this.tsCheckForInvalidTypeCasts(node.arguments); node.typeParameters = typeArguments; return this.finishCallExpression(node, state.optionalChainMember); } else if (this.match(tt.backQuote)) { const result = this.parseTaggedTemplateExpression( base, startPos, startLoc, state, ); result.typeParameters = typeArguments; return result; } } this.unexpected(); }); if (result) return result; } return super.parseSubscript(base, startPos, startLoc, noCalls, state); } parseNewArguments(node: N.NewExpression): void { if (this.isRelational("<")) { // tsTryParseAndCatch is expensive, so avoid if not necessary. // 99% certain this is `new C();`. But may be `new C < T;`, which is also legal. const typeParameters = this.tsTryParseAndCatch(() => { const args = this.tsParseTypeArguments(); if (!this.match(tt.parenL)) this.unexpected(); return args; }); if (typeParameters) { node.typeParameters = typeParameters; } } super.parseNewArguments(node); } parseExprOp( left: N.Expression, leftStartPos: number, leftStartLoc: Position, minPrec: number, ) { if ( nonNull(tt._in.binop) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual("as") ) { const node: N.TsAsExpression = this.startNodeAt( leftStartPos, leftStartLoc, ); node.expression = left; const _const = this.tsTryNextParseConstantContext(); if (_const) { node.typeAnnotation = _const; } else { node.typeAnnotation = this.tsNextThenParseType(); } this.finishNode(node, "TSAsExpression"); // rescan `<`, `>` because they were scanned when this.state.inType was true this.reScan_lt_gt(); return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec); } return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec); } checkReservedWord( word: string, // eslint-disable-line no-unused-vars startLoc: number, // eslint-disable-line no-unused-vars checkKeywords: boolean, // eslint-disable-line no-unused-vars // eslint-disable-next-line no-unused-vars isBinding: boolean, ): void { // Don't bother checking for TypeScript code. // Strict mode words may be allowed as in `declare namespace N { const static: number; }`. // And we have a type checker anyway, so don't bother having the parser do it. } /* Don't bother doing this check in TypeScript code because: 1. We may have a nested export statement with the same name: export const x = 0; export namespace N { export const x = 1; } 2. We have a type checker to warn us about this sort of thing. */ checkDuplicateExports() {} parseImport(node: N.Node): N.AnyImport { 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(); } } if (!node.importKind) { node.importKind = "value"; } 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 { if (this.match(tt._import)) { // `export import A = B;` this.expect(tt._import); return this.tsParseImportEqualsDeclaration(node, /* isExport */ true); } else if (this.eat(tt.eq)) { // `export = x;` const assign: N.TsExportAssignment = node; assign.expression = this.parseExpression(); this.semicolon(); return this.finishNode(assign, "TSExportAssignment"); } else if (this.eatContextual("as")) { // `export as namespace A;` const decl: N.TsNamespaceExportDeclaration = node; // See `parseNamespaceExportDeclaration` in TypeScript's own parser this.expectContextual("namespace"); decl.id = this.parseIdentifier(); 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); } } isAbstractClass(): boolean { return ( this.isContextual("abstract") && this.lookahead().type === tt._class ); } parseExportDefaultExpression(): N.Expression | N.Declaration { if (this.isAbstractClass()) { const cls = this.startNode(); this.next(); // Skip "abstract" this.parseClass(cls, true, true); cls.abstract = true; return cls; } // export default interface allowed in: // https://github.com/Microsoft/TypeScript/pull/16040 if (this.state.value === "interface") { const result = this.tsParseDeclaration( this.startNode(), this.state.value, true, ); if (result) return result; } return super.parseExportDefaultExpression(); } parseStatementContent(context: ?string, topLevel: ?boolean): N.Statement { if (this.state.type === tt._const) { const ahead = this.lookahead(); if (ahead.type === tt.name && ahead.value === "enum") { const node: N.TsEnumDeclaration = this.startNode(); this.expect(tt._const); this.expectContextual("enum"); return this.tsParseEnumDeclaration(node, /* isConst */ true); } } return super.parseStatementContent(context, topLevel); } parseAccessModifier(): ?N.Accessibility { return this.tsParseModifier(["public", "protected", "private"]); } parseClassMember( classBody: N.ClassBody, member: any, state: N.ParseClassMemberState, ): void { this.tsParseModifiers(member, ["declare"]); const accessibility = this.parseAccessModifier(); if (accessibility) member.accessibility = accessibility; this.tsParseModifiers(member, ["declare"]); const callParseClassMember = () => { super.parseClassMember(classBody, member, state); }; if (member.declare) { this.tsInDeclareContext(callParseClassMember); } else { callParseClassMember(); } } parseClassMemberWithIsStatic( classBody: N.ClassBody, member: N.ClassMember | N.TsIndexSignature, state: N.ParseClassMemberState, isStatic: boolean, ): void { this.tsParseModifiers(member, ["abstract", "readonly", "declare"]); const idx = this.tsTryParseIndexSignature(member); if (idx) { classBody.body.push(idx); 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 ((member: any).declare) { this.raise(member.start, TSErrors.IndexSignatureHasDeclare); } return; } /*:: invariant(member.type !== "TSIndexSignature") */ super.parseClassMemberWithIsStatic(classBody, member, state, isStatic); } parsePostMemberNameModifiers( 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` // is that e.g. `type()` is valid JS, so we must try parsing that first. // If it's really a type, we will parse `type` as the statement, and can correct it here // by parsing the rest. parseExpressionStatement( node: N.ExpressionStatement, expr: N.Expression, ): N.Statement { const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr) : undefined; return decl || super.parseExpressionStatement(node, expr); } // export type // Should be true for anything parsed by `tsTryParseExportDeclaration`. shouldParseExportDeclaration(): boolean { if (this.tsIsDeclarationStart()) return true; return super.shouldParseExportDeclaration(); } // An apparent conditional expression could actually be an optional parameter in an arrow function. parseConditional( expr: N.Expression, startPos: number, startLoc: Position, refNeedsArrowPos?: ?Pos, ): N.Expression { // only do the expensive clone if there is a question mark // and if we come from inside parens if (!refNeedsArrowPos || !this.match(tt.question)) { return super.parseConditional( expr, startPos, startLoc, refNeedsArrowPos, ); } const result = this.tryParse(() => super.parseConditional(expr, 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; } // Note: These "type casts" are *not* valid TS expressions. // But we parse them here and change them when completing the arrow function. parseParenItem( node: N.Expression, startPos: number, startLoc: Position, ): N.Expression { node = super.parseParenItem(node, startPos, startLoc); if (this.eat(tt.question)) { node.optional = true; // Include questionmark in location of node // Don't use this.finishNode() as otherwise we might process comments twice and // include already consumed parens this.resetEndLocation(node); } if (this.match(tt.colon)) { const typeCastNode: N.TsTypeCastExpression = this.startNodeAt( startPos, startLoc, ); typeCastNode.expression = node; typeCastNode.typeAnnotation = this.tsParseTypeAnnotation(); return this.finishNode(typeCastNode, "TSTypeCastExpression"); } return node; } parseExportDeclaration(node: N.ExportNamedDeclaration): ?N.Declaration { // Store original location/position const startPos = this.state.start; const startLoc = this.state.startLoc; // "export declare" is equivalent to just "export". const isDeclare = this.eatContextual("declare"); let declaration: ?N.Declaration; if (this.match(tt.name)) { declaration = this.tsTryParseExportDeclaration(); } 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 this.resetStartLocation(declaration, startPos, startLoc); declaration.declare = true; } return declaration; } parseClassId( node: N.Class, isStatement: boolean, optionalId: ?boolean, ): void { if ((!isStatement || optionalId) && this.isContextual("implements")) { return; } super.parseClassId( node, isStatement, optionalId, (node: any).declare ? BIND_TS_AMBIENT : BIND_CLASS, ); const typeParameters = this.tsTryParseTypeParameters(); if (typeParameters) node.typeParameters = typeParameters; } 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 (this.state.isDeclareContext && this.match(tt.eq)) { 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, isGenerator: boolean, isAsync: boolean, isConstructor: boolean, allowsDirectSuper: boolean, ): void { const typeParameters = this.tsTryParseTypeParameters(); if (typeParameters && isConstructor) { this.raise(typeParameters.start, TSErrors.ConstructorHasTypeParameters); } if (typeParameters) method.typeParameters = typeParameters; super.pushClassMethod( classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper, ); } pushClassPrivateMethod( classBody: N.ClassBody, method: N.ClassPrivateMethod, isGenerator: boolean, isAsync: boolean, ): void { const typeParameters = this.tsTryParseTypeParameters(); if (typeParameters) method.typeParameters = typeParameters; super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync); } parseClassSuper(node: N.Class): void { super.parseClassSuper(node); if (node.superClass && this.isRelational("<")) { node.superTypeParameters = this.tsParseTypeArguments(); } if (this.eatContextual("implements")) { node.implements = this.tsParseHeritageClause("implements"); } } parseObjPropValue(prop: N.ObjectMember, ...args): void { const typeParameters = this.tsTryParseTypeParameters(); if (typeParameters) prop.typeParameters = typeParameters; super.parseObjPropValue(prop, ...args); } parseFunctionParams(node: N.Function, allowModifiers?: boolean): void { const typeParameters = this.tsTryParseTypeParameters(); if (typeParameters) node.typeParameters = typeParameters; super.parseFunctionParams(node, allowModifiers); } // `let x: number;` parseVarId( decl: N.VariableDeclarator, kind: "var" | "let" | "const", ): void { super.parseVarId(decl, kind); if (decl.id.type === "Identifier" && this.eat(tt.bang)) { decl.definite = true; } const type = this.tsTryParseTypeAnnotation(); if (type) { decl.id.typeAnnotation = type; this.resetEndLocation(decl.id); // set end position to end of type } } // parse the return type of an async arrow function - let foo = (async (): number => {}); parseAsyncArrowFromCallExpression( node: N.ArrowFunctionExpression, call: N.CallExpression, ): N.ArrowFunctionExpression { if (this.match(tt.colon)) { node.returnType = this.tsParseTypeAnnotation(); } return super.parseAsyncArrowFromCallExpression(node, call); } parseMaybeAssign(...args): N.Expression { // Note: When the JSX plugin is on, type assertions (` x`) aren't valid syntax. let state: ?State; let jsx; let typeCast; if (this.match(tt.jsxTagStart)) { // Prefer to parse JSX if possible. But may be an arrow fn. state = this.state.clone(); jsx = this.tryParse(() => super.parseMaybeAssign(...args), 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] === ct.j_oTag) { context.length -= 2; } else if (context[context.length - 1] === ct.j_expr) { context.length -= 1; } } if (!jsx?.error && !this.isRelational("<")) { return super.parseMaybeAssign(...args); } // Either way, we're looking at a '<': tt.jsxTagStart or relational. let typeParameters: N.TsTypeParameterDeclaration; state = state || this.state.clone(); const arrow = this.tryParse(abort => { // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. typeParameters = this.tsParseTypeParameters(); const expr = super.parseMaybeAssign(...args); if ( expr.type !== "ArrowFunctionExpression" || (expr.extra && expr.extra.parenthesized) ) { abort(); } // Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code. if (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")); // 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. typeCast = this.tryParse(() => super.parseMaybeAssign(...args), state); /*:: invariant(!typeCast.aborted) */ if (!typeCast.error) return typeCast.node; } if (jsx?.node) { /*:: invariant(jsx.failState) */ this.state = jsx.failState; return jsx.node; } if (arrow.node) { /*:: invariant(arrow.failState) */ this.state = arrow.failState; return arrow.node; } if (typeCast?.node) { /*:: invariant(typeCast.failState) */ this.state = typeCast.failState; return typeCast.node; } if (jsx?.thrown) throw jsx.error; if (arrow.thrown) throw arrow.error; if (typeCast?.thrown) throw typeCast.error; throw jsx?.error || arrow.error || typeCast?.error; } // Handle type assertions parseMaybeUnary(refExpressionErrors?: ?ExpressionErrors): N.Expression { if (!this.hasPlugin("jsx") && this.isRelational("<")) { return this.tsParseTypeAssertion(); } else { return super.parseMaybeUnary(refExpressionErrors); } } parseArrow(node: N.ArrowFunctionExpression): ?N.ArrowFunctionExpression { 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 result = this.tryParse(abort => { const returnType = this.tsParseTypeOrTypePredicateAnnotation( tt.colon, ); 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; } } return super.parseArrow(node); } // Allow type annotations inside of a parameter list. parseAssignableListItemTypes(param: N.Pattern) { if (this.eat(tt.question)) { if ( param.type !== "Identifier" && !this.state.isDeclareContext && !this.state.inType ) { this.raise(param.start, TSErrors.PatternIsOptional); } ((param: any): N.Identifier).optional = true; } const type = this.tsTryParseTypeAnnotation(); if (type) param.typeAnnotation = type; this.resetEndLocation(param); return param; } toAssignable(node: N.Node, isLHS: boolean = false): N.Node { switch (node.type) { case "TSTypeCastExpression": return super.toAssignable(this.typeCastToParameter(node), isLHS); case "TSParameterProperty": return super.toAssignable(node, isLHS); case "TSAsExpression": case "TSNonNullExpression": case "TSTypeAssertion": node.expression = this.toAssignable(node.expression, isLHS); return node; default: return super.toAssignable(node, isLHS); } } checkLVal( expr: N.Expression, contextDescription: string, ...args: | [BindingTypes | void] | [BindingTypes | void, ?Set, boolean | void, boolean | void] ): void { switch (expr.type) { case "TSTypeCastExpression": // Allow "typecasts" to appear on the left of assignment expressions, // because it may be in an arrow function. // e.g. `const f = (foo: number = 0) => foo;` return; case "TSParameterProperty": this.checkLVal(expr.parameter, "parameter property", ...args); return; case "TSAsExpression": case "TSNonNullExpression": case "TSTypeAssertion": this.checkLVal(expr.expression, contextDescription, ...args); return; default: super.checkLVal(expr, contextDescription, ...args); return; } } parseBindingAtom(): N.Pattern { switch (this.state.type) { case tt._this: // "this" may be the name of a parameter, so allow it. return this.parseIdentifier(/* liberal */ true); default: return super.parseBindingAtom(); } } parseMaybeDecoratorArguments(expr: N.Expression): N.Expression { if (this.isRelational("<")) { const typeArguments = this.tsParseTypeArguments(); if (this.match(tt.parenL)) { const call = super.parseMaybeDecoratorArguments(expr); call.typeParameters = typeArguments; return call; } this.unexpected(this.state.start, tt.parenL); } return super.parseMaybeDecoratorArguments(expr); } // === === === === === === === === === === === === === === === === // Note: All below methods are duplicates of something in flow.js. // Not sure what the best way to combine these is. // === === === === === === === === === === === === === === === === isClassMethod(): boolean { return this.isRelational("<") || super.isClassMethod(); } isClassProperty(): boolean { return ( this.match(tt.bang) || this.match(tt.colon) || super.isClassProperty() ); } parseMaybeDefault(...args): N.Pattern { const node = super.parseMaybeDefault(...args); if ( node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start ) { this.raise( node.typeAnnotation.start, TSErrors.TypeAnnotationAfterAssign, ); } return node; } // ensure that inside types, we bypass the jsx parser plugin getTokenFromCode(code: number): void { if ( this.state.inType && (code === charCodes.greaterThan || code === charCodes.lessThan) ) { return this.finishOp(tt.relational, 1); } else { return super.getTokenFromCode(code); } } // used after we have finished parsing types reScan_lt_gt() { if (this.match(tt.relational)) { const code = this.input.charCodeAt(this.state.start); if (code === charCodes.lessThan || code === charCodes.greaterThan) { this.state.pos -= 1; this.readToken_lt_gt(code); } } } toAssignableList(exprList: N.Expression[]): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; if (!expr) continue; switch (expr.type) { case "TSTypeCastExpression": exprList[i] = this.typeCastToParameter(expr); break; case "TSAsExpression": case "TSTypeAssertion": if (!this.state.maybeInArrowParameters) { exprList[i] = this.typeCastToParameter(expr); } else { this.raise(expr.start, TSErrors.UnexpectedTypeCastInParameter); } break; } } return super.toAssignableList(...arguments); } typeCastToParameter(node: N.TsTypeCastExpression): N.Node { node.expression.typeAnnotation = node.typeAnnotation; this.resetEndLocation( node.expression, node.typeAnnotation.end, node.typeAnnotation.loc.end, ); return node.expression; } shouldParseArrow() { return this.match(tt.colon) || super.shouldParseArrow(); } shouldParseAsyncArrow(): boolean { return this.match(tt.colon) || super.shouldParseAsyncArrow(); } canHaveLeadingDecorator() { // Avoid unnecessary lookahead in checking for abstract class unless needed! return super.canHaveLeadingDecorator() || this.isAbstractClass(); } jsxParseOpeningElementAfterName( node: N.JSXOpeningElement, ): N.JSXOpeningElement { if (this.isRelational("<")) { const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArguments(), ); if (typeArguments) node.typeParameters = typeArguments; } return super.jsxParseOpeningElementAfterName(node); } getGetterSetterExpectedParamCount( method: N.ObjectMethod | N.ClassMethod, ): number { const baseCount = super.getGetterSetterExpectedParamCount(method); const params = this.getObjectOrClassMethodParams(method); const firstParam = params[0]; const hasContextParam = firstParam && firstParam.type === "Identifier" && firstParam.name === "this"; return hasContextParam ? baseCount + 1 : baseCount; } parseCatchClauseParam(): N.Pattern { const param = super.parseCatchClauseParam(); const type = this.tsTryParseTypeAnnotation(); if (type) { param.typeAnnotation = type; this.resetEndLocation(param); } return param; } tsInDeclareContext(cb: () => T): T { const oldIsDeclareContext = this.state.isDeclareContext; this.state.isDeclareContext = true; try { return cb(); } finally { this.state.isDeclareContext = oldIsDeclareContext; } } }; babel-7.12.12/packages/babel-parser/src/plugins/typescript/scope.js000066400000000000000000000063121377064615700252150ustar00rootroot00000000000000// @flow import ScopeHandler, { Scope } from "../../util/scope"; import { BIND_KIND_TYPE, BIND_FLAGS_TS_ENUM, BIND_FLAGS_TS_CONST_ENUM, BIND_FLAGS_TS_EXPORT_ONLY, BIND_KIND_VALUE, BIND_FLAGS_CLASS, type ScopeFlags, type BindingTypes, } from "../../util/scopeflags"; import * as N from "../../types"; class TypeScriptScope extends Scope { types: string[] = []; // enums (which are also in .types) enums: string[] = []; // const enums (which are also in .enums and .types) constEnums: string[] = []; // classes (which are also in .lexical) and interface (which are also in .types) classes: string[] = []; // 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. exportOnlyBindings: string[] = []; } // See https://github.com/babel/babel/pull/9766#discussion_r268920730 for an // explanation of how typescript handles scope. export default class TypeScriptScopeHandler extends ScopeHandler { createScope(flags: ScopeFlags): TypeScriptScope { return new TypeScriptScope(flags); } declareName(name: string, bindingType: BindingTypes, pos: number) { const scope = this.currentScope(); if (bindingType & BIND_FLAGS_TS_EXPORT_ONLY) { this.maybeExportDefined(scope, name); scope.exportOnlyBindings.push(name); return; } super.declareName(...arguments); if (bindingType & BIND_KIND_TYPE) { if (!(bindingType & BIND_KIND_VALUE)) { // "Value" bindings have already been registered by the superclass. this.checkRedeclarationInScope(scope, name, bindingType, pos); this.maybeExportDefined(scope, name); } scope.types.push(name); } if (bindingType & BIND_FLAGS_TS_ENUM) scope.enums.push(name); if (bindingType & BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.push(name); if (bindingType & BIND_FLAGS_CLASS) scope.classes.push(name); } isRedeclaredInScope( scope: TypeScriptScope, name: string, bindingType: BindingTypes, ): boolean { if (scope.enums.indexOf(name) > -1) { if (bindingType & BIND_FLAGS_TS_ENUM) { // Enums can be merged with other enums if they are both // const or both non-const. const isConst = !!(bindingType & BIND_FLAGS_TS_CONST_ENUM); const wasConst = scope.constEnums.indexOf(name) > -1; return isConst !== wasConst; } return true; } if (bindingType & BIND_FLAGS_CLASS && scope.classes.indexOf(name) > -1) { if (scope.lexical.indexOf(name) > -1) { // Classes can be merged with interfaces return !!(bindingType & BIND_KIND_VALUE); } else { // Interface can be merged with other classes or interfaces return false; } } if (bindingType & BIND_KIND_TYPE && scope.types.indexOf(name) > -1) { return true; } return super.isRedeclaredInScope(...arguments); } checkLocalExport(id: N.Identifier) { if ( this.scopeStack[0].types.indexOf(id.name) === -1 && this.scopeStack[0].exportOnlyBindings.indexOf(id.name) === -1 ) { super.checkLocalExport(id); } } } babel-7.12.12/packages/babel-parser/src/plugins/v8intrinsic.js000066400000000000000000000022101377064615700241470ustar00rootroot00000000000000import 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); } }; babel-7.12.12/packages/babel-parser/src/tokenizer/000077500000000000000000000000001377064615700216675ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/src/tokenizer/context.js000066400000000000000000000100121377064615700237030ustar00rootroot00000000000000// @flow // The algorithm used to determine whether a regexp can appear at a // given point in the program is loosely based on sweet.js' approach. // See https://github.com/mozilla/sweet.js/wiki/design import { types as tt } from "./types"; export class TokContext { constructor( token: string, isExpr?: boolean, preserveSpace?: boolean, override?: ?Function, // Takes a Tokenizer as a this-parameter, and returns void. ) { this.token = token; this.isExpr = !!isExpr; this.preserveSpace = !!preserveSpace; this.override = override; } token: string; isExpr: boolean; preserveSpace: boolean; override: ?Function; } export const types: { [key: string]: TokContext, } = { braceStatement: new TokContext("{", false), braceExpression: new TokContext("{", true), recordExpression: new TokContext("#{", true), templateQuasi: new TokContext("${", false), parenStatement: new TokContext("(", false), parenExpression: new TokContext("(", true), template: new TokContext("`", true, true, p => p.readTmplToken()), functionExpression: new TokContext("function", true), functionStatement: new TokContext("function", false), }; // Token-specific context update code // Note that we should avoid accessing `this.prodParam` in context update, // because it is executed immediately when last token is consumed, which may be // before `this.prodParam` is updated. e.g. // ``` // function *g() { () => yield / 2 } // ``` // When `=>` is eaten, the context update of `yield` is executed, however, // `this.prodParam` still has `[Yield]` production because it is not yet updated tt.parenR.updateContext = tt.braceR.updateContext = function () { if (this.state.context.length === 1) { this.state.exprAllowed = true; return; } let out = this.state.context.pop(); if (out === types.braceStatement && this.curContext().token === "function") { out = this.state.context.pop(); } this.state.exprAllowed = !out.isExpr; }; tt.name.updateContext = function (prevType) { let allowed = false; if (prevType !== tt.dot) { if ( this.state.value === "of" && !this.state.exprAllowed && prevType !== tt._function && prevType !== tt._class ) { allowed = true; } } this.state.exprAllowed = allowed; if (this.state.isIterator) { this.state.isIterator = false; } }; tt.braceL.updateContext = function (prevType) { this.state.context.push( this.braceIsBlock(prevType) ? types.braceStatement : types.braceExpression, ); this.state.exprAllowed = true; }; tt.dollarBraceL.updateContext = function () { this.state.context.push(types.templateQuasi); this.state.exprAllowed = true; }; tt.parenL.updateContext = function (prevType) { const statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while; this.state.context.push( statementParens ? types.parenStatement : types.parenExpression, ); this.state.exprAllowed = true; }; tt.incDec.updateContext = function () { // tokExprAllowed stays unchanged }; tt._function.updateContext = tt._class.updateContext = function (prevType) { if ( prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else && !(prevType === tt._return && this.hasPrecedingLineBreak()) && !( (prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat ) ) { this.state.context.push(types.functionExpression); } else { this.state.context.push(types.functionStatement); } this.state.exprAllowed = false; }; tt.backQuote.updateContext = function () { if (this.curContext() === types.template) { this.state.context.pop(); } else { this.state.context.push(types.template); } this.state.exprAllowed = false; }; // we don't need to update context for tt.braceBarL because we do not pop context for tt.braceBarR tt.braceHashL.updateContext = function () { this.state.context.push(types.recordExpression); this.state.exprAllowed = true; /* tt.braceHashL.beforeExpr */ }; babel-7.12.12/packages/babel-parser/src/tokenizer/index.js000066400000000000000000001257061377064615700233470ustar00rootroot00000000000000// @flow /*:: declare var invariant; */ 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 ParserErrors, { Errors } from "../parser/error"; import { SourceLocation } from "../util/location"; import { lineBreak, lineBreakG, isNewLine, isWhitespace, skipWhiteSpace, } from "../util/whitespace"; import State from "./state"; const VALID_REGEX_FLAGS = new Set(["g", "m", "s", "i", "y", "u"]); // The following character codes are forbidden from being // an immediate sibling of NumericLiteralSeparator _ const forbiddenNumericSeparatorSiblings = { decBinOct: [ charCodes.dot, charCodes.uppercaseB, charCodes.uppercaseE, charCodes.uppercaseO, charCodes.underscore, // multiple separators are not allowed charCodes.lowercaseB, charCodes.lowercaseE, charCodes.lowercaseO, ], hex: [ charCodes.dot, charCodes.uppercaseX, charCodes.underscore, // multiple separators are not allowed charCodes.lowercaseX, ], }; const allowedNumericSeparatorSiblings = {}; allowedNumericSeparatorSiblings.bin = [ // 0 - 1 charCodes.digit0, charCodes.digit1, ]; allowedNumericSeparatorSiblings.oct = [ // 0 - 7 ...allowedNumericSeparatorSiblings.bin, charCodes.digit2, charCodes.digit3, charCodes.digit4, charCodes.digit5, charCodes.digit6, charCodes.digit7, ]; allowedNumericSeparatorSiblings.dec = [ // 0 - 9 ...allowedNumericSeparatorSiblings.oct, charCodes.digit8, charCodes.digit9, ]; allowedNumericSeparatorSiblings.hex = [ // 0 - 9, A - F, a - f, ...allowedNumericSeparatorSiblings.dec, charCodes.uppercaseA, charCodes.uppercaseB, charCodes.uppercaseC, charCodes.uppercaseD, charCodes.uppercaseE, charCodes.uppercaseF, charCodes.lowercaseA, charCodes.lowercaseB, charCodes.lowercaseC, charCodes.lowercaseD, charCodes.lowercaseE, charCodes.lowercaseF, ]; // Object type used to represent tokens. Note that normally, tokens // simply exist as properties on the parser object. This is only // used for the onToken callback and the external tokenizer. export class Token { constructor(state: State) { this.type = state.type; this.value = state.value; this.start = state.start; this.end = state.end; this.loc = new SourceLocation(state.startLoc, state.endLoc); } declare type: TokenType; declare value: any; declare start: number; declare end: number; declare loc: SourceLocation; } // ## Tokenizer export default class Tokenizer extends ParserErrors { // Forward-declarations // parser/util.js /*:: +hasPrecedingLineBreak: () => boolean; +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(); this.state.init(options); this.input = input; this.length = input.length; 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.isLookahead) { this.checkKeywordEscapes(); if (this.options.tokens) { this.pushToken(new Token(this.state)); } } this.state.lastTokEnd = this.state.end; this.state.lastTokStart = this.state.start; this.state.lastTokEndLoc = this.state.endLoc; this.state.lastTokStartLoc = this.state.startLoc; this.nextToken(); } // TODO eat(type: TokenType): boolean { if (this.match(type)) { this.next(); return true; } else { return false; } } // TODO match(type: TokenType): boolean { return this.state.type === type; } // TODO lookahead(): State { const old = this.state; this.state = old.clone(true); this.isLookahead = true; this.next(); this.isLookahead = false; const curr = this.state; this.state = old; return curr; } nextTokenStart(): number { return this.nextTokenStartSince(this.state.pos); } nextTokenStartSince(pos: number): number { skipWhiteSpace.lastIndex = pos; const skip = skipWhiteSpace.exec(this.input); // $FlowIgnore: The skipWhiteSpace ensures to match any string return pos + 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). setStrict(strict: boolean): void { this.state.strict = strict; if (strict) { // Throw an error for any string decimal escape found before/immediately // after a "use strict" directive. Strict mode will be set at parse // time for any literals that occur after the next node of the strict // directive. this.state.strictErrors.forEach((message, pos) => /* eslint-disable @babel/development-internal/dry-error-messages */ this.raise(pos, message), ); this.state.strictErrors.clear(); } } curContext(): TokContext { return this.state.context[this.state.context.length - 1]; } // Read a single token, updating the parser object's token-related // properties. nextToken(): void { const curContext = this.curContext(); if (!curContext?.preserveSpace) this.skipSpace(); this.state.start = this.state.pos; this.state.startLoc = this.state.curPosition(); if (this.state.pos >= this.length) { this.finishToken(tt.eof); return; } const override = curContext?.override; if (override) { override(this); } else { this.getTokenFromCode(this.input.codePointAt(this.state.pos)); } } pushComment( block: boolean, text: string, start: number, end: number, startLoc: Position, endLoc: Position, ): void { const comment = { type: block ? "CommentBlock" : "CommentLine", value: text, start: start, end: end, loc: new SourceLocation(startLoc, endLoc), }; if (this.options.tokens) this.pushToken(comment); this.state.comments.push(comment); this.addComment(comment); } skipBlockComment(): void { const startLoc = this.state.curPosition(); const start = this.state.pos; 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; let match; while ( (match = lineBreakG.exec(this.input)) && match.index < this.state.pos ) { ++this.state.curLine; this.state.lineStart = match.index + match[0].length; } // If we are doing a lookahead right now we need to advance the position (above code) // but we do not want to push the comment to the state. if (this.isLookahead) return; this.pushComment( true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition(), ); } skipLineComment(startSkip: number): void { const start = this.state.pos; const startLoc = this.state.curPosition(); let ch = this.input.charCodeAt((this.state.pos += startSkip)); if (this.state.pos < this.length) { while (!isNewLine(ch) && ++this.state.pos < this.length) { ch = this.input.charCodeAt(this.state.pos); } } // If we are doing a lookahead right now we need to advance the position (above code) // but we do not want to push the comment to the state. if (this.isLookahead) return; this.pushComment( false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition(), ); } // Called at the start of the parse and after every token. Skips // whitespace and comments, and. skipSpace(): void { loop: while (this.state.pos < this.length) { const ch = this.input.charCodeAt(this.state.pos); switch (ch) { case charCodes.space: case charCodes.nonBreakingSpace: case charCodes.tab: ++this.state.pos; break; case charCodes.carriageReturn: if ( this.input.charCodeAt(this.state.pos + 1) === charCodes.lineFeed ) { ++this.state.pos; } // fall through case charCodes.lineFeed: case charCodes.lineSeparator: case charCodes.paragraphSeparator: ++this.state.pos; ++this.state.curLine; this.state.lineStart = this.state.pos; break; case charCodes.slash: switch (this.input.charCodeAt(this.state.pos + 1)) { case charCodes.asterisk: this.skipBlockComment(); break; case charCodes.slash: this.skipLineComment(2); break; default: break loop; } break; default: if (isWhitespace(ch)) { ++this.state.pos; } else { break loop; } } } } // Called at the end of every token. Sets `end`, `val`, and // maintains `context` and `exprAllowed`, and skips the space after // the token, so that the next one's `start` will point at the // right position. finishToken(type: TokenType, val: any): void { this.state.end = this.state.pos; this.state.endLoc = this.state.curPosition(); const prevType = this.state.type; this.state.type = type; this.state.value = val; if (!this.isLookahead) this.updateContext(prevType); } // ### Token reading // This is the function that is called to fetch the next token. It // is somewhat obscure, because it works in character codes rather // than characters, and because operator parsing has been inlined // into it. // // All in the name of speed. // number sign is "#" readToken_numberSign(): void { if (this.state.pos === 0 && this.readToken_interpreter()) { return; } const nextPos = this.state.pos + 1; const next = this.input.charCodeAt(nextPos); if (next >= charCodes.digit0 && next <= charCodes.digit9) { throw this.raise(this.state.pos, Errors.UnexpectedDigitAfterHash); } if ( next === charCodes.leftCurlyBrace || (next === charCodes.leftSquareBracket && this.hasPlugin("recordAndTuple")) ) { // 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.finishOp(tt.hash, 1); } } readToken_dot(): void { const next = this.input.charCodeAt(this.state.pos + 1); if (next >= charCodes.digit0 && next <= charCodes.digit9) { this.readNumber(true); return; } if ( next === charCodes.dot && this.input.charCodeAt(this.state.pos + 2) === charCodes.dot ) { this.state.pos += 3; this.finishToken(tt.ellipsis); } else { ++this.state.pos; this.finishToken(tt.dot); } } readToken_slash(): void { // '/' if (this.state.exprAllowed && !this.state.inType) { ++this.state.pos; this.readRegexp(); return; } const next = this.input.charCodeAt(this.state.pos + 1); if (next === charCodes.equalsTo) { this.finishOp(tt.assign, 2); } else { this.finishOp(tt.slash, 1); } } 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; while (!isNewLine(ch) && ++this.state.pos < this.length) { ch = this.input.charCodeAt(this.state.pos); } const value = this.input.slice(start + 2, this.state.pos); this.finishToken(tt.interpreterDirective, value); return true; } readToken_mult_modulo(code: number): void { // '%*' let type = code === charCodes.asterisk ? tt.star : tt.modulo; let width = 1; let next = this.input.charCodeAt(this.state.pos + 1); const exprAllowed = this.state.exprAllowed; // Exponentiation operator ** if (code === charCodes.asterisk && next === charCodes.asterisk) { width++; next = this.input.charCodeAt(this.state.pos + 2); type = tt.exponent; } if (next === charCodes.equalsTo && !exprAllowed) { width++; type = tt.assign; } this.finishOp(type, width); } readToken_pipe_amp(code: number): void { // '||' '&&' '||=' '&&=' const next = this.input.charCodeAt(this.state.pos + 1); if (next === code) { if (this.input.charCodeAt(this.state.pos + 2) === charCodes.equalsTo) { this.finishOp(tt.assign, 3); } else { this.finishOp( code === charCodes.verticalBar ? tt.logicalOR : tt.logicalAND, 2, ); } return; } if (code === charCodes.verticalBar) { // '|>' if (next === charCodes.greaterThan) { 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) { this.finishOp(tt.assign, 2); return; } this.finishOp( code === charCodes.verticalBar ? tt.bitwiseOR : tt.bitwiseAND, 1, ); } readToken_caret(): void { // '^' const next = this.input.charCodeAt(this.state.pos + 1); if (next === charCodes.equalsTo) { this.finishOp(tt.assign, 2); } else { this.finishOp(tt.bitwiseXOR, 1); } } readToken_plus_min(code: number): void { // '+-' const next = this.input.charCodeAt(this.state.pos + 1); if (next === code) { if ( next === charCodes.dash && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === charCodes.greaterThan && (this.state.lastTokEnd === 0 || this.hasPrecedingLineBreak()) ) { // A `-->` line comment this.skipLineComment(3); this.skipSpace(); this.nextToken(); return; } this.finishOp(tt.incDec, 2); return; } if (next === charCodes.equalsTo) { this.finishOp(tt.assign, 2); } else { this.finishOp(tt.plusMin, 1); } } readToken_lt_gt(code: number): void { // '<>' const next = this.input.charCodeAt(this.state.pos + 1); let size = 1; if (next === code) { size = code === charCodes.greaterThan && this.input.charCodeAt(this.state.pos + 2) === charCodes.greaterThan ? 3 : 2; if (this.input.charCodeAt(this.state.pos + size) === charCodes.equalsTo) { this.finishOp(tt.assign, size + 1); return; } this.finishOp(tt.bitShift, size); return; } if ( next === charCodes.exclamationMark && code === charCodes.lessThan && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === charCodes.dash && this.input.charCodeAt(this.state.pos + 3) === charCodes.dash ) { // ` comment babel-7.12.12/packages/babel-parser/test/fixtures/comments/html/first-line/output.json000066400000000000000000000020041377064615700310120ustar00rootroot00000000000000{ "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": [], "directives": [], "innerComments": [ { "type": "CommentBlock", "value": "", "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}} } ] }, "comments": [ { "type": "CommentBlock", "value": "", "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directive/000077500000000000000000000000001377064615700300625ustar00rootroot00000000000000interpreter-directive-import/000077500000000000000000000000001377064615700356325ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directiveinput.js000077500000000000000000000000711377064615700373300ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-import#!/usr/bin/env babel-node import {spawn} from 'foobar'; options.json000066400000000000000000000000351377064615700402160ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-import{ "sourceType": "module" } output.json000066400000000000000000000031161377064615700400660ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-import{ "type": "File", "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}}, "sourceType": "module", "interpreter": { "type": "InterpreterDirective", "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}}, "specifiers": [ { "type": "ImportSpecifier", "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"}, "name": "spawn" }, "local": { "type": "Identifier", "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}}, "extra": { "rawValue": "foobar", "raw": "'foobar'" }, "value": "foobar" } } ], "directives": [] } }interpreter-directive-object/000077500000000000000000000000001377064615700355665ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directiveinput.js000077500000000000000000000000561377064615700372670ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-object#!/usr/bin/env babel-node var { spawn } = x; output.json000066400000000000000000000042731377064615700400270ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/interpreter-directive/interpreter-directive-object{ "type": "File", "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}}, "sourceType": "script", "interpreter": { "type": "InterpreterDirective", "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}}, "declarations": [ { "type": "VariableDeclarator", "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}}, "properties": [ { "type": "ObjectProperty", "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"}, "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"}, "name": "spawn" }, "extra": { "shorthand": true } } ] }, "init": { "type": "Identifier", "start":43,"end":44,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":17},"identifierName":"x"}, "name": "x" } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/000077500000000000000000000000001377064615700257235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10230/000077500000000000000000000000001377064615700263705ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10230/input.js000066400000000000000000000000441377064615700300630ustar00rootroot00000000000000A = { a: 42, // One } // Two B babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10230/output.json000066400000000000000000000066111377064615700306270ustar00rootroot00000000000000{ "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10432/000077500000000000000000000000001377064615700263745ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10432/input.js000066400000000000000000000002111377064615700300630ustar00rootroot00000000000000const socket = socketClient(address) /* istanbul ignore next */ socket.on('connect', function () { debug('Connected to ' + address) }) babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10432/output.json000066400000000000000000000136631377064615700306400ustar00rootroot00000000000000{ "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10448/000077500000000000000000000000001377064615700264035ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10448/input.js000066400000000000000000000000671377064615700301030ustar00rootroot00000000000000function foo([foo, /* not used */, /* not used */]) { }babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10448/output.json000066400000000000000000000044071377064615700306430ustar00rootroot00000000000000{ "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10892/000077500000000000000000000000001377064615700264065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10892/input.js000066400000000000000000000001061377064615700301000ustar00rootroot00000000000000import { foo } from "bar" /** * lost comment */ export default { } babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10892/options.json000066400000000000000000000000351377064615700307720ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/10892/output.json000066400000000000000000000046301377064615700306440ustar00rootroot00000000000000{ "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/11469/000077500000000000000000000000001377064615700264075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/11469/input.js000066400000000000000000000003021377064615700300770ustar00rootroot00000000000000class A { test() { // this.member = 'value'; } /* Trailing comment */ } class B { test() { // this.member = 'value'; } } class C { test() {} // this.member = 'value'; } babel-7.12.12/packages/babel-parser/test/fixtures/comments/regression/11469/output.json000066400000000000000000000146451377064615700306540ustar00rootroot00000000000000{ "type": "File", "start":0,"end":193,"loc":{"start":{"line":1,"column":0},"end":{"line":18,"column":1}}, "program": { "type": "Program", "start":0,"end":193,"loc":{"start":{"line":1,"column":0},"end":{"line":18,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ClassDeclaration", "start":0,"end":82,"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":82,"loc":{"start":{"line":1,"column":8},"end":{"line":7,"column":1}}, "body": [ { "type": "ClassMethod", "start":12,"end":54,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":3}}, "static": false, "key": { "type": "Identifier", "start":12,"end":16,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6},"identifierName":"test"}, "name": "test" }, "computed": false, "kind": "method", "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":19,"end":54,"loc":{"start":{"line":2,"column":9},"end":{"line":4,"column":3}}, "body": [], "directives": [], "innerComments": [ { "type": "CommentLine", "value": " this.member = 'value';", "start":25,"end":50,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":29}} } ] }, "trailingComments": [ { "type": "CommentBlock", "value": " Trailing comment ", "start":58,"end":80,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":24}} } ] } ] } }, { "type": "ClassDeclaration", "start":84,"end":140,"loc":{"start":{"line":9,"column":0},"end":{"line":13,"column":1}}, "id": { "type": "Identifier", "start":90,"end":91,"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":7},"identifierName":"B"}, "name": "B" }, "superClass": null, "body": { "type": "ClassBody", "start":92,"end":140,"loc":{"start":{"line":9,"column":8},"end":{"line":13,"column":1}}, "body": [ { "type": "ClassMethod", "start":96,"end":138,"loc":{"start":{"line":10,"column":2},"end":{"line":12,"column":3}}, "static": false, "key": { "type": "Identifier", "start":96,"end":100,"loc":{"start":{"line":10,"column":2},"end":{"line":10,"column":6},"identifierName":"test"}, "name": "test" }, "computed": false, "kind": "method", "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":103,"end":138,"loc":{"start":{"line":10,"column":9},"end":{"line":12,"column":3}}, "body": [], "directives": [], "innerComments": [ { "type": "CommentLine", "value": " this.member = 'value';", "start":109,"end":134,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":29}} } ] } } ] } }, { "type": "ClassDeclaration", "start":142,"end":193,"loc":{"start":{"line":15,"column":0},"end":{"line":18,"column":1}}, "id": { "type": "Identifier", "start":148,"end":149,"loc":{"start":{"line":15,"column":6},"end":{"line":15,"column":7},"identifierName":"C"}, "name": "C" }, "superClass": null, "body": { "type": "ClassBody", "start":150,"end":193,"loc":{"start":{"line":15,"column":8},"end":{"line":18,"column":1}}, "body": [ { "type": "ClassMethod", "start":154,"end":163,"loc":{"start":{"line":16,"column":2},"end":{"line":16,"column":11}}, "static": false, "key": { "type": "Identifier", "start":154,"end":158,"loc":{"start":{"line":16,"column":2},"end":{"line":16,"column":6},"identifierName":"test"}, "name": "test" }, "computed": false, "kind": "method", "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":161,"end":163,"loc":{"start":{"line":16,"column":9},"end":{"line":16,"column":11}}, "body": [], "directives": [] }, "trailingComments": [ { "type": "CommentLine", "value": " this.member = 'value';", "start":166,"end":191,"loc":{"start":{"line":17,"column":2},"end":{"line":17,"column":27}} } ] } ] } } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": " this.member = 'value';", "start":25,"end":50,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":29}} }, { "type": "CommentBlock", "value": " Trailing comment ", "start":58,"end":80,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":24}} }, { "type": "CommentLine", "value": " this.member = 'value';", "start":109,"end":134,"loc":{"start":{"line":11,"column":4},"end":{"line":11,"column":29}} }, { "type": "CommentLine", "value": " this.member = 'value';", "start":166,"end":191,"loc":{"start":{"line":17,"column":2},"end":{"line":17,"column":27}} } ] } babel-7.12.12/packages/babel-parser/test/fixtures/core/000077500000000000000000000000001377064615700226465ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/000077500000000000000000000000001377064615700251465ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/01-regex/000077500000000000000000000000001377064615700264765ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/01-regex/input.js000066400000000000000000000000421377064615700301670ustar00rootroot00000000000000const x = function foo() {} /42/i babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/01-regex/output.json000066400000000000000000000053261377064615700307370ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "left": { "type": "BinaryExpression", "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}}, "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":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, "body": [], "directives": [] } }, "operator": "/", "right": { "type": "NumericLiteral", "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, "operator": "/", "right": { "type": "Identifier", "start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"i"}, "name": "i" } } } ], "kind": "const" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/02-regex/000077500000000000000000000000001377064615700264775ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/02-regex/input.js000066400000000000000000000000321377064615700301670ustar00rootroot00000000000000(function foo() {} /42/i) babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/02-regex/output.json000066400000000000000000000043241377064615700307350ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "left": { "type": "BinaryExpression", "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}}, "id": { "type": "Identifier", "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, "name": "foo" }, "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": [] } }, "operator": "/", "right": { "type": "NumericLiteral", "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, "operator": "/", "right": { "type": "Identifier", "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"i"}, "name": "i" }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/03-regex/000077500000000000000000000000001377064615700265005ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/03-regex/input.js000066400000000000000000000000621377064615700301730ustar00rootroot00000000000000(function () { return function fn() {} /42/i }) babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/03-regex/output.json000066400000000000000000000063171377064615700307420ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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}}, "body": [ { "type": "ReturnStatement", "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}}, "left": { "type": "BinaryExpression", "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}}, "id": { "type": "Identifier", "start":33,"end":35,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":20},"identifierName":"fn"}, "name": "fn" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":38,"end":40,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":25}}, "body": [], "directives": [] } }, "operator": "/", "right": { "type": "NumericLiteral", "start":42,"end":44,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, "operator": "/", "right": { "type": "Identifier", "start":45,"end":46,"loc":{"start":{"line":2,"column":30},"end":{"line":2,"column":31},"identifierName":"i"}, "name": "i" } } } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/04-regex/000077500000000000000000000000001377064615700265015ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/04-regex/input.js000066400000000000000000000000671377064615700302010ustar00rootroot00000000000000function fn() { return function foo() {} /42/i } babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/04-regex/output.json000066400000000000000000000046101377064615700307350ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "ReturnStatement", "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}}, "id": { "type": "Identifier", "start":36,"end":39,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":14},"identifierName":"foo"}, "name": "foo" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "RegExpLiteral", "start":47,"end":52,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7}}, "extra": { "raw": "/42/i" }, "pattern": "42", "flags": "i" } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/05-regex/000077500000000000000000000000001377064615700265025ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/05-regex/input.js000066400000000000000000000000401377064615700301710ustar00rootroot00000000000000test(); function foo() {} /42/i babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/05-regex/output.json000066400000000000000000000036601377064615700307420ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"test"}, "name": "test" }, "arguments": [] } }, { "type": "FunctionDeclaration", "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"}, "name": "foo" }, "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": "ExpressionStatement", "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}}, "extra": { "raw": "/42/i" }, "pattern": "42", "flags": "i" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/06-regex/000077500000000000000000000000001377064615700265035ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/06-regex/input.js000066400000000000000000000000311377064615700301720ustar00rootroot00000000000000!function fn() {} /42/i; babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/06-regex/output.json000066400000000000000000000046101377064615700307370ustar00rootroot00000000000000{ "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": "BinaryExpression", "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}}, "left": { "type": "UnaryExpression", "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}}, "id": { "type": "Identifier", "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"fn"}, "name": "fn" }, "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": [] } } }, "operator": "/", "right": { "type": "NumericLiteral", "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, "operator": "/", "right": { "type": "Identifier", "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"i"}, "name": "i" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/07-regex/000077500000000000000000000000001377064615700265045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/07-regex/input.js000066400000000000000000000000301377064615700301720ustar00rootroot00000000000000function foo() {} /42/i babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/07-regex/output.json000066400000000000000000000026011377064615700307360ustar00rootroot00000000000000{ "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": "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":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": "ExpressionStatement", "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}}, "extra": { "raw": "/42/i" }, "pattern": "42", "flags": "i" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/filename-specified/000077500000000000000000000000001377064615700306575ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/filename-specified/input.js000066400000000000000000000001441377064615700323530ustar00rootroot00000000000000// This comment should have a filename prop attached to loc var node = "shouldHaveFilenameLocProp"; babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/filename-specified/options.json000066400000000000000000000000601377064615700332410ustar00rootroot00000000000000{ "sourceFilename": "path/to/input-file.js" } babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/filename-specified/output.json000066400000000000000000000064611377064615700331210ustar00rootroot00000000000000{ "type": "File", "start": 0, "end": 99, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 2, "column": 39 }, "filename": "path/to/input-file.js" }, "program": { "type": "Program", "start": 0, "end": 99, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 2, "column": 39 }, "filename": "path/to/input-file.js" }, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "start": 60, "end": 99, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 39 }, "filename": "path/to/input-file.js" }, "declarations": [ { "type": "VariableDeclarator", "start": 64, "end": 98, "loc": { "start": { "line": 2, "column": 4 }, "end": { "line": 2, "column": 38 }, "filename": "path/to/input-file.js" }, "id": { "type": "Identifier", "start": 64, "end": 68, "loc": { "start": { "line": 2, "column": 4 }, "end": { "line": 2, "column": 8 }, "filename": "path/to/input-file.js", "identifierName": "node" }, "name": "node" }, "init": { "type": "StringLiteral", "start": 71, "end": 98, "loc": { "start": { "line": 2, "column": 11 }, "end": { "line": 2, "column": 38 }, "filename": "path/to/input-file.js" }, "extra": { "rawValue": "shouldHaveFilenameLocProp", "raw": "\"shouldHaveFilenameLocProp\"" }, "value": "shouldHaveFilenameLocProp" } } ], "kind": "var", "leadingComments": [ { "type": "CommentLine", "value": " This comment should have a filename prop attached to loc", "start": 0, "end": 59, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 59 }, "filename": "path/to/input-file.js" } } ] } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": " This comment should have a filename prop attached to loc", "start": 0, "end": 59, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 59 }, "filename": "path/to/input-file.js" } } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/identifier-name-loc/000077500000000000000000000000001377064615700307615ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/identifier-name-loc/input.js000066400000000000000000000000121377064615700324470ustar00rootroot00000000000000foo(bar); babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/identifier-name-loc/output.json000066400000000000000000000021311377064615700332110ustar00rootroot00000000000000{ "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": "CallExpression", "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"}, "name": "foo" }, "arguments": [ { "type": "Identifier", "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"bar"}, "name": "bar" } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/000077500000000000000000000000001377064615700325535ustar00rootroot00000000000000input.js000066400000000000000000000000131377064615700341630ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1(a = 1) = toptions.json000066400000000000000000000000341377064615700350570ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1{ "plugins": ["estree"] } output.json000066400000000000000000000032171377064615700347320ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1{ "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/000077500000000000000000000000001377064615700325545ustar00rootroot00000000000000input.js000066400000000000000000000000151377064615700341660ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2[(a = 1)] = toptions.json000066400000000000000000000000341377064615700350600ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2{ "plugins": ["estree"] } output.json000066400000000000000000000036401377064615700347330ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2{ "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/000077500000000000000000000000001377064615700325555ustar00rootroot00000000000000input.js000066400000000000000000000000251377064615700341700ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3[({ a: [b = 2]})] = toptions.json000066400000000000000000000000341377064615700350610ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3{ "plugins": ["estree"] } output.json000066400000000000000000000062011377064615700347300ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3{ "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/000077500000000000000000000000001377064615700325565ustar00rootroot00000000000000input.js000066400000000000000000000000271377064615700341730ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4[{b: [([a = 1])]}] = t options.json000066400000000000000000000000341377064615700350620ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4{ "plugins": ["estree"] } output.json000066400000000000000000000070001377064615700347270ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4{ "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/000077500000000000000000000000001377064615700325575ustar00rootroot00000000000000input.js000066400000000000000000000000141377064615700341700ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5[([x])] = t;options.json000066400000000000000000000000341377064615700350630ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5{ "plugins": ["estree"] } output.json000066400000000000000000000033301377064615700347320ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5{ "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/000077500000000000000000000000001377064615700323225ustar00rootroot00000000000000input.js000066400000000000000000000000321377064615700337330ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loopwhile (1) function foo(){}output.json000066400000000000000000000031001377064615700344700ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop{ "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": [] } }invalid-fn-decl-labeled-inside-loop/000077500000000000000000000000001377064615700336315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorizedinput.js000066400000000000000000000000441377064615700353240ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loopwhile (1) foo: bar: function foo(){}output.json000066400000000000000000000046301377064615700360670ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/label-kind-switch/000077500000000000000000000000001377064615700304475ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/label-kind-switch/input.js000066400000000000000000000000311377064615700321360ustar00rootroot00000000000000{ a: switch (i) { } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/label-kind-switch/output.json000066400000000000000000000025201377064615700327010ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "body": { "type": "SwitchStatement", "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"}, "name": "i" }, "cases": [] }, "label": { "type": "Identifier", "start":4,"end":5,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"a"}, "name": "a" } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/labeled-block-statement-regex/000077500000000000000000000000001377064615700327405ustar00rootroot00000000000000input.js000066400000000000000000000000221377064615700343500ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/labeled-block-statement-regexa : { b : 1 }/2/; output.json000066400000000000000000000043411377064615700351160ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/labeled-block-statement-regex{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "body": { "type": "BlockStatement", "start":4,"end":13,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":13}}, "body": [ { "type": "LabeledStatement", "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11}}, "body": { "type": "ExpressionStatement", "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "expression": { "type": "NumericLiteral", "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } }, "label": { "type": "Identifier", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"b"}, "name": "b" } } ], "directives": [] }, "label": { "type": "Identifier", "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"a"}, "name": "a" } }, { "type": "ExpressionStatement", "start":13,"end":17,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":17}}, "expression": { "type": "RegExpLiteral", "start":13,"end":16,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":16}}, "extra": { "raw": "/2/" }, "pattern": "2", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/malformed-switch/000077500000000000000000000000001377064615700304135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/malformed-switch/input.js000066400000000000000000000000331377064615700321040ustar00rootroot00000000000000switch (x) { var y = 5; }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/malformed-switch/options.json000066400000000000000000000000511377064615700327750ustar00rootroot00000000000000{ "throws": "Unexpected token (2:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/not-directive/000077500000000000000000000000001377064615700277225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/not-directive/input.js000066400000000000000000000021521377064615700314170ustar00rootroot00000000000000("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"; } babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/not-directive/output.json000066400000000000000000001521031377064615700321570ustar00rootroot00000000000000{ "type": "File", "start":0,"end":1129,"loc":{"start":{"line":1,"column":0},"end":{"line":118,"column":1}}, "program": { "type": "Program", "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":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" }, "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": "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\"" }, "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": "\u0005", "raw": "\"\\5\"" }, "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/regex-after-block/000077500000000000000000000000001377064615700304475ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/regex-after-block/input.js000066400000000000000000000000241377064615700321400ustar00rootroot00000000000000if (true) { } /foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/regex-after-block/output.json000066400000000000000000000024651377064615700327110ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "IfStatement", "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}}, "value": true }, "consequent": { "type": "BlockStatement", "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":2,"column":1}}, "body": [], "directives": [] }, "alternate": null }, { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/000077500000000000000000000000001377064615700303265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/input.js000066400000000000000000000000101377064615700320120ustar00rootroot00000000000000a * /b/ babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/regex-after-star/output.json000066400000000000000000000022211377064615700325560ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/sequence-expression-end/000077500000000000000000000000001377064615700317175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/sequence-expression-end/input.js000066400000000000000000000000211377064615700334050ustar00rootroot00000000000000a = ( b, c ) output.json000066400000000000000000000031721377064615700340760ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/sequence-expression-end{ "type": "File", "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "program": { "type": "Program", "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, "expression": { "type": "AssignmentExpression", "start":0,"end":16,"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": "SequenceExpression", "start":8,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":3}}, "expressions": [ { "type": "Identifier", "start":8,"end":9,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":3},"identifierName":"b"}, "name": "b" }, { "type": "Identifier", "start":13,"end":14,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"c"}, "name": "c" } ], "extra": { "parenthesized": true, "parenStart": 4 } } } } ], "directives": [] } } babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/startline-specified/000077500000000000000000000000001377064615700311045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/startline-specified/input.js000066400000000000000000000000211377064615700325720ustar00rootroot00000000000000call(1); run(2); babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/startline-specified/options.json000066400000000000000000000000251377064615700334670ustar00rootroot00000000000000{ "startLine": 3 } babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/startline-specified/output.json000066400000000000000000000040121377064615700333340ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } ] } }, { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "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}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/ternary-object-literal-divide/000077500000000000000000000000001377064615700327725ustar00rootroot00000000000000input.js000066400000000000000000000000251377064615700344050ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/ternary-object-literal-divide0 ? a : { b : 1 }/2; output.json000066400000000000000000000053641377064615700351560ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/ternary-object-literal-divide{ "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": "ConditionalExpression", "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, "test": { "type": "NumericLiteral", "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, "consequent": { "type": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"a"}, "name": "a" }, "alternate": { "type": "BinaryExpression", "start":8,"end":19,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":19}}, "left": { "type": "ObjectExpression", "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, "properties": [ { "type": "ObjectProperty", "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}}, "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": "NumericLiteral", "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } ] }, "operator": "/", "right": { "type": "NumericLiteral", "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/000077500000000000000000000000001377064615700322245ustar00rootroot00000000000000input.js000066400000000000000000000000141377064615700336350ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1[(a.x)] = t;output.json000066400000000000000000000036031377064615700344020ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/000077500000000000000000000000001377064615700322255ustar00rootroot00000000000000input.js000066400000000000000000000000121377064615700336340ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2[(x)] = t;output.json000066400000000000000000000026421377064615700344050ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/000077500000000000000000000000001377064615700322265ustar00rootroot00000000000000input.js000066400000000000000000000000161377064615700336410ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3[(((x)))] = t;output.json000066400000000000000000000026501377064615700344050ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/000077500000000000000000000000001377064615700313345ustar00rootroot00000000000000invalid-parenthesized-assignment-pattern-2/000077500000000000000000000000001377064615700415265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000261377064615700432210ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2[{b: [([a = 1])]}] = toutput.json000066400000000000000000000073761377064615700437760ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-2{ "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": [] } }invalid-parenthesized-assignment-pattern-3/000077500000000000000000000000001377064615700415275ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000251377064615700432210ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3[({ a: [b = 2]})] = toutput.json000066400000000000000000000066271377064615700437750ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-3{ "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": [] } }invalid-parenthesized-assignment-pattern-4/000077500000000000000000000000001377064615700415305ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000151377064615700432210ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4[(a = 1)] = toutput.json000066400000000000000000000042041377064615700437630ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-4{ "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": [] } }invalid-parenthesized-assignment-pattern-5/000077500000000000000000000000001377064615700415315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000131377064615700432200ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5(a = 1) = toutput.json000066400000000000000000000035471377064615700437750ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-5{ "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": [] } }invalid-parenthesized-assignment-pattern-6/000077500000000000000000000000001377064615700415325ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000131377064615700432210ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6([a]) = [] output.json000066400000000000000000000031011377064615700437600ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern-6{ "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": [] } }invalid-parenthesized-assignment-pattern/000077500000000000000000000000001377064615700413675ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000201377064615700430540ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern({x}) = {x: 1}; output.json000066400000000000000000000060711377064615700436260ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-assignment-pattern{ "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": [] } }invalid-parenthesized-left-hand-side/000077500000000000000000000000001377064615700403305ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000121377064615700420160ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side(!a) += 1 output.json000066400000000000000000000032571377064615700425720ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-parenthesized-left-hand-side{ "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": [] } }invalid-pattern-in-rest-binding/000077500000000000000000000000001377064615700373455ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000211377064615700410330ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-pattern-in-rest-binding([...(a)]) => {} output.json000066400000000000000000000036371377064615700416110ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/invalid-pattern-in-rest-binding{ "type": "File", "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, "errors": [ "SyntaxError: Invalid parenthesized assignment 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": "ArrowFunctionExpression", "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}}, "elements": [ { "type": "RestElement", "start":2,"end":8,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":8}}, "argument": { "type": "ParenthesizedExpression", "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"}, "name": "a" } } } ] } ], "body": { "type": "BlockStatement", "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "body": [], "directives": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/options.json000066400000000000000000000000551377064615700337220ustar00rootroot00000000000000{ "createParenthesizedExpressions": true } valid-parenthesized-assignment-array-pattern-1/000077500000000000000000000000001377064615700423125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000161377064615700440040ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1[(((x)))] = t;output.json000066400000000000000000000036671377064615700445610ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1{ "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": [] } }valid-parenthesized-assignment-array-pattern-2/000077500000000000000000000000001377064615700423135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000121377064615700440010ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2[(x)] = t;output.json000066400000000000000000000027711377064615700445550ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2{ "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": [] } }valid-parenthesized-assignment-array-pattern-3/000077500000000000000000000000001377064615700423145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000141377064615700440040ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3[([x])] = t;output.json000066400000000000000000000035211377064615700445500ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-3{ "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": [] } }valid-parenthesized-assignment-array-pattern-member-expression/000077500000000000000000000000001377064615700456165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000141377064615700473060ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression[(a.x)] = t;output.json000066400000000000000000000037561377064615700500640ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-member-expression{ "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": [] } }valid-parenthesized-expression/000077500000000000000000000000001377064615700374145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000131377064615700411030ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression("hello"); output.json000066400000000000000000000017111377064615700416470ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-parenthesized-expression{ "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": [] } }valid-pattern-in-rest-lhs/000077500000000000000000000000001377064615700361725ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000161377064615700376640ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-pattern-in-rest-lhs[...(a)] = [] output.json000066400000000000000000000032741377064615700404330ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-pattern-in-rest-lhs{ "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": "AssignmentExpression", "start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}}, "operator": "=", "left": { "type": "ArrayPattern", "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "elements": [ { "type": "RestElement", "start":1,"end":7,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":7}}, "argument": { "type": "ParenthesizedExpression", "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "expression": { "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":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "elements": [] } } } ], "directives": [] } }valid-pattern-in-rest-member-lhs/000077500000000000000000000000001377064615700374375ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressionsinput.js000066400000000000000000000000201377064615700411240ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-pattern-in-rest-member-lhs[...(a.b)] = [] output.json000066400000000000000000000043011377064615700416700ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/create-parenthesized-expressions/valid-pattern-in-rest-member-lhs{ "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": "AssignmentExpression", "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "operator": "=", "left": { "type": "ArrayPattern", "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}}, "argument": { "type": "ParenthesizedExpression", "start":4,"end":9,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":9}}, "expression": { "type": "MemberExpression", "start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}}, "object": { "type": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"a"}, "name": "a" }, "computed": false, "property": { "type": "Identifier", "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } } } ] }, "right": { "type": "ArrayExpression", "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}}, "elements": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/000077500000000000000000000000001377064615700255705ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/async/000077500000000000000000000000001377064615700267055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/async/input.js000066400000000000000000000000201377064615700303720ustar00rootroot00000000000000(\u0061sync ()) babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/async/output.json000066400000000000000000000017471377064615700311510ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/000077500000000000000000000000001377064615700272165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js000066400000000000000000000000321377064615700307060ustar00rootroot00000000000000var a = { br\u{65}ak }; babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json000066400000000000000000000041121377064615700314470ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/000077500000000000000000000000001377064615700310135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js000066400000000000000000000000351377064615700325060ustar00rootroot00000000000000var a = { br\u{65}ak: 2 }; babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json000066400000000000000000000040171377064615700332500ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/000077500000000000000000000000001377064615700254125ustar00rootroot00000000000000invalid-decimal-escape-strict-directive-function/000077500000000000000000000000001377064615700367205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-stringinput.js000066400000000000000000000002701377064615700404140ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/invalid-decimal-escape-strict-directive-functionfunction a() { "\5"; "use strict"; } function b() { "\4"; "\5"; "use strict"; } function c() { "use strict"; "\5"; } function d() { "use strict"; "\4"; "\5"; } output.json000066400000000000000000000206271377064615700411620ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/invalid-decimal-escape-strict-directive-function{ "type": "File", "start":0,"end":182,"loc":{"start":{"line":1,"column":0},"end":{"line":21,"column":1}}, "errors": [ "SyntaxError: The only valid numeric escape in strict mode is '\\0' (2:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (7:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (8:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (14:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (19:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (20:4)" ], "program": { "type": "Program", "start":0,"end":182,"loc":{"start":{"line":1,"column":0},"end":{"line":21,"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}}, "extra": { "raw": "\"\\5\"", "rawValue": "\\5" }, "value": "\\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}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "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}}, "extra": { "raw": "\"\\4\"", "rawValue": "\\4" }, "value": "\\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}}, "extra": { "raw": "\"\\5\"", "rawValue": "\\5" }, "value": "\\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}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "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}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "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}}, "extra": { "raw": "\"\\5\"", "rawValue": "\\5" }, "value": "\\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}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "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}}, "extra": { "raw": "\"\\4\"", "rawValue": "\\4" }, "value": "\\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}}, "extra": { "raw": "\"\\5\"", "rawValue": "\\5" }, "value": "\\5" } } ] } } ], "directives": [] } }invalid-decimal-escape-strict-directive/000077500000000000000000000000001377064615700350755ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-stringinput.js000066400000000000000000000001301377064615700365640ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/invalid-decimal-escape-strict-directive"\01 foo \02 bar \03"; "\4"; "\5"; "use strict"; "\4"; "\5"; "\04 foo \05 bar \06"; output.json000066400000000000000000000102631377064615700373320ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/invalid-decimal-escape-strict-directive{ "type": "File", "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":22}}, "errors": [ "SyntaxError: The only valid numeric escape in strict mode is '\\0' (1:2)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (1:10)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (1:18)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (3:2)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (4:2)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (8:2)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (9:2)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (11:2)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (11:10)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (11:18)" ], "program": { "type": "Program", "start":0,"end":87,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"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}}, "value": { "type": "DirectiveLiteral", "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "extra": { "raw": "\"\\01 foo \\02 bar \\03\"", "rawValue": "\\01 foo \\02 bar \\03" }, "value": "\\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}}, "extra": { "raw": "\"\\4\"", "rawValue": "\\4" }, "value": "\\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}}, "extra": { "raw": "\"\\5\"", "rawValue": "\\5" }, "value": "\\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}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "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}}, "extra": { "raw": "\"\\4\"", "rawValue": "\\4" }, "value": "\\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}}, "extra": { "raw": "\"\\5\"", "rawValue": "\\5" }, "value": "\\5" } }, { "type": "Directive", "start":65,"end":87,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":22}}, "value": { "type": "DirectiveLiteral", "start":65,"end":86,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":21}}, "extra": { "raw": "\"\\04 foo \\05 bar \\06\"", "rawValue": "\\04 foo \\05 bar \\06" }, "value": "\\04 foo \\05 bar \\06" } } ] } }non-octal-eight-and-nine-before-use-strict/000077500000000000000000000000001377064615700353525ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-stringinput.js000066400000000000000000000000641377064615700370470ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/non-octal-eight-and-nine-before-use-strict() => { "\8";"\9"; "use strict"; "\8";"\9"; } output.json000066400000000000000000000076401377064615700376140ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/non-octal-eight-and-nine-before-use-strict{ "type": "File", "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "errors": [ "SyntaxError: The only valid numeric escape in strict mode is '\\0' (2:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (2:9)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (4:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (4:9)" ], "program": { "type": "Program", "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "expression": { "type": "ArrowFunctionExpression", "start":0,"end":51,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":6,"end":51,"loc":{"start":{"line":1,"column":6},"end":{"line":5,"column":1}}, "body": [], "directives": [ { "type": "Directive", "start":10,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7}}, "value": { "type": "DirectiveLiteral", "start":10,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":6}}, "extra": { "raw": "\"\\8\"", "rawValue": "\\8" }, "value": "\\8" } }, { "type": "Directive", "start":15,"end":20,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":12}}, "value": { "type": "DirectiveLiteral", "start":15,"end":19,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":11}}, "extra": { "raw": "\"\\9\"", "rawValue": "\\9" }, "value": "\\9" } }, { "type": "Directive", "start":23,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":15}}, "value": { "type": "DirectiveLiteral", "start":23,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "use strict" } }, { "type": "Directive", "start":39,"end":44,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7}}, "value": { "type": "DirectiveLiteral", "start":39,"end":43,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":6}}, "extra": { "raw": "\"\\8\"", "rawValue": "\\8" }, "value": "\\8" } }, { "type": "Directive", "start":44,"end":49,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":12}}, "value": { "type": "DirectiveLiteral", "start":44,"end":48,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":11}}, "extra": { "raw": "\"\\9\"", "rawValue": "\\9" }, "value": "\\9" } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/non-octal-eight-and-nine/000077500000000000000000000000001377064615700320715ustar00rootroot00000000000000input.js000066400000000000000000000000621377064615700335050ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/non-octal-eight-and-nine"\8";"\9"; () => { "use strict"; "\8";"\9"; } output.json000066400000000000000000000070571377064615700342560ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/non-octal-eight-and-nine{ "type": "File", "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "errors": [ "SyntaxError: The only valid numeric escape in strict mode is '\\0' (4:4)", "SyntaxError: The only valid numeric escape in strict mode is '\\0' (4:9)" ], "program": { "type": "Program", "start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "start":11,"end":49,"loc":{"start":{"line":2,"column":0},"end":{"line":5,"column":1}}, "expression": { "type": "ArrowFunctionExpression", "start":11,"end":49,"loc":{"start":{"line":2,"column":0},"end":{"line":5,"column":1}}, "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":17,"end":49,"loc":{"start":{"line":2,"column":6},"end":{"line":5,"column":1}}, "body": [], "directives": [ { "type": "Directive", "start":21,"end":34,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":15}}, "value": { "type": "DirectiveLiteral", "start":21,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "use strict" } }, { "type": "Directive", "start":37,"end":42,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":7}}, "value": { "type": "DirectiveLiteral", "start":37,"end":41,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":6}}, "extra": { "raw": "\"\\8\"", "rawValue": "\\8" }, "value": "\\8" } }, { "type": "Directive", "start":42,"end":47,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":12}}, "value": { "type": "DirectiveLiteral", "start":42,"end":46,"loc":{"start":{"line":4,"column":7},"end":{"line":4,"column":11}}, "extra": { "raw": "\"\\9\"", "rawValue": "\\9" }, "value": "\\9" } } ] } } } ], "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}}, "extra": { "raw": "\"\\8\"", "rawValue": "\\8" }, "value": "\\8" } }, { "type": "Directive", "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "value": { "type": "DirectiveLiteral", "start":5,"end":9,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":9}}, "extra": { "raw": "\"\\9\"", "rawValue": "\\9" }, "value": "\\9" } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/numeric-escape-in-directive/000077500000000000000000000000001377064615700326725ustar00rootroot00000000000000input.js000066400000000000000000000001141377064615700343040ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/numeric-escape-in-directivefunction hello() { "use strict"; function inner() { "octal directive\1"; } }output.json000066400000000000000000000057241377064615700350560ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/numeric-escape-in-directive{ "type": "File", "start":0,"end":76,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":76}}, "errors": [ "SyntaxError: The only valid numeric escape in strict mode is '\\0' (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": [] } }numeric-escape-in-property-name/000077500000000000000000000000001377064615700334375ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-stringinput.js000066400000000000000000000000621377064615700351320ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/numeric-escape-in-property-namefunction hello() { 'use strict'; ({ "\1": 42 }); }output.json000066400000000000000000000062671377064615700357050ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-string/numeric-escape-in-property-name{ "type": "File", "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, "errors": [ "SyntaxError: The only valid numeric escape in strict mode is '\\0' (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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-template/000077500000000000000000000000001377064615700257175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/000077500000000000000000000000001377064615700307075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/input.js000066400000000000000000000000061377064615700324000ustar00rootroot00000000000000`\8`; babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json000066400000000000000000000021011377064615700331340ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/000077500000000000000000000000001377064615700305405ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/input.js000066400000000000000000000000061377064615700322310ustar00rootroot00000000000000`\9`; babel-7.12.12/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json000066400000000000000000000021011377064615700327650ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/000077500000000000000000000000001377064615700252125ustar00rootroot00000000000000legacy-octal-after-use-strict-function/000077500000000000000000000000001377064615700345215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octalinput.js000066400000000000000000000001251377064615700362140ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/legacy-octal-after-use-strict-functionfunction c() { "use strict"; 05; } function d() { "use strict"; 04; 05; } options.json000066400000000000000000000000351377064615700371050ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/legacy-octal-after-use-strict-function{ "sourceType": "script" } output.json000066400000000000000000000105541377064615700367610ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/legacy-octal-after-use-strict-function{ "type": "File", "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "errors": [ "SyntaxError: Legacy octal literals are not allowed in strict mode (3:2)", "SyntaxError: Legacy octal literals are not allowed in strict mode (8:2)", "SyntaxError: Legacy octal literals are not allowed in strict mode (9:2)" ], "program": { "type": "Program", "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":10,"column":1}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", "start":0,"end":38,"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":"c"}, "name": "c" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":13,"end":38,"loc":{"start":{"line":1,"column":13},"end":{"line":4,"column":1}}, "body": [ { "type": "ExpressionStatement", "start":33,"end":36,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":5}}, "expression": { "type": "NumericLiteral", "start":33,"end":35,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":4}}, "extra": { "rawValue": 5, "raw": "05" }, "value": 5 } } ], "directives": [ { "type": "Directive", "start":17,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, "value": { "type": "DirectiveLiteral", "start":17,"end":29,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "use strict" } } ] } }, { "type": "FunctionDeclaration", "start":40,"end":84,"loc":{"start":{"line":6,"column":0},"end":{"line":10,"column":1}}, "id": { "type": "Identifier", "start":49,"end":50,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":10},"identifierName":"d"}, "name": "d" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":53,"end":84,"loc":{"start":{"line":6,"column":13},"end":{"line":10,"column":1}}, "body": [ { "type": "ExpressionStatement", "start":73,"end":76,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":5}}, "expression": { "type": "NumericLiteral", "start":73,"end":75,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":4}}, "extra": { "rawValue": 4, "raw": "04" }, "value": 4 } }, { "type": "ExpressionStatement", "start":79,"end":82,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":5}}, "expression": { "type": "NumericLiteral", "start":79,"end":81,"loc":{"start":{"line":9,"column":2},"end":{"line":9,"column":4}}, "extra": { "rawValue": 5, "raw": "05" }, "value": 5 } } ], "directives": [ { "type": "Directive", "start":57,"end":70,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":15}}, "value": { "type": "DirectiveLiteral", "start":57,"end":69,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":14}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "use strict" } } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/legacy-octal-after-use-strict/000077500000000000000000000000001377064615700327555ustar00rootroot00000000000000input.js000066400000000000000000000000261377064615700343710ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/legacy-octal-after-use-strict"use strict"; 04; 05; options.json000066400000000000000000000000351377064615700352620ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/legacy-octal-after-use-strict{ "sourceType": "script" } output.json000066400000000000000000000034341377064615700351350ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/legacy-octal/legacy-octal-after-use-strict{ "type": "File", "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, "errors": [ "SyntaxError: Legacy octal literals are not allowed in strict mode (1:14)", "SyntaxError: Legacy octal literals are not allowed in strict mode (1:18)" ], "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":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}}, "extra": { "rawValue": 4, "raw": "04" }, "value": 4 } }, { "type": "ExpressionStatement", "start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}}, "expression": { "type": "NumericLiteral", "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}}, "extra": { "rawValue": 5, "raw": "05" }, "value": 5 } } ], "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}}, "extra": { "raw": "\"use strict\"", "rawValue": "use strict" }, "value": "use strict" } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/object/000077500000000000000000000000001377064615700241145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/000077500000000000000000000000001377064615700275555ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/input.js000066400000000000000000000000261377064615700312500ustar00rootroot00000000000000({ ge\u0074 x() {} }) babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json000066400000000000000000000000721377064615700321420ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \",\" (1:12)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/000077500000000000000000000000001377064615700321035ustar00rootroot00000000000000input.js000066400000000000000000000000551377064615700335210ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1const obj = { bar: x = 123, foo = 123 }; options.json000066400000000000000000000000511377064615700344060ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1{ "throws": "Unexpected token (3:6)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/000077500000000000000000000000001377064615700317455ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js000066400000000000000000000000551377064615700334420ustar00rootroot00000000000000const obj = { foo = 123, bar: x = 123 }; options.json000066400000000000000000000000511377064615700342500ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer{ "throws": "Unexpected token (2:6)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-setter/000077500000000000000000000000001377064615700270465ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-setter/input.js000066400000000000000000000000201377064615700305330ustar00rootroot00000000000000({ set x(){} }) babel-7.12.12/packages/babel-parser/test/fixtures/core/object/invalid-setter/output.json000066400000000000000000000033101377064615700312760ustar00rootroot00000000000000{ "type": "File", "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, "errors": [ "SyntaxError: setter must have exactly one formal parameter (1:3)" ], "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": "ObjectExpression", "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}}, "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": "set", "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}}, "body": [], "directives": [] } } ], "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }member-expression-after-property-initializer-1/000077500000000000000000000000001377064615700351415ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/objectinput.js000066400000000000000000000000321377064615700366310ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1({a = 42, b: test.d} = {})output.json000066400000000000000000000074451377064615700374060ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-1{ "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": [] } }member-expression-after-property-initializer-2/000077500000000000000000000000001377064615700351425ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/objectinput.js000066400000000000000000000000301377064615700366300ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2({a = 42, b: {}.d} = {})output.json000066400000000000000000000074251377064615700374050ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/member-expression-after-property-initializer-2{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/000077500000000000000000000000001377064615700314165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js000066400000000000000000000001051377064615700331070ustar00rootroot00000000000000const obj = { foo = 123, bar: x = 123, } = { foo: 24, bar: 45 }; babel-7.12.12/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json000066400000000000000000000147571377064615700336670ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/000077500000000000000000000000001377064615700236335ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-false/000077500000000000000000000000001377064615700320725ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-false/input.js000066400000000000000000000000421377064615700335630ustar00rootroot00000000000000for await (const i of imports) {} options.json000066400000000000000000000000711377064615700343770ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-false{ "throws": "Unexpected token, expected \"(\" (1:4)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true/000077500000000000000000000000001377064615700317575ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true/input.js000066400000000000000000000000421377064615700334500ustar00rootroot00000000000000for await (const i of imports) {} options.json000066400000000000000000000000501377064615700342610ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true{ "allowAwaitOutsideFunction": true } output.json000066400000000000000000000031031377064615700341300ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowAwaitOutsideFunction-true{ "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": "script", "interpreter": null, "body": [ { "type": "ForOfStatement", "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}}, "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":"i"}, "name": "i" }, "init": null } ], "kind": "const" }, "right": { "type": "Identifier", "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}}, "body": [], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/000077500000000000000000000000001377064615700303255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/input.js000066400000000000000000000000171377064615700320200ustar00rootroot00000000000000export { foo };babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/options.json000066400000000000000000000000771377064615700327170ustar00rootroot00000000000000{ "sourceType": "module", "allowUndeclaredExports": true } babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/allowUndeclaredExports/output.json000066400000000000000000000022521377064615700325610ustar00rootroot00000000000000{ "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": "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 } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/ranges-false/000077500000000000000000000000001377064615700262025ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/ranges-false/input.js000066400000000000000000000000331377064615700276730ustar00rootroot00000000000000var a = 1; var b = a + 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/ranges-false/output.json000066400000000000000000000050341377064615700304370ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/ranges-true/000077500000000000000000000000001377064615700260675ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/ranges-true/input.js000066400000000000000000000000331377064615700275600ustar00rootroot00000000000000var a = 1; var b = a + 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/ranges-true/options.json000066400000000000000000000000251377064615700304520ustar00rootroot00000000000000{ "ranges": true } babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/ranges-true/output.json000066400000000000000000000065271377064615700303340ustar00rootroot00000000000000{ "type": "File", "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}}, "range": [ 0, 26 ], "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, "range": [ 0, 10 ], "declarations": [ { "type": "VariableDeclarator", "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"}, "range": [ 4, 5 ], "name": "a" }, "init": { "type": "NumericLiteral", "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}, "range": [ 8, 9 ], "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } ], "kind": "var" }, { "type": "VariableDeclaration", "start":12,"end":26,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":14}}, "range": [ 12, 26 ], "declarations": [ { "type": "VariableDeclarator", "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"}, "range": [ 16, 17 ], "name": "b" }, "init": { "type": "BinaryExpression", "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"}, "range": [ 20, 21 ], "name": "a" }, "operator": "+", "right": { "type": "NumericLiteral", "start":24,"end":25,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}}, "range": [ 24, 25 ], "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-false/000077500000000000000000000000001377064615700262265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-false/input.js000066400000000000000000000000331377064615700277170ustar00rootroot00000000000000var a = 1; var b = a + 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-false/options.json000066400000000000000000000000261377064615700306120ustar00rootroot00000000000000{ "tokens": false } babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-false/output.json000066400000000000000000000050341377064615700304630ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-true/000077500000000000000000000000001377064615700261135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-true/input.js000066400000000000000000000000331377064615700276040ustar00rootroot00000000000000var a = 1; var b = a + 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-true/options.json000066400000000000000000000000251377064615700304760ustar00rootroot00000000000000{ "tokens": true } babel-7.12.12/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json000066400000000000000000000174561377064615700303630ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } } ], "kind": "var" } ], "directives": [] }, "tokens": [ { "type": { "label": "var", "keyword": "var", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "var", "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}} }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "a", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}} }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} }, { "type": { "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": 1, "start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}} }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} }, { "type": { "label": "var", "keyword": "var", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "var", "start":12,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":3}} }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "b", "start":16,"end":17,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":5}} }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start":18,"end":19,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}} }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "a", "start":20,"end":21,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":9}} }, { "type": { "label": "+/-", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": true, "postfix": false, "binop": 9, "updateContext": null }, "value": "+", "start":22,"end":23,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}} }, { "type": { "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": 1, "start":24,"end":25,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}} }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start":25,"end":26,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14}} }, { "type": { "label": "eof", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start":26,"end":26,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":14}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/000077500000000000000000000000001377064615700250265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/2591/000077500000000000000000000000001377064615700254265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/2591/input.js000066400000000000000000000000421377064615700271170ustar00rootroot00000000000000function x() { let x /wow/; } babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/2591/output.json000066400000000000000000000042361377064615700276660ustar00rootroot00000000000000{ "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": "FunctionDeclaration", "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"}, "name": "x" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": null } ], "kind": "let" }, { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/wow/" }, "pattern": "wow", "flags": "" } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/9374/000077500000000000000000000000001377064615700254345ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/9374/input.js000066400000000000000000000000501377064615700271240ustar00rootroot00000000000000function* test() { yield new Foo(); } babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/9374/output.json000066400000000000000000000035301377064615700276700ustar00rootroot00000000000000{ "type": "File", "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}}, "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":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"test"}, "name": "test" }, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "YieldExpression", "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}}, "callee": { "type": "Identifier", "start":31,"end":34,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":15},"identifierName":"Foo"}, "name": "Foo" }, "arguments": [] } } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/T2921/000077500000000000000000000000001377064615700255475ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/T2921/input.js000066400000000000000000000000111377064615700272340ustar00rootroot00000000000000a <== b; babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/T2921/options.json000066400000000000000000000000511377064615700301310ustar00rootroot00000000000000{ "throws": "Unexpected token (1:4)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/000077500000000000000000000000001377064615700322535ustar00rootroot00000000000000input.js000066400000000000000000000000051377064615700336640ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode09.5 options.json000066400000000000000000000000351377064615700345600ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode{ "sourceType": "module" } output.json000066400000000000000000000015301377064615700344260ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/non-octal-float/000077500000000000000000000000001377064615700300235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/non-octal-float/input.js000066400000000000000000000000051377064615700315130ustar00rootroot0000000000000009.5 babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/non-octal-float/output.json000066400000000000000000000013671377064615700322650ustar00rootroot00000000000000{ "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": "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/000077500000000000000000000000001377064615700301445ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/input.js000066400000000000000000000000051377064615700316340ustar00rootroot0000000000000007.5 babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/octal-float-fail/options.json000066400000000000000000000000711377064615700325300ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/use-strict-with-pre-semi/000077500000000000000000000000001377064615700316205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/use-strict-with-pre-semi/input.js000066400000000000000000000000701377064615700333120ustar00rootroot00000000000000function a ([a] = []) { ; 'use strict'; with ({}) {} } output.json000066400000000000000000000061401377064615700337750ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/regression/use-strict-with-pre-semi{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", "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"}, "name": "a" }, "generator": false, "async": false, "params": [ { "type": "AssignmentPattern", "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}}, "elements": [ { "type": "Identifier", "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}}, "elements": [] } } ], "body": { "type": "BlockStatement", "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}} }, { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": "use strict", "raw": "'use strict'" }, "value": "use strict" } }, { "type": "WithStatement", "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}}, "properties": [] }, "body": { "type": "BlockStatement", "start":51,"end":53,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":29}}, "body": [], "directives": [] } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/000077500000000000000000000000001377064615700237575ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/000077500000000000000000000000001377064615700311575ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/input.js000066400000000000000000000000551377064615700326540ustar00rootroot00000000000000{ let bar; var foo = 1; let foo = 1; } output.json000066400000000000000000000063651377064615700333450ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/000077500000000000000000000000001377064615700276775ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/input.js000066400000000000000000000000431377064615700313710ustar00rootroot00000000000000let bar; var foo = 1; let foo = 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json000066400000000000000000000054401377064615700321350ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/000077500000000000000000000000001377064615700311575ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/input.js000066400000000000000000000000551377064615700326540ustar00rootroot00000000000000{ let bar; let foo = 1; var foo = 1; } output.json000066400000000000000000000063651377064615700333450ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/000077500000000000000000000000001377064615700276775ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/input.js000066400000000000000000000000431377064615700313710ustar00rootroot00000000000000let bar; let foo = 1; var foo = 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json000066400000000000000000000054401377064615700321350ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/000077500000000000000000000000001377064615700306165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/input.js000066400000000000000000000000371377064615700323130ustar00rootroot00000000000000try { } catch ([foo, foo]) { } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json000066400000000000000000000034751377064615700330620ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/000077500000000000000000000000001377064615700302365ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/input.js000066400000000000000000000000501377064615700317260ustar00rootroot00000000000000let foo; try {} catch (foo) {} let foo; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json000066400000000000000000000051451377064615700324760ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/000077500000000000000000000000001377064615700276465ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/input.js000066400000000000000000000000541377064615700313420ustar00rootroot00000000000000try { } catch (foo) { function foo() {} } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json000066400000000000000000000042321377064615700321020ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-hang-func/000077500000000000000000000000001377064615700305615ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-hang-func/input.js000066400000000000000000000000631377064615700322550ustar00rootroot00000000000000try { } catch (foo) { if (1) function foo() {} } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-hang-func/output.json000066400000000000000000000052311377064615700330150ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "foo" }, "body": { "type": "BlockStatement", "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}}, "test": { "type": "NumericLiteral", "start":28,"end":29,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":7}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "consequent": { "type": "FunctionDeclaration", "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"}, "name": "foo" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":46,"end":48,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":26}}, "body": [], "directives": [] } }, "alternate": null } ], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let-outside/000077500000000000000000000000001377064615700311515ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let-outside/input.js000066400000000000000000000000411377064615700326410ustar00rootroot00000000000000try { } catch (foo) { } let foo; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let-outside/output.json000066400000000000000000000036221377064615700334070ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "foo" }, "body": { "type": "BlockStatement", "start":20,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":3,"column":1}}, "body": [], "directives": [] } }, "finalizer": null }, { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "start":28,"end":31,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null } ], "kind": "let" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/000077500000000000000000000000001377064615700274775ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/input.js000066400000000000000000000000431377064615700311710ustar00rootroot00000000000000try { } catch (foo) { let foo; } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json000066400000000000000000000041761377064615700317420ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/000077500000000000000000000000001377064615700306045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/input.js000066400000000000000000000000601377064615700322750ustar00rootroot00000000000000try { } catch ({ a: foo, b: { c: [foo] } }) { } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json000066400000000000000000000100211377064615700330310ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/000077500000000000000000000000001377064615700314045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/input.js000066400000000000000000000000451377064615700331000ustar00rootroot00000000000000try { } catch ([foo]) { var foo; } output.json000066400000000000000000000045331377064615700335650ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-nested/000077500000000000000000000000001377064615700307635ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-nested/input.js000066400000000000000000000001011377064615700324500ustar00rootroot00000000000000try { } catch (foo) { try { } catch (_) { var foo; } } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-nested/output.json000066400000000000000000000065521377064615700332260ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "foo" }, "body": { "type": "BlockStatement", "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}}, "block": { "type": "BlockStatement", "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}}, "param": { "type": "Identifier", "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}}, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "start":54,"end":57,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":11},"identifierName":"foo"}, "name": "foo" }, "init": null } ], "kind": "var" } ], "directives": [] } }, "finalizer": null } ], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/000077500000000000000000000000001377064615700313725ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/input.js000066400000000000000000000000471377064615700330700ustar00rootroot00000000000000try { } catch ({ foo }) { var foo; } output.json000066400000000000000000000057231377064615700335550ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-outside/000077500000000000000000000000001377064615700311555ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-outside/input.js000066400000000000000000000000411377064615700326450ustar00rootroot00000000000000try { } catch (foo) { } var foo; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-outside/output.json000066400000000000000000000036221377064615700334130ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "foo" }, "body": { "type": "BlockStatement", "start":20,"end":23,"loc":{"start":{"line":2,"column":14},"end":{"line":3,"column":1}}, "body": [], "directives": [] } }, "finalizer": null }, { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "start":28,"end":31,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":7},"identifierName":"foo"}, "name": "foo" }, "init": null } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var/000077500000000000000000000000001377064615700275035ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var/input.js000066400000000000000000000000431377064615700311750ustar00rootroot00000000000000try { } catch (foo) { var foo; } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var/output.json000066400000000000000000000040471377064615700317430ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "var" } ], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/000077500000000000000000000000001377064615700300435ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/input.js000066400000000000000000000000341377064615700315350ustar00rootroot00000000000000class foo {}; class foo {}; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json000066400000000000000000000034511377064615700323010ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/000077500000000000000000000000001377064615700300645ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/input.js000066400000000000000000000000351377064615700315570ustar00rootroot00000000000000class foo {}; const foo = 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json000066400000000000000000000037611377064615700323260ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/000077500000000000000000000000001377064615700276715ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/input.js000066400000000000000000000000421377064615700313620ustar00rootroot00000000000000class foo {}; function foo () {}; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json000066400000000000000000000035741377064615700321350ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/000077500000000000000000000000001377064615700275225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/input.js000066400000000000000000000000331377064615700312130ustar00rootroot00000000000000class foo {}; let foo = 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json000066400000000000000000000037571377064615700317710ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/000077500000000000000000000000001377064615700275265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/input.js000066400000000000000000000000271377064615700312220ustar00rootroot00000000000000class foo {}; var foo; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json000066400000000000000000000033241377064615700317630ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/000077500000000000000000000000001377064615700301055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/input.js000066400000000000000000000000241377064615700315760ustar00rootroot00000000000000const foo=1, foo=2; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json000066400000000000000000000037501377064615700323450ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/000077500000000000000000000000001377064615700273355ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/input.js000066400000000000000000000000451377064615700310310ustar00rootroot00000000000000{ function f() {} function* f() {} } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json000066400000000000000000000037731377064615700316020ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/000077500000000000000000000000001377064615700313755ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/input.js000066400000000000000000000000501377064615700330650ustar00rootroot00000000000000{ function foo() {} function foo() {} } options.json000066400000000000000000000000351377064615700337020ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy{ "sourceType": "module" } output.json000066400000000000000000000040061377064615700335510ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/000077500000000000000000000000001377064615700300515ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/input.js000066400000000000000000000000441377064615700315440ustar00rootroot00000000000000function foo() {} function foo() {} babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json000066400000000000000000000000351377064615700324350ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json000066400000000000000000000032521377064615700323060ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy/000077500000000000000000000000001377064615700314145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy/input.js000066400000000000000000000000501377064615700331040ustar00rootroot00000000000000{ function foo() {} function foo() {} } options.json000066400000000000000000000000351377064615700337210ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy{ "sourceType": "script" } output.json000066400000000000000000000036561377064615700336020ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script-sloppy{ "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": "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/000077500000000000000000000000001377064615700300705ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/input.js000066400000000000000000000000441377064615700315630ustar00rootroot00000000000000function foo() {} function foo() {} babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/options.json000066400000000000000000000000351377064615700324540ustar00rootroot00000000000000{ "sourceType": "script" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-script/output.json000066400000000000000000000031231377064615700323220ustar00rootroot00000000000000{ "type": "File", "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}}, "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":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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/000077500000000000000000000000001377064615700307005ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/input.js000066400000000000000000000000471377064615700323760ustar00rootroot00000000000000{ function foo() {} var foo = 1; } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json000066400000000000000000000044421377064615700331370ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var/000077500000000000000000000000001377064615700273545ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var/input.js000066400000000000000000000000371377064615700310510ustar00rootroot00000000000000function foo() {} var foo = 1; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var/output.json000066400000000000000000000035311377064615700316110ustar00rootroot00000000000000{ "type": "File", "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}}, "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":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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/000077500000000000000000000000001377064615700273355ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/input.js000066400000000000000000000000451377064615700310310ustar00rootroot00000000000000{ function* f() {} function f() {} } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json000066400000000000000000000037731377064615700316020ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/000077500000000000000000000000001377064615700304555ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/input.js000066400000000000000000000000501377064615700321450ustar00rootroot00000000000000function *foo() {}; function *foo() {}; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/options.json000066400000000000000000000000351377064615700330410ustar00rootroot00000000000000{ "sourceType": "script" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-gen-script/output.json000066400000000000000000000035721377064615700327170ustar00rootroot00000000000000{ "type": "File", "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}}, "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":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":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}} }, { "type": "FunctionDeclaration", "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"}, "name": "foo" }, "generator": true, "async": false, "params": [], "body": { "type": "BlockStatement", "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}} } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/000077500000000000000000000000001377064615700272015ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/input.js000066400000000000000000000000161377064615700306730ustar00rootroot00000000000000let foo, foo; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json000066400000000000000000000026611377064615700314410ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/000077500000000000000000000000001377064615700304655ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/input.js000066400000000000000000000000321377064615700321550ustar00rootroot00000000000000{ let a; { var a; } } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json000066400000000000000000000043541377064615700327260ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-var-let/000077500000000000000000000000001377064615700304655ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-var-let/input.js000066400000000000000000000000321377064615700321550ustar00rootroot00000000000000{ var a; { let a; } } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-var-let/output.json000066400000000000000000000042271377064615700327250ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "var" }, { "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": "let" } ], "directives": [] } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-var-var/000077500000000000000000000000001377064615700272115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-var-var/input.js000066400000000000000000000000161377064615700307030ustar00rootroot00000000000000var foo, foo; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/dupl-bind-var-var/output.json000066400000000000000000000025321377064615700314460ustar00rootroot00000000000000{ "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":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": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/for-let/000077500000000000000000000000001377064615700253275ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/for-let/input.js000066400000000000000000000000411377064615700270170ustar00rootroot00000000000000for (let i = 0;;) { let i; } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/for-let/output.json000066400000000000000000000045671377064615700275760ustar00rootroot00000000000000{ "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": "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": "let" } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/for-var/000077500000000000000000000000001377064615700253335ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/for-var/input.js000066400000000000000000000000411377064615700270230ustar00rootroot00000000000000for (let i = 0;;) { var i; } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/for-var/output.json000066400000000000000000000047141377064615700275740ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/let-assign/000077500000000000000000000000001377064615700260255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/let-assign/input.js000066400000000000000000000000221377064615700275140ustar00rootroot00000000000000let x = 1; x = 2; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/let-assign/output.json000066400000000000000000000040421377064615700302600ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "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":"x"}, "name": "x" }, "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": "ExpressionStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/000077500000000000000000000000001377064615700305735ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/input.js000066400000000000000000000000371377064615700322700ustar00rootroot00000000000000export { encrypt as default }; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json000066400000000000000000000000351377064615700331570ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json000066400000000000000000000024101377064615700330230ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/000077500000000000000000000000001377064615700271515ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/input.js000066400000000000000000000000651377064615700306470ustar00rootroot00000000000000export { encrypt as decrypt }; function decrypt() {} babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json000066400000000000000000000000351377064615700315350ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json000066400000000000000000000036221377064615700314070ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/000077500000000000000000000000001377064615700276405ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/input.js000066400000000000000000000000571377064615700313370ustar00rootroot00000000000000{ function encrypt() {} } export { encrypt } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json000066400000000000000000000000351377064615700322240ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json000066400000000000000000000042421377064615700320750ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/000077500000000000000000000000001377064615700306155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/input.js000066400000000000000000000000321377064615700323050ustar00rootroot00000000000000export { Object as Obj }; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json000066400000000000000000000000351377064615700332010ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json000066400000000000000000000023751377064615700330570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/000077500000000000000000000000001377064615700302145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/input.js000066400000000000000000000000231377064615700317040ustar00rootroot00000000000000export { Object }; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json000066400000000000000000000000351377064615700326000ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json000066400000000000000000000024011377064615700324440ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1/000077500000000000000000000000001377064615700325725ustar00rootroot00000000000000input.js000066400000000000000000000000361377064615700342070ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1function a() {} export { a };options.json000066400000000000000000000000641377064615700351010ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1{ "sourceType": "module", "strictMode": false } output.json000066400000000000000000000034421377064615700347510ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-1{ "type": "File", "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}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "FunctionDeclaration", "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"}, "name": "a" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "specifiers": [ { "type": "ExportSpecifier", "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"}, "name": "a" }, "exported": { "type": "Identifier", "start":26,"end":27,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"a"}, "name": "a" } } ], "source": null, "declaration": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2/000077500000000000000000000000001377064615700325735ustar00rootroot00000000000000input.js000066400000000000000000000000361377064615700342100ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2export { a }; function a() {} options.json000066400000000000000000000000641377064615700351020ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2{ "sourceType": "module", "strictMode": false } output.json000066400000000000000000000034401377064615700347500ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-function-loose-mode-2{ "type": "File", "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}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "ExportNamedDeclaration", "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}}, "local": { "type": "Identifier", "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"}, "name": "a" } } ], "source": null, "declaration": null }, { "type": "FunctionDeclaration", "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"}, "name": "a" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":27,"end":29,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":15}}, "body": [], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/000077500000000000000000000000001377064615700271445ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/input.js000066400000000000000000000000641377064615700306410ustar00rootroot00000000000000export { encrypt }; if (true) function encrypt() {} babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json000066400000000000000000000000351377064615700315300ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json000066400000000000000000000046261377064615700314070ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/000077500000000000000000000000001377064615700273365ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/input.js000066400000000000000000000000451377064615700310320ustar00rootroot00000000000000{ var encrypt } export { encrypt } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/options.json000066400000000000000000000000351377064615700317220ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export-var/output.json000066400000000000000000000040771377064615700316010ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "module", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "encrypt" }, "init": null } ], "kind": "var" } ], "directives": [] }, { "type": "ExportNamedDeclaration", "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}}, "local": { "type": "Identifier", "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"}, "name": "encrypt" } } ], "source": null, "declaration": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export/000077500000000000000000000000001377064615700265505ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export/input.js000066400000000000000000000000241377064615700302410ustar00rootroot00000000000000export { encrypt }; babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json000066400000000000000000000000351377064615700311340ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json000066400000000000000000000024061377064615700310050ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/000077500000000000000000000000001377064615700274045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/000077500000000000000000000000001377064615700312315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/input.js000066400000000000000000000000321377064615700327210ustar00rootroot00000000000000var foo = require("foo"); babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/options.json000066400000000000000000000000421377064615700336130ustar00rootroot00000000000000{ "sourceType": "unambiguous" } babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/commonjs/output.json000066400000000000000000000033251377064615700334670ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "callee": { "type": "Identifier", "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}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" } ] } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/000077500000000000000000000000001377064615700303535ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/input.js000066400000000000000000000001171377064615700320470ustar00rootroot00000000000000import type { Foo } from "bar"; export type { Foo }; export type * from "bar"; babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/options.json000066400000000000000000000000711377064615700327370ustar00rootroot00000000000000{ "sourceType": "unambiguous", "plugins": ["flow"] } babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/flow/output.json000066400000000000000000000054401377064615700326110ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ImportDeclaration", "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}}, "imported": { "type": "Identifier", "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"}, "name": "Foo" } } ], "importKind": "type", "source": { "type": "StringLiteral", "start":25,"end":30,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":30}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" }, "value": "bar" } }, { "type": "ExportNamedDeclaration", "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}}, "local": { "type": "Identifier", "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"}, "name": "Foo" } } ], "source": null, "exportKind": "type", "declaration": null }, { "type": "ExportAllDeclaration", "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}}, "extra": { "rawValue": "bar", "raw": "\"bar\"" }, "value": "bar" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta/000077500000000000000000000000001377064615700316425ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta/input.js000066400000000000000000000000321377064615700333320ustar00rootroot00000000000000console.log(import.meta); options.json000066400000000000000000000000771377064615700341550ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta{ "sourceType": "unambiguous", "plugins": ["importMeta"] } output.json000066400000000000000000000037351377064615700340260ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/import-meta{ "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": "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": "MemberExpression", "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"}, "name": "console" }, "property": { "type": "Identifier", "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"log"}, "name": "log" }, "computed": false }, "arguments": [ { "type": "MetaProperty", "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"}, "name": "import" }, "property": { "type": "Identifier", "start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23},"identifierName":"meta"}, "name": "meta" } } ] } } ], "directives": [] } } babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-all/000077500000000000000000000000001377064615700327565ustar00rootroot00000000000000input.js000066400000000000000000000000251377064615700343710ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-allexport * from "foo"; options.json000066400000000000000000000000421377064615700352610ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-all{ "sourceType": "unambiguous" } output.json000066400000000000000000000014041377064615700351310ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-all{ "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": "StringLiteral", "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-default/000077500000000000000000000000001377064615700336325ustar00rootroot00000000000000input.js000066400000000000000000000000231377064615700352430ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-defaultexport default {}; options.json000066400000000000000000000000421377064615700361350ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-default{ "sourceType": "unambiguous" } output.json000066400000000000000000000012641377064615700360110ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-default{ "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": "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": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-named/000077500000000000000000000000001377064615700332725ustar00rootroot00000000000000input.js000066400000000000000000000000271377064615700347070ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-namedexport function fn(){} options.json000066400000000000000000000000421377064615700355750ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-named{ "sourceType": "unambiguous" } output.json000066400000000000000000000023171377064615700354510ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-export-named{ "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": "ExportNamedDeclaration", "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}}, "id": { "type": "Identifier", "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18},"identifierName":"fn"}, "name": "fn" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import/000077500000000000000000000000001377064615700322015ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import/input.js000066400000000000000000000000161377064615700336730ustar00rootroot00000000000000import "foo"; options.json000066400000000000000000000000421377064615700345040ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import{ "sourceType": "unambiguous" } output.json000066400000000000000000000014311377064615700343540ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/sourcetype-unambiguous/module-import{ "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": "module", "interpreter": null, "body": [ { "type": "ImportDeclaration", "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}}, "extra": { "rawValue": "foo", "raw": "\"foo\"" }, "value": "foo" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/000077500000000000000000000000001377064615700255025ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.542/000077500000000000000000000000001377064615700260725ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.542/input.js000066400000000000000000000000241377064615700275630ustar00rootroot00000000000000({ get prop(x) {} })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.542/options.json000066400000000000000000000000661377064615700304620ustar00rootroot00000000000000{ "throws": "getter should have no params (1:11)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.543/000077500000000000000000000000001377064615700260735ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.543/input.js000066400000000000000000000000231377064615700275630ustar00rootroot00000000000000({ set prop() {} })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.543/options.json000066400000000000000000000000761377064615700304640ustar00rootroot00000000000000{ "throws": "setter should have exactly one param (1:11)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.544/000077500000000000000000000000001377064615700260745ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.544/input.js000066400000000000000000000000271377064615700275700ustar00rootroot00000000000000({ set prop(x, y) {} })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/.544/options.json000066400000000000000000000000761377064615700304650ustar00rootroot00000000000000{ "throws": "setter should have exactly one param (1:11)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/1/000077500000000000000000000000001377064615700256425ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/1/input.js000066400000000000000000000000051377064615700273320ustar00rootroot00000000000000this babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/1/output.json000066400000000000000000000012061377064615700300740ustar00rootroot00000000000000{ "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": "ThisExpression", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/10/000077500000000000000000000000001377064615700257225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/10/input.js000066400000000000000000000000131377064615700274110ustar00rootroot00000000000000x = [ 42, ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json000066400000000000000000000027241377064615700301620ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ArrayExpression", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/100/000077500000000000000000000000001377064615700260025ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/100/input.js000066400000000000000000000000161377064615700274740ustar00rootroot00000000000000"Hello\ world"babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/100/output.json000066400000000000000000000014261377064615700302400ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [ { "type": "Directive", "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}}, "value": "Hello\\\nworld", "extra": { "raw": "\"Hello\\\nworld\"", "rawValue": "Hello\\\nworld" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/101/000077500000000000000000000000001377064615700260035ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/101/input.js000066400000000000000000000000161377064615700274750ustar00rootroot00000000000000"Hello\1World"babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/101/output.json000066400000000000000000000014271377064615700302420ustar00rootroot00000000000000{ "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": [], "directives": [ { "type": "Directive", "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}}, "value": "Hello\\1World", "extra": { "raw": "\"Hello\\1World\"", "rawValue": "Hello\\1World" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/102/000077500000000000000000000000001377064615700260045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/102/input.js000066400000000000000000000000201377064615700274710ustar00rootroot00000000000000var x = /[a-z]/ibabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/102/output.json000066400000000000000000000023321377064615700302370ustar00rootroot00000000000000{ "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": "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":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}}, "extra": { "raw": "/[a-z]/i" }, "pattern": "[a-z]", "flags": "i" } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/103/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/103/input.js000066400000000000000000000000201377064615700274720ustar00rootroot00000000000000var x = /[x-z]/ibabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/103/output.json000066400000000000000000000023321377064615700302400ustar00rootroot00000000000000{ "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": "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":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}}, "extra": { "raw": "/[x-z]/i" }, "pattern": "[x-z]", "flags": "i" } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/104/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/104/input.js000066400000000000000000000000201377064615700274730ustar00rootroot00000000000000var x = /[a-c]/ibabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/104/output.json000066400000000000000000000023321377064615700302410ustar00rootroot00000000000000{ "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": "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":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}}, "extra": { "raw": "/[a-c]/i" }, "pattern": "[a-c]", "flags": "i" } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/105/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/105/input.js000066400000000000000000000000211377064615700274750ustar00rootroot00000000000000var x = /[P QR]/ibabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/105/output.json000066400000000000000000000023341377064615700302440ustar00rootroot00000000000000{ "type": "File", "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}}, "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":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"}, "name": "x" }, "init": { "type": "RegExpLiteral", "start":8,"end":17,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":17}}, "extra": { "raw": "/[P QR]/i" }, "pattern": "[P QR]", "flags": "i" } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/106/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/106/input.js000066400000000000000000000000221377064615700274770ustar00rootroot00000000000000var x = /foo\/bar/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/106/output.json000066400000000000000000000023401377064615700302420ustar00rootroot00000000000000{ "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": "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": "/foo\\/bar/" }, "pattern": "foo\\/bar", "flags": "" } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/107/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/107/input.js000066400000000000000000000000251377064615700275030ustar00rootroot00000000000000var x = /=([^=\s])+/gbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/107/output.json000066400000000000000000000023461377064615700302510ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "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":21,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":21}}, "extra": { "raw": "/=([^=\\s])+/g" }, "pattern": "=([^=\\s])+", "flags": "g" } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/108/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/108/input.js000066400000000000000000000000261377064615700275050ustar00rootroot00000000000000var x = /[P QR]/\u0067babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json000066400000000000000000000030411377064615700302430ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/109/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/109/input.js000066400000000000000000000000121377064615700275010ustar00rootroot00000000000000new Buttonbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/109/output.json000066400000000000000000000016071377064615700302520ustar00rootroot00000000000000{ "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": "NewExpression", "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"}, "name": "Button" }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/11/000077500000000000000000000000001377064615700257235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/11/input.js000066400000000000000000000000151377064615700274140ustar00rootroot00000000000000x = [ ,, 42 ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/11/output.json000066400000000000000000000026671377064615700301710ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ArrayExpression", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/110/000077500000000000000000000000001377064615700260035ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/110/input.js000066400000000000000000000000141377064615700274730ustar00rootroot00000000000000new Button()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/110/output.json000066400000000000000000000016071377064615700302420ustar00rootroot00000000000000{ "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": "NewExpression", "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"}, "name": "Button" }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/111/000077500000000000000000000000001377064615700260045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/111/input.js000066400000000000000000000000131377064615700274730ustar00rootroot00000000000000new new foobabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/111/output.json000066400000000000000000000021221377064615700302340ustar00rootroot00000000000000{ "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": "NewExpression", "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}}, "callee": { "type": "Identifier", "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "arguments": [] }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/112/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/112/input.js000066400000000000000000000000151377064615700274760ustar00rootroot00000000000000new new foo()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/112/output.json000066400000000000000000000021221377064615700302350ustar00rootroot00000000000000{ "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": "NewExpression", "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}}, "callee": { "type": "Identifier", "start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11},"identifierName":"foo"}, "name": "foo" }, "arguments": [] }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/113/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/113/input.js000066400000000000000000000000171377064615700275010ustar00rootroot00000000000000new foo().bar()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/113/output.json000066400000000000000000000030261377064615700302420ustar00rootroot00000000000000{ "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":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}}, "object": { "type": "NewExpression", "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"}, "name": "foo" }, "arguments": [] }, "property": { "type": "Identifier", "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"bar"}, "name": "bar" }, "computed": false }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/114/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/114/input.js000066400000000000000000000000141377064615700274770ustar00rootroot00000000000000new foo[bar]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/114/output.json000066400000000000000000000024711377064615700302460ustar00rootroot00000000000000{ "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": "NewExpression", "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}}, "object": { "type": "Identifier", "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"}, "name": "bar" }, "computed": true }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/115/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/115/input.js000066400000000000000000000000151377064615700275010ustar00rootroot00000000000000new foo.bar()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/115/output.json000066400000000000000000000024721377064615700302500ustar00rootroot00000000000000{ "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": "NewExpression", "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}}, "object": { "type": "Identifier", "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"}, "name": "bar" }, "computed": false }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/116/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/116/input.js000066400000000000000000000000201377064615700274760ustar00rootroot00000000000000( new foo).bar()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/116/output.json000066400000000000000000000032071377064615700302460ustar00rootroot00000000000000{ "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": "MemberExpression", "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}}, "callee": { "type": "Identifier", "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"}, "name": "foo" }, "arguments": [], "extra": { "parenthesized": true, "parenStart": 0 } }, "property": { "type": "Identifier", "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"bar"}, "name": "bar" }, "computed": false }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/117/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/117/input.js000066400000000000000000000000151377064615700275030ustar00rootroot00000000000000foo(bar, baz)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/117/output.json000066400000000000000000000024721377064615700302520ustar00rootroot00000000000000{ "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": "CallExpression", "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"}, "name": "foo" }, "arguments": [ { "type": "Identifier", "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"}, "name": "baz" } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/118/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/118/input.js000066400000000000000000000000151377064615700275040ustar00rootroot00000000000000( foo )()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/118/output.json000066400000000000000000000017511377064615700302520ustar00rootroot00000000000000{ "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": "CallExpression", "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"}, "name": "foo", "extra": { "parenthesized": true, "parenStart": 0 } }, "arguments": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/119/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/119/input.js000066400000000000000000000000211377064615700275020ustar00rootroot00000000000000universe.milkywaybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/119/output.json000066400000000000000000000021631377064615700302510ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "object": { "type": "Identifier", "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"}, "name": "milkyway" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/12/000077500000000000000000000000001377064615700257245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/12/input.js000066400000000000000000000000201377064615700274110ustar00rootroot00000000000000x = [ 1, 2, 3, ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json000066400000000000000000000041061377064615700301600ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ArrayExpression", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, { "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": "NumericLiteral", "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/120/000077500000000000000000000000001377064615700260045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/120/input.js000066400000000000000000000000351377064615700274770ustar00rootroot00000000000000universe.milkyway.solarsystembabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/120/output.json000066400000000000000000000031001377064615700302310ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "object": { "type": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "Identifier", "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"}, "name": "solarsystem" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/121/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/121/input.js000066400000000000000000000000431377064615700274770ustar00rootroot00000000000000universe.milkyway.solarsystem.Earthbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/121/output.json000066400000000000000000000040251377064615700302410ustar00rootroot00000000000000{ "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": "ExpressionStatement", "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}}, "object": { "type": "MemberExpression", "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}}, "object": { "type": "Identifier", "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"}, "name": "milkyway" }, "computed": false }, "property": { "type": "Identifier", "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"}, "name": "Earth" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/122/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/122/input.js000066400000000000000000000000461377064615700275030ustar00rootroot00000000000000universe[galaxyName, otherUselessName]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/122/output.json000066400000000000000000000031311377064615700302370ustar00rootroot00000000000000{ "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": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "SequenceExpression", "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"}, "name": "galaxyName" }, { "type": "Identifier", "start":21,"end":37,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":37},"identifierName":"otherUselessName"}, "name": "otherUselessName" } ] }, "computed": true } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/123/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/123/input.js000066400000000000000000000000241377064615700275000ustar00rootroot00000000000000universe[galaxyName]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/123/output.json000066400000000000000000000021661377064615700302470ustar00rootroot00000000000000{ "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": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "Identifier", "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19},"identifierName":"galaxyName"}, "name": "galaxyName" }, "computed": true } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/124/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/124/input.js000066400000000000000000000000251377064615700275020ustar00rootroot00000000000000universe[42].galaxiesbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/124/output.json000066400000000000000000000032001377064615700302360ustar00rootroot00000000000000{ "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": "ExpressionStatement", "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}}, "object": { "type": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "NumericLiteral", "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 }, "computed": true }, "property": { "type": "Identifier", "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/125/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/125/input.js000066400000000000000000000000251377064615700275030ustar00rootroot00000000000000universe(42).galaxiesbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/125/output.json000066400000000000000000000032171377064615700302470ustar00rootroot00000000000000{ "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": "ExpressionStatement", "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}}, "object": { "type": "CallExpression", "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"}, "name": "universe" }, "arguments": [ { "type": "NumericLiteral", "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } ] }, "property": { "type": "Identifier", "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/126/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/126/input.js000066400000000000000000000000511377064615700275030ustar00rootroot00000000000000universe(42).galaxies(14, 3, 77).milkywaybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/126/output.json000066400000000000000000000064731377064615700302570ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "object": { "type": "CallExpression", "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}}, "object": { "type": "CallExpression", "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"}, "name": "universe" }, "arguments": [ { "type": "NumericLiteral", "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } ] }, "property": { "type": "Identifier", "start":13,"end":21,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":21},"identifierName":"galaxies"}, "name": "galaxies" }, "computed": false }, "arguments": [ { "type": "NumericLiteral", "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, "extra": { "rawValue": 14, "raw": "14" }, "value": 14 }, { "type": "NumericLiteral", "start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}}, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 }, { "type": "NumericLiteral", "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "extra": { "rawValue": 77, "raw": "77" }, "value": 77 } ] }, "property": { "type": "Identifier", "start":33,"end":41,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":41},"identifierName":"milkyway"}, "name": "milkyway" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/127/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/127/input.js000066400000000000000000000000551377064615700275100ustar00rootroot00000000000000earth.asia.Indonesia.prepareForElection(2014)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/127/output.json000066400000000000000000000051351377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "MemberExpression", "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}}, "object": { "type": "MemberExpression", "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"}, "name": "earth" }, "property": { "type": "Identifier", "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"}, "name": "Indonesia" }, "computed": false }, "property": { "type": "Identifier", "start":21,"end":39,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":39},"identifierName":"prepareForElection"}, "name": "prepareForElection" }, "computed": false }, "arguments": [ { "type": "NumericLiteral", "start":40,"end":44,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":44}}, "extra": { "rawValue": 2014, "raw": "2014" }, "value": 2014 } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/128/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/128/input.js000066400000000000000000000000131377064615700275030ustar00rootroot00000000000000universe.ifbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/128/output.json000066400000000000000000000021471377064615700302530ustar00rootroot00000000000000{ "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": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "Identifier", "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11},"identifierName":"if"}, "name": "if" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/129/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/129/input.js000066400000000000000000000000151377064615700275060ustar00rootroot00000000000000universe.truebabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/129/output.json000066400000000000000000000021531377064615700302510ustar00rootroot00000000000000{ "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": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "Identifier", "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"true"}, "name": "true" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/13/000077500000000000000000000000001377064615700257255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/13/input.js000066400000000000000000000000211377064615700274130ustar00rootroot00000000000000x = [ 1, 2,, 3, ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json000066400000000000000000000041321377064615700301600ustar00rootroot00000000000000{ "type": "File", "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}}, "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":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"}, "name": "x" }, "right": { "type": "ArrayExpression", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, { "type": "NumericLiteral", "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 }, null, { "type": "NumericLiteral", "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/130/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/130/input.js000066400000000000000000000000161377064615700274770ustar00rootroot00000000000000universe.falsebabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/130/output.json000066400000000000000000000021551377064615700302430ustar00rootroot00000000000000{ "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": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "Identifier", "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14},"identifierName":"false"}, "name": "false" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/131/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/131/input.js000066400000000000000000000000151377064615700274770ustar00rootroot00000000000000universe.nullbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/131/output.json000066400000000000000000000021531377064615700302420ustar00rootroot00000000000000{ "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": "MemberExpression", "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"}, "name": "universe" }, "property": { "type": "Identifier", "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13},"identifierName":"null"}, "name": "null" }, "computed": false } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/132/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/132/input.js000066400000000000000000000000031377064615700274750ustar00rootroot00000000000000x++babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/132/output.json000066400000000000000000000016241377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "Identifier", "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/133/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/133/input.js000066400000000000000000000000031377064615700274760ustar00rootroot00000000000000x--babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/133/output.json000066400000000000000000000016241377064615700302460ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "Identifier", "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/134/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/134/input.js000066400000000000000000000000061377064615700275020ustar00rootroot00000000000000eval++babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/134/output.json000066400000000000000000000016321377064615700302460ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/135/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/135/input.js000066400000000000000000000000061377064615700275030ustar00rootroot00000000000000eval--babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/135/output.json000066400000000000000000000016321377064615700302470ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"eval"}, "name": "eval" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/136/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/136/input.js000066400000000000000000000000131377064615700275020ustar00rootroot00000000000000arguments++babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/136/output.json000066400000000000000000000016541377064615700302540ustar00rootroot00000000000000{ "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": "UpdateExpression", "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"}, "name": "arguments" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/137/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/137/input.js000066400000000000000000000000131377064615700275030ustar00rootroot00000000000000arguments--babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/137/output.json000066400000000000000000000016541377064615700302550ustar00rootroot00000000000000{ "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": "UpdateExpression", "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"}, "name": "arguments" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/138/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/138/input.js000066400000000000000000000000031377064615700275030ustar00rootroot00000000000000++xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/138/output.json000066400000000000000000000016231377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "Identifier", "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/139/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/139/input.js000066400000000000000000000000031377064615700275040ustar00rootroot00000000000000--xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/139/output.json000066400000000000000000000016231377064615700302530ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "Identifier", "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/14/000077500000000000000000000000001377064615700257265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/14/input.js000066400000000000000000000000161377064615700274200ustar00rootroot00000000000000日本語 = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/14/output.json000066400000000000000000000021151377064615700301600ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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":"日本語"}, "name": "日本語" }, "right": { "type": "ArrayExpression", "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}}, "elements": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/140/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/140/input.js000066400000000000000000000000061377064615700274770ustar00rootroot00000000000000++evalbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/140/output.json000066400000000000000000000016311377064615700302420ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "++", "prefix": true, "argument": { "type": "Identifier", "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6},"identifierName":"eval"}, "name": "eval" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/141/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/141/input.js000066400000000000000000000000061377064615700275000ustar00rootroot00000000000000--evalbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/141/output.json000066400000000000000000000016311377064615700302430ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "--", "prefix": true, "argument": { "type": "Identifier", "start":2,"end":6,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":6},"identifierName":"eval"}, "name": "eval" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/142/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/142/input.js000066400000000000000000000000131377064615700274770ustar00rootroot00000000000000++argumentsbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/142/output.json000066400000000000000000000016551377064615700302520ustar00rootroot00000000000000{ "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": "UpdateExpression", "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"}, "name": "arguments" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/143/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/143/input.js000066400000000000000000000000131377064615700275000ustar00rootroot00000000000000--argumentsbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/143/output.json000066400000000000000000000016551377064615700302530ustar00rootroot00000000000000{ "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": "UpdateExpression", "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"}, "name": "arguments" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/144/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/144/input.js000066400000000000000000000000021377064615700274770ustar00rootroot00000000000000+xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/144/output.json000066400000000000000000000016211377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "+", "prefix": true, "argument": { "type": "Identifier", "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/145/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/145/input.js000066400000000000000000000000021377064615700275000ustar00rootroot00000000000000-xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/145/output.json000066400000000000000000000016211377064615700302460ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "-", "prefix": true, "argument": { "type": "Identifier", "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/146/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/146/input.js000066400000000000000000000000021377064615700275010ustar00rootroot00000000000000~xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/146/output.json000066400000000000000000000016211377064615700302470ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "~", "prefix": true, "argument": { "type": "Identifier", "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/147/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/147/input.js000066400000000000000000000000021377064615700275020ustar00rootroot00000000000000!xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/147/output.json000066400000000000000000000016211377064615700302500ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/148/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/148/input.js000066400000000000000000000000061377064615700275070ustar00rootroot00000000000000void xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/148/output.json000066400000000000000000000016241377064615700302540ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "void", "prefix": true, "argument": { "type": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"x"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/149/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/149/input.js000066400000000000000000000000101377064615700275030ustar00rootroot00000000000000delete xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/149/output.json000066400000000000000000000016261377064615700302570ustar00rootroot00000000000000{ "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": "UnaryExpression", "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"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/15/000077500000000000000000000000001377064615700257275ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/15/input.js000066400000000000000000000000111377064615700274140ustar00rootroot00000000000000T‿ = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/15/output.json000066400000000000000000000021031377064615700301560ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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‿"}, "name": "T‿" }, "right": { "type": "ArrayExpression", "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/150/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/150/input.js000066400000000000000000000000101377064615700274730ustar00rootroot00000000000000typeof xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/150/output.json000066400000000000000000000016261377064615700302470ustar00rootroot00000000000000{ "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": "UnaryExpression", "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"}, "name": "x" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/151/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/151/input.js000066400000000000000000000000051377064615700275000ustar00rootroot00000000000000x * ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/151/output.json000066400000000000000000000021061377064615700302420ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/152/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/152/input.js000066400000000000000000000000051377064615700275010ustar00rootroot00000000000000x / ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/152/output.json000066400000000000000000000021061377064615700302430ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/153/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/153/input.js000066400000000000000000000000051377064615700275020ustar00rootroot00000000000000x % ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/153/output.json000066400000000000000000000021061377064615700302440ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/154/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/154/input.js000066400000000000000000000000051377064615700275030ustar00rootroot00000000000000x + ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/154/output.json000066400000000000000000000021061377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/155/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/155/input.js000066400000000000000000000000051377064615700275040ustar00rootroot00000000000000x - ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/155/output.json000066400000000000000000000021061377064615700302460ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/156/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/156/input.js000066400000000000000000000000061377064615700275060ustar00rootroot00000000000000x << ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/156/output.json000066400000000000000000000021071377064615700302500ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/157/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/157/input.js000066400000000000000000000000061377064615700275070ustar00rootroot00000000000000x >> ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/157/output.json000066400000000000000000000021071377064615700302510ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/158/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/158/input.js000066400000000000000000000000071377064615700275110ustar00rootroot00000000000000x >>> ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/158/output.json000066400000000000000000000021101377064615700302440ustar00rootroot00000000000000{ "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":"x"}, "name": "x" }, "operator": ">>>", "right": { "type": "Identifier", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/159/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/159/input.js000066400000000000000000000000051377064615700275100ustar00rootroot00000000000000x < ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/159/output.json000066400000000000000000000021061377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/16/000077500000000000000000000000001377064615700257305ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/16/input.js000066400000000000000000000000111377064615700274150ustar00rootroot00000000000000T‌ = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/16/output.json000066400000000000000000000021031377064615700301570ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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‌"}, "name": "T‌" }, "right": { "type": "ArrayExpression", "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/160/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/160/input.js000066400000000000000000000000051377064615700275000ustar00rootroot00000000000000x > ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/160/output.json000066400000000000000000000021061377064615700302420ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/161/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/161/input.js000066400000000000000000000000061377064615700275020ustar00rootroot00000000000000x <= ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/161/output.json000066400000000000000000000021071377064615700302440ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/162/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/162/input.js000066400000000000000000000000061377064615700275030ustar00rootroot00000000000000x >= ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/162/output.json000066400000000000000000000021071377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/163/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/163/input.js000066400000000000000000000000061377064615700275040ustar00rootroot00000000000000x in ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/163/output.json000066400000000000000000000021071377064615700302460ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "left": { "type": "Identifier", "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"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/164/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/164/input.js000066400000000000000000000000161377064615700275060ustar00rootroot00000000000000x instanceof ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/164/output.json000066400000000000000000000021331377064615700302460ustar00rootroot00000000000000{ "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": "BinaryExpression", "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"}, "name": "x" }, "operator": "instanceof", "right": { "type": "Identifier", "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/165/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/165/input.js000066400000000000000000000000111377064615700275020ustar00rootroot00000000000000x < y < zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/165/output.json000066400000000000000000000027621377064615700302570ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "<", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/166/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/166/input.js000066400000000000000000000000061377064615700275070ustar00rootroot00000000000000x == ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/166/output.json000066400000000000000000000021071377064615700302510ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/167/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/167/input.js000066400000000000000000000000061377064615700275100ustar00rootroot00000000000000x != ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/167/output.json000066400000000000000000000021071377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/168/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/168/input.js000066400000000000000000000000071377064615700275120ustar00rootroot00000000000000x === ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/168/output.json000066400000000000000000000021101377064615700302450ustar00rootroot00000000000000{ "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":"x"}, "name": "x" }, "operator": "===", "right": { "type": "Identifier", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/169/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/169/input.js000066400000000000000000000000071377064615700275130ustar00rootroot00000000000000x !== ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/169/output.json000066400000000000000000000021101377064615700302460ustar00rootroot00000000000000{ "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":"x"}, "name": "x" }, "operator": "!==", "right": { "type": "Identifier", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/17/000077500000000000000000000000001377064615700257315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/17/input.js000066400000000000000000000000111377064615700274160ustar00rootroot00000000000000T‍ = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/17/output.json000066400000000000000000000021031377064615700301600ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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‍"}, "name": "T‍" }, "right": { "type": "ArrayExpression", "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/170/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/170/input.js000066400000000000000000000000051377064615700275010ustar00rootroot00000000000000x & ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/170/output.json000066400000000000000000000021061377064615700302430ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/171/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/171/input.js000066400000000000000000000000051377064615700275020ustar00rootroot00000000000000x ^ ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/171/output.json000066400000000000000000000021061377064615700302440ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/172/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/172/input.js000066400000000000000000000000051377064615700275030ustar00rootroot00000000000000x | ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/172/output.json000066400000000000000000000021061377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/173/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/173/input.js000066400000000000000000000000111377064615700275010ustar00rootroot00000000000000x + y + zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/173/output.json000066400000000000000000000027621377064615700302560ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/174/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/174/input.js000066400000000000000000000000111377064615700275020ustar00rootroot00000000000000x - y + zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/174/output.json000066400000000000000000000027621377064615700302570ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/175/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/175/input.js000066400000000000000000000000111377064615700275030ustar00rootroot00000000000000x + y - zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/175/output.json000066400000000000000000000027621377064615700302600ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "+", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/176/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/176/input.js000066400000000000000000000000111377064615700275040ustar00rootroot00000000000000x - y - zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/176/output.json000066400000000000000000000027621377064615700302610ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "-", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/177/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/177/input.js000066400000000000000000000000111377064615700275050ustar00rootroot00000000000000x + y * zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/177/output.json000066400000000000000000000027621377064615700302620ustar00rootroot00000000000000{ "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":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}}, "left": { "type": "Identifier", "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"}, "name": "z" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/178/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/178/input.js000066400000000000000000000000111377064615700275060ustar00rootroot00000000000000x + y / zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/178/output.json000066400000000000000000000027621377064615700302630ustar00rootroot00000000000000{ "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":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}}, "left": { "type": "Identifier", "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"}, "name": "z" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/179/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/179/input.js000066400000000000000000000000111377064615700275070ustar00rootroot00000000000000x - y % zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/179/output.json000066400000000000000000000027621377064615700302640ustar00rootroot00000000000000{ "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":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}}, "left": { "type": "Identifier", "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"}, "name": "z" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/18/000077500000000000000000000000001377064615700257325ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/18/input.js000066400000000000000000000000131377064615700274210ustar00rootroot00000000000000ⅣⅡ = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/18/output.json000066400000000000000000000021071377064615700301650ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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":"ⅣⅡ"}, "name": "ⅣⅡ" }, "right": { "type": "ArrayExpression", "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/180/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/180/input.js000066400000000000000000000000111377064615700274770ustar00rootroot00000000000000x * y * zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/180/output.json000066400000000000000000000027621377064615700302540ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/181/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/181/input.js000066400000000000000000000000111377064615700275000ustar00rootroot00000000000000x * y / zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/181/output.json000066400000000000000000000027621377064615700302550ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/182/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/182/input.js000066400000000000000000000000111377064615700275010ustar00rootroot00000000000000x * y % zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/182/output.json000066400000000000000000000027621377064615700302560ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "*", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/183/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/183/input.js000066400000000000000000000000111377064615700275020ustar00rootroot00000000000000x % y * zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/183/output.json000066400000000000000000000027621377064615700302570ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "%", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/184/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/184/input.js000066400000000000000000000000131377064615700275050ustar00rootroot00000000000000x << y << zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/184/output.json000066400000000000000000000030001377064615700302420ustar00rootroot00000000000000{ "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": "BinaryExpression", "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"}, "name": "x" }, "operator": "<<", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/185/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/185/input.js000066400000000000000000000000111377064615700275040ustar00rootroot00000000000000x | y | zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/185/output.json000066400000000000000000000027621377064615700302610ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "|", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/186/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/186/input.js000066400000000000000000000000111377064615700275050ustar00rootroot00000000000000x & y & zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/186/output.json000066400000000000000000000027621377064615700302620ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/187/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/187/input.js000066400000000000000000000000111377064615700275060ustar00rootroot00000000000000x ^ y ^ zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/187/output.json000066400000000000000000000027621377064615700302630ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "^", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/188/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/188/input.js000066400000000000000000000000111377064615700275070ustar00rootroot00000000000000x & y | zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/188/output.json000066400000000000000000000027621377064615700302640ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "&", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/189/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/189/input.js000066400000000000000000000000111377064615700275100ustar00rootroot00000000000000x | y ^ zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/189/output.json000066400000000000000000000027621377064615700302650ustar00rootroot00000000000000{ "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":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}}, "left": { "type": "Identifier", "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"}, "name": "z" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/19/000077500000000000000000000000001377064615700257335ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/19/input.js000066400000000000000000000000171377064615700274260ustar00rootroot00000000000000ⅣⅡ = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/19/output.json000066400000000000000000000021071377064615700301660ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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":"ⅣⅡ"}, "name": "ⅣⅡ" }, "right": { "type": "ArrayExpression", "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "elements": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/190/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/190/input.js000066400000000000000000000000111377064615700275000ustar00rootroot00000000000000x | y & zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/190/output.json000066400000000000000000000027621377064615700302550ustar00rootroot00000000000000{ "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":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}}, "left": { "type": "Identifier", "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"}, "name": "z" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/191/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/191/input.js000066400000000000000000000000061377064615700275050ustar00rootroot00000000000000x || ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/191/output.json000066400000000000000000000021101377064615700302410ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/192/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/192/input.js000066400000000000000000000000061377064615700275060ustar00rootroot00000000000000x && ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/192/output.json000066400000000000000000000021101377064615700302420ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "Identifier", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/193/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/193/input.js000066400000000000000000000000131377064615700275050ustar00rootroot00000000000000x || y || zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/193/output.json000066400000000000000000000030021377064615700302440ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "||", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/194/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/194/input.js000066400000000000000000000000131377064615700275060ustar00rootroot00000000000000x && y && zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/194/output.json000066400000000000000000000030021377064615700302450ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "operator": "&&", "right": { "type": "Identifier", "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"}, "name": "z" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/195/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/195/input.js000066400000000000000000000000131377064615700275070ustar00rootroot00000000000000x || y && zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/195/output.json000066400000000000000000000030041377064615700302500ustar00rootroot00000000000000{ "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": "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":"x"}, "name": "x" }, "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":"y"}, "name": "y" }, "operator": "&&", "right": { "type": "Identifier", "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"z"}, "name": "z" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/196/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/196/input.js000066400000000000000000000000121377064615700275070ustar00rootroot00000000000000x || y ^ zbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/196/output.json000066400000000000000000000030001377064615700302450ustar00rootroot00000000000000{ "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": "LogicalExpression", "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"}, "name": "x" }, "operator": "||", "right": { "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":"y"}, "name": "y" }, "operator": "^", "right": { "type": "Identifier", "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"z"}, "name": "z" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/197/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/197/input.js000066400000000000000000000000111377064615700275070ustar00rootroot00000000000000y ? 1 : 2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/197/output.json000066400000000000000000000026371377064615700302650ustar00rootroot00000000000000{ "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": "ConditionalExpression", "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"}, "name": "y" }, "consequent": { "type": "NumericLiteral", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "alternate": { "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/198/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/198/input.js000066400000000000000000000000161377064615700275150ustar00rootroot00000000000000x && y ? 1 : 2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/198/output.json000066400000000000000000000035331377064615700302620ustar00rootroot00000000000000{ "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": "ConditionalExpression", "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}}, "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": "Identifier", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "alternate": { "type": "NumericLiteral", "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/199/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/199/input.js000066400000000000000000000000061377064615700275150ustar00rootroot00000000000000x = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/199/output.json000066400000000000000000000022271377064615700302620ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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": "NumericLiteral", "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/2/000077500000000000000000000000001377064615700256435ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/2/input.js000066400000000000000000000000051377064615700273330ustar00rootroot00000000000000null babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/2/output.json000066400000000000000000000012031377064615700300720ustar00rootroot00000000000000{ "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": "NullLiteral", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/20/000077500000000000000000000000001377064615700257235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/20/input.js000066400000000000000000000000061377064615700274140ustar00rootroot00000000000000x = {}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/20/output.json000066400000000000000000000021001377064615700301470ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}}, "properties": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/200/000077500000000000000000000000001377064615700260035ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/200/input.js000066400000000000000000000000111377064615700274700ustar00rootroot00000000000000eval = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/200/output.json000066400000000000000000000022351377064615700302400ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "eval" }, "right": { "type": "NumericLiteral", "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/201/000077500000000000000000000000001377064615700260045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/201/input.js000066400000000000000000000000161377064615700274760ustar00rootroot00000000000000arguments = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/201/output.json000066400000000000000000000022631377064615700302420ustar00rootroot00000000000000{ "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":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"}, "name": "arguments" }, "right": { "type": "NumericLiteral", "start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/202/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/202/input.js000066400000000000000000000000071377064615700274770ustar00rootroot00000000000000x *= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/202/output.json000066400000000000000000000022301377064615700302350ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/203/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/203/input.js000066400000000000000000000000071377064615700275000ustar00rootroot00000000000000x /= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/203/output.json000066400000000000000000000022301377064615700302360ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/204/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/204/input.js000066400000000000000000000000071377064615700275010ustar00rootroot00000000000000x %= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/204/output.json000066400000000000000000000022301377064615700302370ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/205/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/205/input.js000066400000000000000000000000071377064615700275020ustar00rootroot00000000000000x += 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/205/output.json000066400000000000000000000022301377064615700302400ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/206/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/206/input.js000066400000000000000000000000071377064615700275030ustar00rootroot00000000000000x -= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/206/output.json000066400000000000000000000022301377064615700302410ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/207/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/207/input.js000066400000000000000000000000101377064615700274760ustar00rootroot00000000000000x <<= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/207/output.json000066400000000000000000000022311377064615700302430ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/208/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/208/input.js000066400000000000000000000000101377064615700274770ustar00rootroot00000000000000x >>= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/208/output.json000066400000000000000000000022311377064615700302440ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/209/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/209/input.js000066400000000000000000000000111377064615700275010ustar00rootroot00000000000000x >>>= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/209/output.json000066400000000000000000000022321377064615700302460ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "NumericLiteral", "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/21/000077500000000000000000000000001377064615700257245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/21/input.js000066400000000000000000000000071377064615700274160ustar00rootroot00000000000000x = { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/21/output.json000066400000000000000000000021001377064615700301500ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7}}, "properties": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/210/000077500000000000000000000000001377064615700260045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/210/input.js000066400000000000000000000000071377064615700274760ustar00rootroot00000000000000x &= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/210/output.json000066400000000000000000000022301377064615700302340ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/211/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/211/input.js000066400000000000000000000000071377064615700274770ustar00rootroot00000000000000x ^= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/211/output.json000066400000000000000000000022301377064615700302350ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/212/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/212/input.js000066400000000000000000000000071377064615700275000ustar00rootroot00000000000000x |= 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/212/output.json000066400000000000000000000022301377064615700302360ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/213/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/213/input.js000066400000000000000000000000071377064615700275010ustar00rootroot00000000000000{ foo }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/213/output.json000066400000000000000000000016331377064615700302450ustar00rootroot00000000000000{ "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": "BlockStatement", "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}}, "expression": { "type": "Identifier", "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5},"identifierName":"foo"}, "name": "foo" } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/214/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/214/input.js000066400000000000000000000000271377064615700275040ustar00rootroot00000000000000{ doThis(); doThat(); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/214/output.json000066400000000000000000000033721377064615700302500ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "doThis" }, "arguments": [] } }, { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":12,"end":18,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":18},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/215/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/215/input.js000066400000000000000000000000021377064615700274760ustar00rootroot00000000000000{}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/215/output.json000066400000000000000000000010121377064615700302360ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "body": [], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/216/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/216/input.js000066400000000000000000000000051377064615700275020ustar00rootroot00000000000000var xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/216/output.json000066400000000000000000000016621377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/217/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/217/input.js000066400000000000000000000000111377064615700275000ustar00rootroot00000000000000var x, y;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/217/output.json000066400000000000000000000025101377064615700302440ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"y"}, "name": "y" }, "init": null } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/218/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/218/input.js000066400000000000000000000000121377064615700275020ustar00rootroot00000000000000var x = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/218/output.json000066400000000000000000000023221377064615700302460ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/219/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/219/input.js000066400000000000000000000000351377064615700275100ustar00rootroot00000000000000var eval = 42, arguments = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/219/output.json000066400000000000000000000036421377064615700302550ustar00rootroot00000000000000{ "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": "script", "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":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"}, "name": "eval" }, "init": { "type": "NumericLiteral", "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, { "type": "VariableDeclarator", "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"}, "name": "arguments" }, "init": { "type": "NumericLiteral", "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/22/000077500000000000000000000000001377064615700257255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/22/input.js000066400000000000000000000000221377064615700274140ustar00rootroot00000000000000x = { answer: 42 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/22/output.json000066400000000000000000000037021377064615700301620ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":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}}, "method": false, "key": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/220/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/220/input.js000066400000000000000000000000331377064615700274760ustar00rootroot00000000000000var x = 14, y = 3, z = 1977babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/220/output.json000066400000000000000000000051051377064615700302410ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 14, "raw": "14" }, "value": 14 } }, { "type": "VariableDeclarator", "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"}, "name": "y" }, "init": { "type": "NumericLiteral", "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 } }, { "type": "VariableDeclarator", "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"}, "name": "z" }, "init": { "type": "NumericLiteral", "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "extra": { "rawValue": 1977, "raw": "1977" }, "value": 1977 } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/221/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/221/input.js000066400000000000000000000000421377064615700274770ustar00rootroot00000000000000var implements, interface, packagebabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/221/output.json000066400000000000000000000034461377064615700302500ustar00rootroot00000000000000{ "type": "File", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"package"}, "name": "package" }, "init": null } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/222/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/222/input.js000066400000000000000000000000461377064615700275040ustar00rootroot00000000000000var private, protected, public, staticbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/222/output.json000066400000000000000000000043061377064615700302450ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38},"identifierName":"static"}, "name": "static" }, "init": null } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/223/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/223/input.js000066400000000000000000000000011377064615700274740ustar00rootroot00000000000000;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/223/output.json000066400000000000000000000007341377064615700302470ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "EmptyStatement", "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}} } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/224/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/224/input.js000066400000000000000000000000011377064615700274750ustar00rootroot00000000000000xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/224/output.json000066400000000000000000000012561377064615700302500ustar00rootroot00000000000000{ "type": "File", "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}}, "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":"x"}, "name": "x" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/225/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/225/input.js000066400000000000000000000000041377064615700275010ustar00rootroot00000000000000x, ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/225/output.json000066400000000000000000000021271377064615700302470ustar00rootroot00000000000000{ "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": "SequenceExpression", "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"}, "name": "x" }, { "type": "Identifier", "start":3,"end":4,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":4},"identifierName":"y"}, "name": "y" } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/226/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/226/input.js000066400000000000000000000000061377064615700275040ustar00rootroot00000000000000\u0061babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/226/output.json000066400000000000000000000012561377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "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":"a"}, "name": "a" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/227/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/227/input.js000066400000000000000000000000071377064615700275060ustar00rootroot00000000000000a\u0061babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/227/output.json000066400000000000000000000012601377064615700302460ustar00rootroot00000000000000{ "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": "Identifier", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"aa"}, "name": "aa" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/228/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/228/input.js000066400000000000000000000000321377064615700275050ustar00rootroot00000000000000if (morning) goodMorning()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/228/output.json000066400000000000000000000025001377064615700302450ustar00rootroot00000000000000{ "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": "IfStatement", "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"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"goodMorning"}, "name": "goodMorning" }, "arguments": [] } }, "alternate": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/229/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/229/input.js000066400000000000000000000000331377064615700275070ustar00rootroot00000000000000if (morning) (function(){})babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/229/output.json000066400000000000000000000027671377064615700302650ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "IfStatement", "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"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", "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}}, "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": [] }, "extra": { "parenthesized": true, "parenStart": 13 } } }, "alternate": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/23/000077500000000000000000000000001377064615700257265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/23/input.js000066400000000000000000000000161377064615700274200ustar00rootroot00000000000000x = { if: 42 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/23/output.json000066400000000000000000000036701377064615700301670ustar00rootroot00000000000000{ "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":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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/230/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/230/input.js000066400000000000000000000000271377064615700275020ustar00rootroot00000000000000if (morning) var x = 0;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/230/output.json000066400000000000000000000032271377064615700302450ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "IfStatement", "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"}, "name": "morning" }, "consequent": { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } ], "kind": "var" }, "alternate": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/231/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/231/input.js000066400000000000000000000000521377064615700275010ustar00rootroot00000000000000if (morning) goodMorning(); else goodDay()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/231/output.json000066400000000000000000000036151377064615700302470ustar00rootroot00000000000000{ "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": "IfStatement", "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"}, "name": "morning" }, "consequent": { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"goodMorning"}, "name": "goodMorning" }, "arguments": [] } }, "alternate": { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":33,"end":40,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":40},"identifierName":"goodDay"}, "name": "goodDay" }, "arguments": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/232/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/232/input.js000066400000000000000000000000271377064615700275040ustar00rootroot00000000000000do keep(); while (true)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/232/output.json000066400000000000000000000023631377064615700302470ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "keep" }, "arguments": [] } }, "test": { "type": "BooleanLiteral", "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/233/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/233/input.js000066400000000000000000000000301377064615700274770ustar00rootroot00000000000000do keep(); while (true);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/233/output.json000066400000000000000000000023631377064615700302500ustar00rootroot00000000000000{ "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": "DoWhileStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "keep" }, "arguments": [] } }, "test": { "type": "BooleanLiteral", "start":18,"end":22,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":22}}, "value": true } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/234/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/234/input.js000066400000000000000000000000371377064615700275070ustar00rootroot00000000000000do { x++; y--; } while (x < 10)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/234/output.json000066400000000000000000000053071377064615700302520ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "DoWhileStatement", "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}}, "body": [ { "type": "ExpressionStatement", "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}}, "operator": "++", "prefix": false, "argument": { "type": "Identifier", "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}}, "expression": { "type": "UpdateExpression", "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"}, "name": "y" } } } ], "directives": [] }, "test": { "type": "BinaryExpression", "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"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, "extra": { "rawValue": 10, "raw": "10" }, "value": 10 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/235/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/235/input.js000066400000000000000000000000361377064615700275070ustar00rootroot00000000000000{ do { } while (false);false }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/235/output.json000066400000000000000000000027641377064615700302570ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "body": { "type": "BlockStatement", "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}}, "value": false } }, { "type": "ExpressionStatement", "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}}, "value": false } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/236/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/236/input.js000066400000000000000000000000321377064615700275040ustar00rootroot00000000000000while (true) doSomething()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/236/output.json000066400000000000000000000024071377064615700302520ustar00rootroot00000000000000{ "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": "WhileStatement", "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}}, "value": true }, "body": { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"doSomething"}, "name": "doSomething" }, "arguments": [] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/237/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/237/input.js000066400000000000000000000000341377064615700275070ustar00rootroot00000000000000while (x < 10) { x++; y--; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/237/output.json000066400000000000000000000053151377064615700302540ustar00rootroot00000000000000{ "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": "WhileStatement", "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}}, "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 10, "raw": "10" }, "value": 10 } }, "body": { "type": "BlockStatement", "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}}, "expression": { "type": "UpdateExpression", "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"}, "name": "x" } } }, { "type": "ExpressionStatement", "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}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"y"}, "name": "y" } } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/238/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/238/input.js000066400000000000000000000000101377064615700275020ustar00rootroot00000000000000for(;;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/238/output.json000066400000000000000000000012751377064615700302560ustar00rootroot00000000000000{ "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": "ForStatement", "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}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/239/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/239/input.js000066400000000000000000000000111377064615700275040ustar00rootroot00000000000000for(;;){}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/239/output.json000066400000000000000000000013571377064615700302600ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "body": [], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/24/000077500000000000000000000000001377064615700257275ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/24/input.js000066400000000000000000000000201377064615700274140ustar00rootroot00000000000000x = { true: 42 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/24/output.json000066400000000000000000000036761377064615700301760ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/240/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/240/input.js000066400000000000000000000000151377064615700275000ustar00rootroot00000000000000for(x = 0;;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/240/output.json000066400000000000000000000025361377064615700302500ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "test": null, "update": null, "body": { "type": "EmptyStatement", "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/241/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/241/input.js000066400000000000000000000000211377064615700274760ustar00rootroot00000000000000for(var x = 0;;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/241/output.json000066400000000000000000000031531377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": { "type": "NumericLiteral", "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } ], "kind": "var" }, "test": null, "update": null, "body": { "type": "EmptyStatement", "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/242/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/242/input.js000066400000000000000000000000301377064615700274770ustar00rootroot00000000000000for(var x = 0, y = 1;;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/242/output.json000066400000000000000000000045041377064615700302470ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": { "type": "NumericLiteral", "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, { "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":"y"}, "name": "y" }, "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": "var" }, "test": null, "update": null, "body": { "type": "EmptyStatement", "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/243/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/243/input.js000066400000000000000000000000241377064615700275030ustar00rootroot00000000000000for(x = 0; x < 42;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/243/output.json000066400000000000000000000040001377064615700302370ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "test": { "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":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, "update": null, "body": { "type": "EmptyStatement", "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/244/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/244/input.js000066400000000000000000000000301377064615700275010ustar00rootroot00000000000000for(x = 0; x < 42; x++);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/244/output.json000066400000000000000000000046371377064615700302600ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "test": { "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":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, "update": { "type": "UpdateExpression", "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"}, "name": "x" } }, "body": { "type": "EmptyStatement", "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/245/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/245/input.js000066400000000000000000000000431377064615700275060ustar00rootroot00000000000000for(x = 0; x < 42; x++) process(x);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/245/output.json000066400000000000000000000061141377064615700302510ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "test": { "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":"x"}, "name": "x" }, "operator": "<", "right": { "type": "NumericLiteral", "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, "update": { "type": "UpdateExpression", "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"}, "name": "x" } }, "body": { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "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"}, "name": "x" } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/246/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/246/input.js000066400000000000000000000000321377064615700275050ustar00rootroot00000000000000for(x in list) process(x);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/246/output.json000066400000000000000000000033111377064615700302460ustar00rootroot00000000000000{ "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": "ForInStatement", "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"}, "name": "x" }, "right": { "type": "Identifier", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "process" }, "arguments": [ { "type": "Identifier", "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"x"}, "name": "x" } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/247/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/247/input.js000066400000000000000000000000371377064615700275130ustar00rootroot00000000000000for (var x in list) process(x);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/247/output.json000066400000000000000000000042311377064615700302510ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ForInStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": null } ], "kind": "var" }, "right": { "type": "Identifier", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "process" }, "arguments": [ { "type": "Identifier", "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/25/000077500000000000000000000000001377064615700257305ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/25/input.js000066400000000000000000000000211377064615700274160ustar00rootroot00000000000000x = { false: 42 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/25/output.json000066400000000000000000000037001377064615700301630ustar00rootroot00000000000000{ "type": "File", "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}}, "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":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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/250/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/250/input.js000066400000000000000000000000321377064615700275000ustar00rootroot00000000000000while (true) { continue; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/250/output.json000066400000000000000000000021061377064615700302420ustar00rootroot00000000000000{ "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": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/251/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/251/input.js000066400000000000000000000000311377064615700275000ustar00rootroot00000000000000while (true) { continue }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/251/output.json000066400000000000000000000021061377064615700302430ustar00rootroot00000000000000{ "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": "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": "ContinueStatement", "start":15,"end":23,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":23}}, "label": null } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/252/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/252/input.js000066400000000000000000000000441377064615700275050ustar00rootroot00000000000000done: while (true) { continue done }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/252/output.json000066400000000000000000000032661377064615700302540ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "test": { "type": "BooleanLiteral", "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}}, "body": [ { "type": "ContinueStatement", "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"}, "name": "done" } } ], "directives": [] } }, "label": { "type": "Identifier", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/253/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/253/input.js000066400000000000000000000000451377064615700275070ustar00rootroot00000000000000done: while (true) { continue done; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/253/output.json000066400000000000000000000032661377064615700302550ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "test": { "type": "BooleanLiteral", "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}}, "body": [ { "type": "ContinueStatement", "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"}, "name": "done" } } ], "directives": [] } }, "label": { "type": "Identifier", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/254/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/254/input.js000066400000000000000000000000261377064615700275070ustar00rootroot00000000000000while (true) { break }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/254/output.json000066400000000000000000000021031377064615700302430ustar00rootroot00000000000000{ "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": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/255/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/255/input.js000066400000000000000000000000411377064615700275050ustar00rootroot00000000000000done: while (true) { break done }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/255/output.json000066400000000000000000000032631377064615700302540ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "test": { "type": "BooleanLiteral", "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}}, "body": [ { "type": "BreakStatement", "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"}, "name": "done" } } ], "directives": [] } }, "label": { "type": "Identifier", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/256/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/256/input.js000066400000000000000000000000421377064615700275070ustar00rootroot00000000000000done: while (true) { break done; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/256/output.json000066400000000000000000000032631377064615700302550ustar00rootroot00000000000000{ "type": "File", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "test": { "type": "BooleanLiteral", "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}}, "body": [ { "type": "BreakStatement", "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"}, "name": "done" } } ], "directives": [] } }, "label": { "type": "Identifier", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4},"identifierName":"done"}, "name": "done" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/257/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/257/input.js000066400000000000000000000000641377064615700275140ustar00rootroot00000000000000target1: target2: while (true) { continue target1; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/257/output.json000066400000000000000000000041711377064615700302550ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "body": { "type": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": { "type": "Identifier", "start":42,"end":49,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":49},"identifierName":"target1"}, "name": "target1" } } ], "directives": [] } }, "label": { "type": "Identifier", "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"}, "name": "target1" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/258/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/258/input.js000066400000000000000000000000751377064615700275170ustar00rootroot00000000000000target1: target2: target3: while (true) { continue target1; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/258/output.json000066400000000000000000000051041377064615700302530ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "body": { "type": "LabeledStatement", "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}}, "test": { "type": "BooleanLiteral", "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}}, "body": [ { "type": "ContinueStatement", "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"}, "name": "target1" } } ], "directives": [] } }, "label": { "type": "Identifier", "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"}, "name": "target2" } }, "label": { "type": "Identifier", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7},"identifierName":"target1"}, "name": "target1" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/259/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/259/input.js000066400000000000000000000000261377064615700275140ustar00rootroot00000000000000(function(){ return })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/259/output.json000066400000000000000000000024341377064615700302570ustar00rootroot00000000000000{ "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": "FunctionExpression", "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}}, "body": [ { "type": "ReturnStatement", "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19}}, "argument": null } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/26/000077500000000000000000000000001377064615700257315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/26/input.js000066400000000000000000000000201377064615700274160ustar00rootroot00000000000000x = { null: 42 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/26/output.json000066400000000000000000000036761377064615700302000ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/260/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/260/input.js000066400000000000000000000000271377064615700275050ustar00rootroot00000000000000(function(){ return; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/260/output.json000066400000000000000000000024341377064615700302470ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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}}, "body": [ { "type": "ReturnStatement", "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, "argument": null } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/261/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/261/input.js000066400000000000000000000000311377064615700275010ustar00rootroot00000000000000(function(){ return x; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/261/output.json000066400000000000000000000027611377064615700302530ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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}}, "body": [ { "type": "ReturnStatement", "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"}, "name": "x" } } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/262/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/262/input.js000066400000000000000000000000341377064615700275050ustar00rootroot00000000000000(function(){ return x * y })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/262/output.json000066400000000000000000000037411377064615700302530ustar00rootroot00000000000000{ "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": "ExpressionStatement", "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}}, "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}}, "body": [ { "type": "ReturnStatement", "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}}, "left": { "type": "Identifier", "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"}, "name": "y" } } } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/263/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/263/input.js000066400000000000000000000000441377064615700275070ustar00rootroot00000000000000'use\x20strict'; with (x) foo = bar;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/263/output.json000066400000000000000000000036761377064615700302630ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "WithStatement", "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"}, "name": "x" }, "body": { "type": "ExpressionStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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"}, "name": "bar" } } } } ], "directives": [ { "type": "Directive", "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}}, "value": "use\\x20strict", "extra": { "raw": "'use\\x20strict'", "rawValue": "use\\x20strict" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/264/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/264/input.js000066400000000000000000000000441377064615700275100ustar00rootroot00000000000000"use\x20strict"; with (x) foo = bar;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/264/output.json000066400000000000000000000037001377064615700302500ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "WithStatement", "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"}, "name": "x" }, "body": { "type": "ExpressionStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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"}, "name": "bar" } } } } ], "directives": [ { "type": "Directive", "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}}, "value": "use\\x20strict", "extra": { "raw": "\"use\\x20strict\"", "rawValue": "use\\x20strict" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/265/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/265/input.js000066400000000000000000000000221377064615700275050ustar00rootroot00000000000000with (x) foo = barbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/265/output.json000066400000000000000000000027471377064615700302630ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "WithStatement", "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"}, "name": "x" }, "body": { "type": "ExpressionStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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"}, "name": "bar" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/266/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/266/input.js000066400000000000000000000000231377064615700275070ustar00rootroot00000000000000with (x) foo = bar;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/266/output.json000066400000000000000000000027471377064615700302640ustar00rootroot00000000000000{ "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": "WithStatement", "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"}, "name": "x" }, "body": { "type": "ExpressionStatement", "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}}, "operator": "=", "left": { "type": "Identifier", "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"}, "name": "bar" } } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/267/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/267/input.js000066400000000000000000000000261377064615700275130ustar00rootroot00000000000000with (x) { foo = bar }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/267/output.json000066400000000000000000000034161377064615700302570ustar00rootroot00000000000000{ "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": "WithStatement", "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"}, "name": "x" }, "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "foo" }, "right": { "type": "Identifier", "start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20},"identifierName":"bar"}, "name": "bar" } } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/268/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/268/input.js000066400000000000000000000000151377064615700275120ustar00rootroot00000000000000switch (x) {}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/268/output.json000066400000000000000000000013071377064615700302550ustar00rootroot00000000000000{ "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": "SwitchStatement", "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"}, "name": "x" }, "cases": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/269/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/269/input.js000066400000000000000000000000511377064615700275130ustar00rootroot00000000000000switch (answer) { case 42: hi(); break; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/269/output.json000066400000000000000000000041171377064615700302600ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", "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"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "hi" }, "arguments": [] } }, { "type": "BreakStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/27/000077500000000000000000000000001377064615700257325ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/27/input.js000066400000000000000000000000241377064615700274230ustar00rootroot00000000000000x = { "answer": 42 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/27/output.json000066400000000000000000000040601377064615700301650ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "StringLiteral", "start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}}, "extra": { "rawValue": "answer", "raw": "\"answer\"" }, "value": "answer" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/270/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/270/input.js000066400000000000000000000000701377064615700275040ustar00rootroot00000000000000switch (answer) { case 42: hi(); break; default: break }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/270/output.json000066400000000000000000000050041377064615700302440ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", "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"}, "name": "answer" }, "cases": [ { "type": "SwitchCase", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "hi" }, "arguments": [] } }, { "type": "BreakStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, { "type": "SwitchCase", "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}}, "label": null } ], "test": null } ] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/271/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/271/input.js000066400000000000000000000000331377064615700275040ustar00rootroot00000000000000start: for (;;) break startbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/271/output.json000066400000000000000000000024601377064615700302500ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "init": null, "test": null, "update": null, "body": { "type": "BreakStatement", "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"}, "name": "start" } } }, "label": { "type": "Identifier", "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"start"}, "name": "start" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/272/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/272/input.js000066400000000000000000000000371377064615700275110ustar00rootroot00000000000000start: while (true) break startbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/272/output.json000066400000000000000000000026561377064615700302600ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "test": { "type": "BooleanLiteral", "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}}, "label": { "type": "Identifier", "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"}, "name": "start" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/273/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/273/input.js000066400000000000000000000000101377064615700275010ustar00rootroot00000000000000throw x;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/273/output.json000066400000000000000000000012471377064615700302540ustar00rootroot00000000000000{ "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": "ThrowStatement", "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"}, "name": "x" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/274/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/274/input.js000066400000000000000000000000131377064615700275050ustar00rootroot00000000000000throw x * ybabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/274/output.json000066400000000000000000000021131377064615700302460ustar00rootroot00000000000000{ "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": "ThrowStatement", "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}}, "left": { "type": "Identifier", "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"}, "name": "y" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/275/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/275/input.js000066400000000000000000000000321377064615700275070ustar00rootroot00000000000000throw { message: "Error" }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/275/output.json000066400000000000000000000030031377064615700302460ustar00rootroot00000000000000{ "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": "ThrowStatement", "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}}, "properties": [ { "type": "ObjectProperty", "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"}, "name": "message" }, "computed": false, "shorthand": false, "value": { "type": "StringLiteral", "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, "extra": { "rawValue": "Error", "raw": "\"Error\"" }, "value": "Error" } } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/276/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/276/input.js000066400000000000000000000000251377064615700275120ustar00rootroot00000000000000try { } catch (e) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/276/output.json000066400000000000000000000024451377064615700302600ustar00rootroot00000000000000{ "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":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}}, "param": { "type": "Identifier", "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}}, "body": [], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/277/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/277/input.js000066400000000000000000000000301377064615700275070ustar00rootroot00000000000000try { } catch (eval) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/277/output.json000066400000000000000000000024531377064615700302600ustar00rootroot00000000000000{ "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": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "eval" }, "body": { "type": "BlockStatement", "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/278/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/278/input.js000066400000000000000000000000351377064615700275150ustar00rootroot00000000000000try { } catch (arguments) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/278/output.json000066400000000000000000000024651377064615700302640ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "arguments" }, "body": { "type": "BlockStatement", "start":26,"end":29,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":29}}, "body": [], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/279/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/279/input.js000066400000000000000000000000341377064615700275150ustar00rootroot00000000000000try { } catch (e) { say(e) }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/279/output.json000066400000000000000000000043511377064615700302610ustar00rootroot00000000000000{ "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": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "e" }, "body": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "say" }, "arguments": [ { "type": "Identifier", "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25},"identifierName":"e"}, "name": "e" } ] } } ], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/28/000077500000000000000000000000001377064615700257335ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/28/input.js000066400000000000000000000000221377064615700274220ustar00rootroot00000000000000x = { x: 1, x: 2 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/28/output.json000066400000000000000000000054241377064615700301730ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":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}}, "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": false, "value": { "type": "NumericLiteral", "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } }, { "type": "ObjectProperty", "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"}, "name": "x" }, "computed": false, "shorthand": false, "value": { "type": "NumericLiteral", "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/280/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/280/input.js000066400000000000000000000000421377064615700275040ustar00rootroot00000000000000try { } finally { cleanup(stuff) }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/280/output.json000066400000000000000000000035171377064615700302540ustar00rootroot00000000000000{ "type": "File", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", "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}}, "body": [], "directives": [] }, "handler": null, "finalizer": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "cleanup" }, "arguments": [ { "type": "Identifier", "start":26,"end":31,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":31},"identifierName":"stuff"}, "name": "stuff" } ] } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/281/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/281/input.js000066400000000000000000000000461377064615700275110ustar00rootroot00000000000000try { doThat(); } catch (e) { say(e) }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/281/output.json000066400000000000000000000056021377064615700302520ustar00rootroot00000000000000{ "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": "TryStatement", "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}}, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] } } ], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "e" }, "body": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "say" }, "arguments": [ { "type": "Identifier", "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"e"}, "name": "e" } ] } } ], "directives": [] } }, "finalizer": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/282/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/282/input.js000066400000000000000000000001011377064615700275020ustar00rootroot00000000000000try { doThat(); } catch (e) { say(e) } finally { cleanup(stuff) }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/282/output.json000066400000000000000000000077531377064615700302640ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "TryStatement", "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}}, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12},"identifierName":"doThat"}, "name": "doThat" }, "arguments": [] } } ], "directives": [] }, "handler": { "type": "CatchClause", "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"}, "name": "e" }, "body": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "say" }, "arguments": [ { "type": "Identifier", "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"e"}, "name": "e" } ] } } ], "directives": [] } }, "finalizer": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "cleanup" }, "arguments": [ { "type": "Identifier", "start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62},"identifierName":"stuff"}, "name": "stuff" } ] } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/283/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/283/input.js000066400000000000000000000000111377064615700275030ustar00rootroot00000000000000debugger;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/283/output.json000066400000000000000000000007371377064615700302600ustar00rootroot00000000000000{ "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": "DebuggerStatement", "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}} } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/284/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/284/input.js000066400000000000000000000000351377064615700275120ustar00rootroot00000000000000function hello() { sayHi(); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/284/output.json000066400000000000000000000031561377064615700302570ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", "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"}, "name": "hello" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "sayHi" }, "arguments": [] } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/285/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/285/input.js000066400000000000000000000000231377064615700275100ustar00rootroot00000000000000function eval() { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/285/output.json000066400000000000000000000017231377064615700302560ustar00rootroot00000000000000{ "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": "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":"eval"}, "name": "eval" }, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/286/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/286/input.js000066400000000000000000000000301377064615700275070ustar00rootroot00000000000000function arguments() { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/286/output.json000066400000000000000000000017351377064615700302620ustar00rootroot00000000000000{ "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": "FunctionDeclaration", "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"}, "name": "arguments" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/287/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/287/input.js000066400000000000000000000000271377064615700275160ustar00rootroot00000000000000function test(t, t) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/287/output.json000066400000000000000000000025651377064615700302650ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", "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"}, "name": "test" }, "generator": false, "async": false, "params": [ { "type": "Identifier", "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"}, "name": "t" } ], "body": { "type": "BlockStatement", "start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}}, "body": [], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/288/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/288/input.js000066400000000000000000000000311377064615700275120ustar00rootroot00000000000000(function test(t, t) { })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/288/output.json000066400000000000000000000032651377064615700302640ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "id": { "type": "Identifier", "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"test"}, "name": "test" }, "generator": false, "async": false, "params": [ { "type": "Identifier", "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"}, "name": "t" } ], "body": { "type": "BlockStatement", "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}}, "body": [], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/289/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/289/input.js000066400000000000000000000000651377064615700275220ustar00rootroot00000000000000function eval() { function inner() { "use strict" } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/289/output.json000066400000000000000000000044761377064615700302720ustar00rootroot00000000000000{ "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": "FunctionDeclaration", "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"}, "name": "eval" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "id": { "type": "Identifier", "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32},"identifierName":"inner"}, "name": "inner" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "value": { "type": "DirectiveLiteral", "start":37,"end":49,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":49}}, "value": "use strict", "extra": { "raw": "\"use strict\"", "rawValue": "use strict" } } } ] } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/29/000077500000000000000000000000001377064615700257345ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/29/input.js000066400000000000000000000000461377064615700274310ustar00rootroot00000000000000x = { get width() { return m_width } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/29/output.json000066400000000000000000000047441377064615700302000ustar00rootroot00000000000000{ "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":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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"width"}, "name": "width" }, "computed": false, "kind": "get", "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "argument": { "type": "Identifier", "start":27,"end":34,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":34},"identifierName":"m_width"}, "name": "m_width" } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/290/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/290/input.js000066400000000000000000000000361377064615700275100ustar00rootroot00000000000000function hello(a) { sayHi(); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/290/output.json000066400000000000000000000035031377064615700302500ustar00rootroot00000000000000{ "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": "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":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":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}}, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/291/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/291/input.js000066400000000000000000000000411377064615700275050ustar00rootroot00000000000000function hello(a, b) { sayHi(); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/291/output.json000066400000000000000000000040201377064615700302440ustar00rootroot00000000000000{ "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": "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":"hello"}, "name": "hello" }, "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":"b"}, "name": "b" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "sayHi" }, "arguments": [] } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/292/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/292/input.js000066400000000000000000000000331377064615700275070ustar00rootroot00000000000000function hello(...rest) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/292/output.json000066400000000000000000000025461377064615700302600ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "FunctionDeclaration", "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"}, "name": "hello" }, "generator": false, "async": false, "params": [ { "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":"rest"}, "name": "rest" } } ], "body": { "type": "BlockStatement", "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, "body": [], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/293/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/293/input.js000066400000000000000000000000361377064615700275130ustar00rootroot00000000000000function hello(a, ...rest) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/293/output.json000066400000000000000000000030631377064615700302540ustar00rootroot00000000000000{ "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": "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":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":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}}, "argument": { "type": "Identifier", "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}}, "body": [], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/294/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/294/input.js000066400000000000000000000000401377064615700275070ustar00rootroot00000000000000var hi = function() { sayHi() };babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/294/output.json000066400000000000000000000042711377064615700302570ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "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}}, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "Identifier", "start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"sayHi"}, "name": "sayHi" }, "arguments": [] } } ], "directives": [] } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/295/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/295/input.js000066400000000000000000000000451377064615700275150ustar00rootroot00000000000000var hi = function (...r) { sayHi() };babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/295/output.json000066400000000000000000000052001377064615700302510ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "id": null, "generator": false, "async": false, "params": [ { "type": "RestElement", "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"}, "name": "r" } } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "sayHi" }, "arguments": [] } } ], "directives": [] } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/296/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/296/input.js000066400000000000000000000000351377064615700275150ustar00rootroot00000000000000var hi = function eval() { };babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/296/output.json000066400000000000000000000032311377064615700302540ustar00rootroot00000000000000{ "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": "script", "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":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"}, "name": "hi" }, "init": { "type": "FunctionExpression", "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"}, "name": "eval" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":25,"end":28,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":28}}, "body": [], "directives": [] } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/297/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/297/input.js000066400000000000000000000000421377064615700275140ustar00rootroot00000000000000var hi = function arguments() { };babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/297/output.json000066400000000000000000000032431377064615700302600ustar00rootroot00000000000000{ "type": "File", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "start":18,"end":27,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":27},"identifierName":"arguments"}, "name": "arguments" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}}, "body": [], "directives": [] } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/298/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/298/input.js000066400000000000000000000000461377064615700275210ustar00rootroot00000000000000var hello = function hi() { sayHi() };babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/298/output.json000066400000000000000000000046201377064615700302610ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23},"identifierName":"hi"}, "name": "hi" }, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "sayHi" }, "arguments": [] } } ], "directives": [] } } } ], "kind": "var" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/299/000077500000000000000000000000001377064615700260255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/299/input.js000066400000000000000000000000161377064615700275170ustar00rootroot00000000000000(function(){})babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/299/output.json000066400000000000000000000020721377064615700302610ustar00rootroot00000000000000{ "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": "FunctionExpression", "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}}, "body": [], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/3/000077500000000000000000000000001377064615700256445ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/3/input.js000066400000000000000000000000111377064615700273310ustar00rootroot00000000000000 42 babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/3/output.json000066400000000000000000000013631377064615700301020ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/30/000077500000000000000000000000001377064615700257245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/30/input.js000066400000000000000000000000261377064615700274170ustar00rootroot00000000000000x = { get undef() {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/30/output.json000066400000000000000000000037451377064615700301700ustar00rootroot00000000000000{ "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": "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":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"undef"}, "name": "undef" }, "computed": false, "kind": "get", "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}}, "body": [], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/300/000077500000000000000000000000001377064615700260045ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/300/input.js000066400000000000000000000000111377064615700274710ustar00rootroot00000000000000{ x ++y }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/300/output.json000066400000000000000000000030311377064615700302340ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "expression": { "type": "Identifier", "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}}, "expression": { "type": "UpdateExpression", "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"}, "name": "y" } } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/301/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/301/input.js000066400000000000000000000000111377064615700274720ustar00rootroot00000000000000{ x --y }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/301/output.json000066400000000000000000000030311377064615700302350ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "expression": { "type": "Identifier", "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}}, "expression": { "type": "UpdateExpression", "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"}, "name": "y" } } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/302/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/302/input.js000066400000000000000000000000241377064615700274770ustar00rootroot00000000000000var x /* comment */;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/302/output.json000066400000000000000000000025641377064615700302500ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null, "trailingComments": [ { "type": "CommentBlock", "value": " comment ", "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}} } ] } ], "kind": "var" } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": " comment ", "start":6,"end":19,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":19}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/303/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/303/input.js000066400000000000000000000000301377064615700274750ustar00rootroot00000000000000{ var x = 14, y = 3 z; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/303/output.json000066400000000000000000000052021377064615700302410ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "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":"x"}, "name": "x" }, "init": { "type": "NumericLiteral", "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 14, "raw": "14" }, "value": 14 } }, { "type": "VariableDeclarator", "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"}, "name": "y" }, "init": { "type": "NumericLiteral", "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 } } ], "kind": "var" }, { "type": "ExpressionStatement", "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"}, "name": "z" } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/304/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/304/input.js000066400000000000000000000000401377064615700274770ustar00rootroot00000000000000while (true) { continue there; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/304/output.json000066400000000000000000000027451377064615700302530ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null }, { "type": "ExpressionStatement", "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"}, "name": "there" } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/305/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/305/input.js000066400000000000000000000000531377064615700275040ustar00rootroot00000000000000while (true) { continue // Comment there; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/305/output.json000066400000000000000000000043011377064615700302420ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", "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}}, "expression": { "type": "Identifier", "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}} } ] } ], "directives": [] } } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": " Comment", "start":24,"end":34,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":34}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/306/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/306/input.js000066400000000000000000000000671377064615700275120ustar00rootroot00000000000000while (true) { continue /* Multiline Comment */there; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/306/output.json000066400000000000000000000043601377064615700302500ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "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}}, "expression": { "type": "Identifier", "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}} } ] } ], "directives": [] } } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "start":24,"end":47,"loc":{"start":{"line":1,"column":24},"end":{"line":2,"column":10}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/307/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/307/input.js000066400000000000000000000000351377064615700275060ustar00rootroot00000000000000while (true) { break there; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/307/output.json000066400000000000000000000027421377064615700302530ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null }, { "type": "ExpressionStatement", "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"}, "name": "there" } } ], "directives": [] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/308/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/308/input.js000066400000000000000000000000501377064615700275040ustar00rootroot00000000000000while (true) { break // Comment there; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/308/output.json000066400000000000000000000042761377064615700302600ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null, "trailingComments": [ { "type": "CommentLine", "value": " Comment", "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}}, "expression": { "type": "Identifier", "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}} } ] } ], "directives": [] } } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": " Comment", "start":21,"end":31,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":31}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/309/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/309/input.js000066400000000000000000000000641377064615700275120ustar00rootroot00000000000000while (true) { break /* Multiline Comment */there; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/309/output.json000066400000000000000000000043551377064615700302570ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "WhileStatement", "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}}, "value": true }, "body": { "type": "BlockStatement", "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}}, "label": null, "trailingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "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}}, "expression": { "type": "Identifier", "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}} } ] } ], "directives": [] } } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "start":21,"end":44,"loc":{"start":{"line":1,"column":21},"end":{"line":2,"column":10}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/31/000077500000000000000000000000001377064615700257255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/31/input.js000066400000000000000000000000231377064615700274150ustar00rootroot00000000000000x = { get if() {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/31/output.json000066400000000000000000000037371377064615700301720ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"if"}, "name": "if" }, "computed": false, "kind": "get", "id": null, "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": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/310/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/310/input.js000066400000000000000000000000311377064615700274740ustar00rootroot00000000000000(function(){ return x; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/310/output.json000066400000000000000000000033041377064615700302400ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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}}, "body": [ { "type": "ReturnStatement", "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}}, "expression": { "type": "Identifier", "start":20,"end":21,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1},"identifierName":"x"}, "name": "x" } } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/311/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/311/input.js000066400000000000000000000000441377064615700275010ustar00rootroot00000000000000(function(){ return // Comment x; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/311/output.json000066400000000000000000000046741377064615700302540ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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}}, "body": [ { "type": "ReturnStatement", "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}} } ] }, { "type": "ExpressionStatement", "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"}, "name": "x" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": " Comment", "start":20,"end":30,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":30}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/312/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/312/input.js000066400000000000000000000000571377064615700275060ustar00rootroot00000000000000(function(){ return/* Multiline Comment */x; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/312/output.json000066400000000000000000000047541377064615700302540ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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}}, "body": [ { "type": "ReturnStatement", "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}} } ] }, { "type": "ExpressionStatement", "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"}, "name": "x" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] } ], "directives": [] }, "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "start":19,"end":42,"loc":{"start":{"line":1,"column":19},"end":{"line":2,"column":10}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/313/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/313/input.js000066400000000000000000000000261377064615700275030ustar00rootroot00000000000000{ throw error error; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/313/output.json000066400000000000000000000024601377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "argument": { "type": "Identifier", "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}}, "expression": { "type": "Identifier", "start":14,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5},"identifierName":"error"}, "name": "error" } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/314/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/314/input.js000066400000000000000000000000401377064615700275000ustar00rootroot00000000000000{ throw error// Comment error; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/314/output.json000066400000000000000000000037601377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "argument": { "type": "Identifier", "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}} } ] }, { "type": "ExpressionStatement", "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"}, "name": "error" }, "leadingComments": [ { "type": "CommentLine", "value": " Comment", "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] } ], "directives": [] } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": " Comment", "start":13,"end":23,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":23}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/315/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/315/input.js000066400000000000000000000000541377064615700275060ustar00rootroot00000000000000{ throw error/* Multiline Comment */error; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/315/output.json000066400000000000000000000040361377064615700302500ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "argument": { "type": "Identifier", "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}} } ] }, { "type": "ExpressionStatement", "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"}, "name": "error" }, "leadingComments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] } ], "directives": [] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": " Multiline\nComment ", "start":13,"end":36,"loc":{"start":{"line":1,"column":13},"end":{"line":2,"column":10}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/316/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/316/input.js000066400000000000000000000000001377064615700274760ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/316/output.json000066400000000000000000000005111377064615700302430ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/317/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/317/input.js000066400000000000000000000000311377064615700275030ustar00rootroot00000000000000foo: if (true) break foo;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/317/output.json000066400000000000000000000027041377064615700302520ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "test": { "type": "BooleanLiteral", "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}}, "label": { "type": "Identifier", "start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24},"identifierName":"foo"}, "name": "foo" } }, "alternate": null }, "label": { "type": "Identifier", "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3},"identifierName":"foo"}, "name": "foo" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/318/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/318/input.js000066400000000000000000000000501377064615700275050ustar00rootroot00000000000000(function () { 'use strict'; ''; }())babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/318/output.json000066400000000000000000000046141377064615700302550ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "FunctionExpression", "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}}, "body": [], "directives": [ { "type": "Directive", "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}}, "value": "use strict", "extra": { "raw": "'use strict'", "rawValue": "use strict" } } }, { "type": "Directive", "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}}, "value": "\u0000", "extra": { "raw": "'\u0000'", "rawValue": "\u0000" } } } ] } }, "arguments": [], "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/319/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/319/input.js000066400000000000000000000000211377064615700275040ustar00rootroot00000000000000123..toString(10)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/319/output.json000066400000000000000000000033201377064615700302470ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "MemberExpression", "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}}, "extra": { "rawValue": 123, "raw": "123." }, "value": 123 }, "property": { "type": "Identifier", "start":5,"end":13,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":13},"identifierName":"toString"}, "name": "toString" }, "computed": false }, "arguments": [ { "type": "NumericLiteral", "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "extra": { "rawValue": 10, "raw": "10" }, "value": 10 } ] } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/32/000077500000000000000000000000001377064615700257265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/32/input.js000066400000000000000000000000251377064615700274200ustar00rootroot00000000000000x = { get true() {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/32/output.json000066400000000000000000000037431377064615700301700ustar00rootroot00000000000000{ "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": "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": "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":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}}, "method": false, "key": { "type": "Identifier", "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"true"}, "name": "true" }, "computed": false, "kind": "get", "id": null, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/320/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/320/input.js000066400000000000000000000000061377064615700274770ustar00rootroot00000000000000123.+2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/320/output.json000066400000000000000000000023411377064615700302410ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "left": { "type": "NumericLiteral", "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, "extra": { "rawValue": 123, "raw": "123." }, "value": 123 }, "operator": "+", "right": { "type": "NumericLiteral", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/321/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/321/input.js000066400000000000000000000000051377064615700274770ustar00rootroot00000000000000a
bbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/321/output.json000066400000000000000000000020171377064615700302420ustar00rootroot00000000000000{ "type": "File", "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}}, "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":"a"}, "name": "a" } }, { "type": "ExpressionStatement", "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"}, "name": "b" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/322/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/322/input.js000066400000000000000000000000121377064615700274760ustar00rootroot00000000000000'a\u0026b'babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/322/output.json000066400000000000000000000014111377064615700302400ustar00rootroot00000000000000{ "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": [], "directives": [ { "type": "Directive", "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}}, "value": "a\\u0026b", "extra": { "raw": "'a\\u0026b'", "rawValue": "a\\u0026b" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/323/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/323/input.js000066400000000000000000000000211377064615700274770ustar00rootroot00000000000000foo: 10; foo: 20;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/323/output.json000066400000000000000000000036471377064615700302560ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "LabeledStatement", "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}}, "expression": { "type": "NumericLiteral", "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}}, "extra": { "rawValue": 10, "raw": "10" }, "value": 10 } }, "label": { "type": "Identifier", "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}}, "body": { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": 20, "raw": "20" }, "value": 20 } }, "label": { "type": "Identifier", "start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, "name": "foo" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/324/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/324/input.js000066400000000000000000000000141377064615700275020ustar00rootroot00000000000000if(1)/ foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/324/output.json000066400000000000000000000023331377064615700302460ustar00rootroot00000000000000{ "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": "IfStatement", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "consequent": { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/ foo/" }, "pattern": " foo", "flags": "" } }, "alternate": null } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/325/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/325/input.js000066400000000000000000000000171377064615700275060ustar00rootroot00000000000000price_9̶9̶_89babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/325/output.json000066400000000000000000000013221377064615700302440ustar00rootroot00000000000000{ "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": "Identifier", "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" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/326/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/326/input.js000066400000000000000000000000101377064615700275000ustar00rootroot00000000000000a.in / bbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/326/output.json000066400000000000000000000027731377064615700302600ustar00rootroot00000000000000{ "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": "BinaryExpression", "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}}, "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":4,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":4},"identifierName":"in"}, "name": "in" }, "computed": false }, "operator": "/", "right": { "type": "Identifier", "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"b"}, "name": "b" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/327/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/327/input.js000066400000000000000000000000151377064615700275060ustar00rootroot00000000000000return {} / 2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/327/options.json000066400000000000000000000000511377064615700303770ustar00rootroot00000000000000{ "allowReturnOutsideFunction": true } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/327/output.json000066400000000000000000000022141377064615700302470ustar00rootroot00000000000000{ "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": "ReturnStatement", "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}}, "left": { "type": "ObjectExpression", "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}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/328/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/328/input.js000066400000000000000000000000171377064615700275110ustar00rootroot00000000000000return {} /foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/328/options.json000066400000000000000000000000511377064615700304000ustar00rootroot00000000000000{ "allowReturnOutsideFunction": true } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/328/output.json000066400000000000000000000021421377064615700302500ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ReturnStatement", "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}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/329/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/329/input.js000066400000000000000000000000071377064615700275110ustar00rootroot00000000000000+{} / 2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/329/output.json000066400000000000000000000025651377064615700302620ustar00rootroot00000000000000{ "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": "UnaryExpression", "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}}, "properties": [] } }, "operator": "/", "right": { "type": "NumericLiteral", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/33/000077500000000000000000000000001377064615700257275ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/33/input.js000066400000000000000000000000261377064615700274220ustar00rootroot00000000000000x = { get false() {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/33/output.json000066400000000000000000000037451377064615700301730ustar00rootroot00000000000000{ "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": "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":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"false"}, "name": "false" }, "computed": false, "kind": "get", "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}}, "body": [], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/330/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/330/input.js000066400000000000000000000000101377064615700274730ustar00rootroot00000000000000{} /foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/330/output.json000066400000000000000000000016621377064615700302470ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "expression": { "type": "RegExpLiteral", "start":3,"end":8,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":5}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/331/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/331/input.js000066400000000000000000000000141377064615700275000ustar00rootroot00000000000000x++ {} /foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/331/output.json000066400000000000000000000027751377064615700302560ustar00rootroot00000000000000{ "type": "File", "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}}, "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": "Identifier", "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}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/332/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/332/input.js000066400000000000000000000000121377064615700274770ustar00rootroot00000000000000{{} /foo/}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/332/output.json000066400000000000000000000023061377064615700302450ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "directives": [] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/333/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/333/input.js000066400000000000000000000000171377064615700275050ustar00rootroot00000000000000while (1) /foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/333/output.json000066400000000000000000000022751377064615700302530ustar00rootroot00000000000000{ "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": "WhileStatement", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "body": { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/334/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/334/input.js000066400000000000000000000000071377064615700275050ustar00rootroot00000000000000(1) / 2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/334/output.json000066400000000000000000000024361377064615700302530ustar00rootroot00000000000000{ "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": "NumericLiteral", "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "extra": { "rawValue": 1, "raw": "1", "parenthesized": true, "parenStart": 0 }, "value": 1 }, "operator": "/", "right": { "type": "NumericLiteral", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/335/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/335/input.js000066400000000000000000000000211377064615700275020ustar00rootroot00000000000000({a: [1]}+[]) / 2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/335/output.json000066400000000000000000000055131377064615700302530ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "left": { "type": "BinaryExpression", "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}}, "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": "ArrayExpression", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } ] } } ] }, "operator": "+", "right": { "type": "ArrayExpression", "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "elements": [] }, "extra": { "parenthesized": true, "parenStart": 0 } }, "operator": "/", "right": { "type": "NumericLiteral", "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/336/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/336/input.js000066400000000000000000000000131377064615700275040ustar00rootroot00000000000000{[1]} /foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/336/output.json000066400000000000000000000032151377064615700302510ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "expression": { "type": "ArrayExpression", "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}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } ] } } ], "directives": [] }, { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/337/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/337/input.js000066400000000000000000000000361377064615700275120ustar00rootroot00000000000000switch(a) { case 1: {} /foo/ }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/337/output.json000066400000000000000000000037121377064615700302540ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "SwitchStatement", "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"}, "name": "a" }, "cases": [ { "type": "SwitchCase", "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}}, "body": [], "directives": [] }, { "type": "ExpressionStatement", "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}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "test": { "type": "NumericLiteral", "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } ] } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/338/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/338/input.js000066400000000000000000000000151377064615700275100ustar00rootroot00000000000000({1: {} / 2})babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/338/output.json000066400000000000000000000041701377064615700302540ustar00rootroot00000000000000{ "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": "ObjectExpression", "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}}, "method": false, "key": { "type": "NumericLiteral", "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 }, "computed": false, "shorthand": false, "value": { "type": "BinaryExpression", "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}}, "properties": [] }, "operator": "/", "right": { "type": "NumericLiteral", "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "extra": { "parenthesized": true, "parenStart": 0 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/339/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/339/input.js000066400000000000000000000000101377064615700275040ustar00rootroot00000000000000+x++ / 2babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/339/output.json000066400000000000000000000031751377064615700302610ustar00rootroot00000000000000{ "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": "BinaryExpression", "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}}, "operator": "+", "prefix": true, "argument": { "type": "UpdateExpression", "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"}, "name": "x" } } }, "operator": "/", "right": { "type": "NumericLiteral", "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "extra": { "rawValue": 2, "raw": "2" }, "value": 2 } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/34/000077500000000000000000000000001377064615700257305ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/34/input.js000066400000000000000000000000251377064615700274220ustar00rootroot00000000000000x = { get null() {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/34/output.json000066400000000000000000000037431377064615700301720ustar00rootroot00000000000000{ "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": "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": "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":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}}, "method": false, "key": { "type": "Identifier", "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"null"}, "name": "null" }, "computed": false, "kind": "get", "id": null, "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/340/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/340/input.js000066400000000000000000000000171377064615700275030ustar00rootroot00000000000000foo.in {} /foo/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/340/output.json000066400000000000000000000032761377064615700302530ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6},"identifierName":"in"}, "name": "in" }, "computed": false } }, { "type": "BlockStatement", "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}}, "expression": { "type": "RegExpLiteral", "start":10,"end":15,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":5}}, "extra": { "raw": "/foo/" }, "pattern": "foo", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/341/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/341/input.js000066400000000000000000000000051377064615700275010ustar00rootroot00000000000000{}/=/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/341/output.json000066400000000000000000000016561377064615700302540ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "BlockStatement", "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}}, "expression": { "type": "RegExpLiteral", "start":2,"end":5,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":5}}, "extra": { "raw": "/=/" }, "pattern": "=", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/342/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/342/input.js000066400000000000000000000000201377064615700274770ustar00rootroot00000000000000foo 10; --> nothingbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/343/output.json000066400000000000000000000043631377064615700302540ustar00rootroot00000000000000{ "type": "File", "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}}, "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":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"}, "name": "x" }, "right": { "type": "BinaryExpression", "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}}, "operator": "--", "prefix": false, "argument": { "type": "Identifier", "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}}, "extra": { "rawValue": 10, "raw": "10" }, "value": 10 } } }, "trailingComments": [ { "type": "CommentLine", "value": " nothing", "start":13,"end":24,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":12}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": " nothing", "start":13,"end":24,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":12}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/344/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/344/input.js000066400000000000000000000000361377064615700275100ustar00rootroot00000000000000'use strict'; object.static();babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/344/output.json000066400000000000000000000034141377064615700302510ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "callee": { "type": "MemberExpression", "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"}, "name": "object" }, "property": { "type": "Identifier", "start":21,"end":27,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":13},"identifierName":"static"}, "name": "static" }, "computed": false }, "arguments": [] } } ], "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/345/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/345/input.js000066400000000000000000000000011377064615700275010ustar00rootroot00000000000000{babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/345/options.json000066400000000000000000000000511377064615700303770ustar00rootroot00000000000000{ "throws": "Unexpected token (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/346/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/346/input.js000066400000000000000000000000011377064615700275020ustar00rootroot00000000000000}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/346/options.json000066400000000000000000000000511377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected token (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/347/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/347/input.js000066400000000000000000000000031377064615700275050ustar00rootroot000000000000003eababel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json000066400000000000000000000000711377064615700304030ustar00rootroot00000000000000{ "throws": "Identifier directly after number (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/348/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/348/input.js000066400000000000000000000000061377064615700275110ustar00rootroot000000000000003in []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/348/options.json000066400000000000000000000000711377064615700304040ustar00rootroot00000000000000{ "throws": "Identifier directly after number (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/349/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/349/input.js000066400000000000000000000000021377064615700275060ustar00rootroot000000000000003ebabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json000066400000000000000000000015331377064615700302560ustar00rootroot00000000000000{ "type": "File", "start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}}, "errors": [ "SyntaxError: Floating-point numbers require a valid exponent after the 'e' (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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/35/000077500000000000000000000000001377064615700257315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/35/input.js000066400000000000000000000000301377064615700274170ustar00rootroot00000000000000x = { get "undef"() {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/35/output.json000066400000000000000000000041221377064615700301630ustar00rootroot00000000000000{ "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":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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "StringLiteral", "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, "extra": { "rawValue": "undef", "raw": "\"undef\"" }, "value": "undef" }, "computed": false, "kind": "get", "id": null, "generator": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, "body": [], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/350/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/350/input.js000066400000000000000000000000031377064615700274770ustar00rootroot000000000000003e+babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json000066400000000000000000000015341377064615700302470ustar00rootroot00000000000000{ "type": "File", "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "errors": [ "SyntaxError: Floating-point numbers require a valid exponent after the 'e' (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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/351/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/351/input.js000066400000000000000000000000031377064615700275000ustar00rootroot000000000000003e-babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json000066400000000000000000000015341377064615700302500ustar00rootroot00000000000000{ "type": "File", "start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}}, "errors": [ "SyntaxError: Floating-point numbers require a valid exponent after the 'e' (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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/352/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/352/input.js000066400000000000000000000000021377064615700275000ustar00rootroot000000000000003xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/352/options.json000066400000000000000000000000711377064615700303770ustar00rootroot00000000000000{ "throws": "Identifier directly after number (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/353/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/353/input.js000066400000000000000000000000031377064615700275020ustar00rootroot000000000000003x0babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/353/options.json000066400000000000000000000000711377064615700304000ustar00rootroot00000000000000{ "throws": "Identifier directly after number (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/354/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/354/input.js000066400000000000000000000000021377064615700275020ustar00rootroot000000000000000xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json000066400000000000000000000014771377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/355/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/355/input.js000066400000000000000000000000021377064615700275030ustar00rootroot0000000000000009babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/355/output.json000066400000000000000000000013611377064615700302520ustar00rootroot00000000000000{ "type": "File", "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}}, "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": 9, "raw": "09" }, "value": 9 } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/356/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/356/input.js000066400000000000000000000000031377064615700275050ustar00rootroot00000000000000018babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/356/output.json000066400000000000000000000013641377064615700302560ustar00rootroot00000000000000{ "type": "File", "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}}, "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": 18, "raw": "018" }, "value": 18 } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/357/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/357/input.js000066400000000000000000000000031377064615700275060ustar00rootroot0000000000000001ababel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/357/options.json000066400000000000000000000000711377064615700304040ustar00rootroot00000000000000{ "throws": "Identifier directly after number (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/358/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/358/input.js000066400000000000000000000000051377064615700275110ustar00rootroot000000000000003in[]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/358/options.json000066400000000000000000000000711377064615700304050ustar00rootroot00000000000000{ "throws": "Identifier directly after number (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/359/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/359/input.js000066400000000000000000000000071377064615700275140ustar00rootroot000000000000000x3in[]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/359/options.json000066400000000000000000000000711377064615700304060ustar00rootroot00000000000000{ "throws": "Identifier directly after number (1:3)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/36/000077500000000000000000000000001377064615700257325ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/36/input.js000066400000000000000000000000231377064615700274220ustar00rootroot00000000000000x = { get 10() {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/36/output.json000066400000000000000000000041021377064615700301620ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "NumericLiteral", "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 10, "raw": "10" }, "value": 10 }, "computed": false, "kind": "get", "id": null, "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": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/360/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/360/input.js000066400000000000000000000000151377064615700275030ustar00rootroot00000000000000"Hello World"babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/360/options.json000066400000000000000000000000651377064615700304010ustar00rootroot00000000000000{ "throws": "Unterminated string constant (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/361/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/361/input.js000066400000000000000000000000021377064615700275000ustar00rootroot00000000000000x\babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json000066400000000000000000000014121377064615700302440ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/362/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/362/input.js000066400000000000000000000000071377064615700275060ustar00rootroot00000000000000x\u005cbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json000066400000000000000000000013651377064615700302540ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/363/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/363/input.js000066400000000000000000000000071377064615700275070ustar00rootroot00000000000000x\u002ababel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json000066400000000000000000000013631377064615700302530ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/364/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/364/input.js000066400000000000000000000000011377064615700275020ustar00rootroot00000000000000/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/364/options.json000066400000000000000000000000701377064615700304010ustar00rootroot00000000000000{ "throws": "Unterminated regular expression (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/365/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/365/input.js000066400000000000000000000000051377064615700275070ustar00rootroot00000000000000/testbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/365/options.json000066400000000000000000000000701377064615700304020ustar00rootroot00000000000000{ "throws": "Unterminated regular expression (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/366/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/366/input.js000066400000000000000000000000221377064615700275070ustar00rootroot00000000000000var x = /[a-z]/\uxbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json000066400000000000000000000025501377064615700302550ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/367/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/367/input.js000066400000000000000000000000051377064615700275110ustar00rootroot000000000000003 = 4babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json000066400000000000000000000024721377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/368/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/368/input.js000066400000000000000000000000121377064615700275100ustar00rootroot00000000000000func() = 4babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json000066400000000000000000000027201377064615700302560ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/369/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/369/input.js000066400000000000000000000000141377064615700275130ustar00rootroot00000000000000(1 + 1) = 10babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json000066400000000000000000000037731377064615700302700ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/37/000077500000000000000000000000001377064615700257335ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/37/input.js000066400000000000000000000000441377064615700274260ustar00rootroot00000000000000x = { set width(w) { m_width = w } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/37/output.json000066400000000000000000000064371377064615700302000ustar00rootroot00000000000000{ "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": "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": "ObjectMethod", "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"}, "name": "width" }, "computed": false, "kind": "set", "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":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "m_width" }, "right": { "type": "Identifier", "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/370/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/370/input.js000066400000000000000000000000031377064615700275010ustar00rootroot000000000000001++babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json000066400000000000000000000020661377064615700302520ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/371/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/371/input.js000066400000000000000000000000031377064615700275020ustar00rootroot000000000000001--babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json000066400000000000000000000020661377064615700302530ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/372/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/372/input.js000066400000000000000000000000031377064615700275030ustar00rootroot00000000000000++1babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json000066400000000000000000000020641377064615700302520ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/373/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/373/input.js000066400000000000000000000000031377064615700275040ustar00rootroot00000000000000--1babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json000066400000000000000000000020641377064615700302530ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/374/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/374/input.js000066400000000000000000000000401377064615700275060ustar00rootroot00000000000000for((1 + 1) in list) process(x);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json000066400000000000000000000047661377064615700302670ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/375/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/375/input.js000066400000000000000000000000011377064615700275040ustar00rootroot00000000000000[babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/375/options.json000066400000000000000000000000511377064615700304020ustar00rootroot00000000000000{ "throws": "Unexpected token (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/376/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/376/input.js000066400000000000000000000000021377064615700275060ustar00rootroot00000000000000[,babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/376/options.json000066400000000000000000000000511377064615700304030ustar00rootroot00000000000000{ "throws": "Unexpected token (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/377/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/377/input.js000066400000000000000000000000051377064615700275120ustar00rootroot000000000000001 + {babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/377/options.json000066400000000000000000000000511377064615700304040ustar00rootroot00000000000000{ "throws": "Unexpected token (1:5)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/378/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/378/input.js000066400000000000000000000000121377064615700275110ustar00rootroot000000000000001 + { t:t babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/378/options.json000066400000000000000000000000711377064615700304070ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \",\" (1:9)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/379/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/379/input.js000066400000000000000000000000121377064615700275120ustar00rootroot000000000000001 + { t:t,babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/379/options.json000066400000000000000000000000521377064615700304070ustar00rootroot00000000000000{ "throws": "Unexpected token (1:10)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/38/000077500000000000000000000000001377064615700257345ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/38/input.js000066400000000000000000000000361377064615700274300ustar00rootroot00000000000000x = { set if(w) { m_if = w } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/38/output.json000066400000000000000000000064231377064615700301740ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":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}}, "method": false, "key": { "type": "Identifier", "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12},"identifierName":"if"}, "name": "if" }, "computed": false, "kind": "set", "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":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "m_if" }, "right": { "type": "Identifier", "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"w"}, "name": "w" } } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/380/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/380/input.js000066400000000000000000000000131377064615700275030ustar00rootroot00000000000000var x = / /babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/380/options.json000066400000000000000000000000701377064615700303770ustar00rootroot00000000000000{ "throws": "Unterminated regular expression (1:9)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/381/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/381/input.js000066400000000000000000000000121377064615700275030ustar00rootroot00000000000000var x = " babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/381/options.json000066400000000000000000000000651377064615700304040ustar00rootroot00000000000000{ "throws": "Unterminated string constant (1:8)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/382/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/382/input.js000066400000000000000000000000131377064615700275050ustar00rootroot00000000000000var if = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json000066400000000000000000000024301377064615700302500ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/383/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/383/input.js000066400000000000000000000000121377064615700275050ustar00rootroot00000000000000i + 2 = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json000066400000000000000000000033731377064615700302600ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/384/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/384/input.js000066400000000000000000000000071377064615700275120ustar00rootroot00000000000000+i = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json000066400000000000000000000027421377064615700302600ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/385/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/385/input.js000066400000000000000000000000051377064615700275110ustar00rootroot000000000000001 + (babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/385/options.json000066400000000000000000000000511377064615700304030ustar00rootroot00000000000000{ "throws": "Unexpected token (1:5)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/386/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/386/input.js000066400000000000000000000000041377064615700275110ustar00rootroot00000000000000 {babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/386/options.json000066400000000000000000000000511377064615700304040ustar00rootroot00000000000000{ "throws": "Unexpected token (4:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/387/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/387/input.js000066400000000000000000000000371377064615700275200ustar00rootroot00000000000000 /* Some multiline comment */ )babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/387/options.json000066400000000000000000000000511377064615700304050ustar00rootroot00000000000000{ "throws": "Unexpected token (4:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/388/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/388/input.js000066400000000000000000000000111377064615700275110ustar00rootroot00000000000000{ set 1 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/388/options.json000066400000000000000000000000711377064615700304100ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:6)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/389/000077500000000000000000000000001377064615700260255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/389/input.js000066400000000000000000000000111377064615700275120ustar00rootroot00000000000000{ get 2 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/389/options.json000066400000000000000000000000711377064615700304110ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:6)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/39/000077500000000000000000000000001377064615700257355ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/39/input.js000066400000000000000000000000421377064615700274260ustar00rootroot00000000000000x = { set true(w) { m_true = w } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/39/output.json000066400000000000000000000064331377064615700301760ustar00rootroot00000000000000{ "type": "File", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":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}}, "method": false, "key": { "type": "Identifier", "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"true"}, "name": "true" }, "computed": false, "kind": "set", "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":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "m_true" }, "right": { "type": "Identifier", "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"w"}, "name": "w" } } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/390/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/390/input.js000066400000000000000000000000241377064615700275060ustar00rootroot00000000000000({ set: s(if) { } })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/390/options.json000066400000000000000000000000521377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected token (1:10)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/391/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/391/input.js000066400000000000000000000000221377064615700275050ustar00rootroot00000000000000({ set s(.) { } })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/391/options.json000066400000000000000000000000511377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected token (1:9)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/392/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/392/input.js000066400000000000000000000000221377064615700275060ustar00rootroot00000000000000({ set: s() { } })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/392/options.json000066400000000000000000000000721377064615700304040ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \",\" (1:12)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/393/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/393/input.js000066400000000000000000000000261377064615700275130ustar00rootroot00000000000000({ set: s(a, b) { } })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/393/options.json000066400000000000000000000000721377064615700304050ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \",\" (1:16)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/394/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/394/input.js000066400000000000000000000000231377064615700275110ustar00rootroot00000000000000({ get: g(d) { } })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/394/options.json000066400000000000000000000000721377064615700304060ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \",\" (1:13)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/395/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/395/input.js000066400000000000000000000000231377064615700275120ustar00rootroot00000000000000function t(...) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/395/options.json000066400000000000000000000000521377064615700304050ustar00rootroot00000000000000{ "throws": "Unexpected token (1:14)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/396/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/396/input.js000066400000000000000000000000321377064615700275130ustar00rootroot00000000000000function t(...rest, b) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/396/options.json000066400000000000000000000000731377064615700304110ustar00rootroot00000000000000{ "throws": "Rest element must be last element (1:18)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/397/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/397/input.js000066400000000000000000000000221377064615700275130ustar00rootroot00000000000000function t(if) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json000066400000000000000000000023511377064615700302600ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/398/000077500000000000000000000000001377064615700260255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/398/input.js000066400000000000000000000000241377064615700275160ustar00rootroot00000000000000function t(true) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json000066400000000000000000000023571377064615700302670ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/399/000077500000000000000000000000001377064615700260265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/399/input.js000066400000000000000000000000251377064615700275200ustar00rootroot00000000000000function t(false) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json000066400000000000000000000023621377064615700302640ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/4/000077500000000000000000000000001377064615700256455ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/4/input.js000066400000000000000000000000101377064615700273310ustar00rootroot00000000000000/foobar/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/4/output.json000066400000000000000000000013731377064615700301040ustar00rootroot00000000000000{ "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": "RegExpLiteral", "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "extra": { "raw": "/foobar/" }, "pattern": "foobar", "flags": "" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/40/000077500000000000000000000000001377064615700257255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/40/input.js000066400000000000000000000000441377064615700274200ustar00rootroot00000000000000x = { set false(w) { m_false = w } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/40/output.json000066400000000000000000000064371377064615700301720ustar00rootroot00000000000000{ "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": "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": "ObjectMethod", "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"}, "name": "false" }, "computed": false, "kind": "set", "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":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "m_false" }, "right": { "type": "Identifier", "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/400/000077500000000000000000000000001377064615700260055ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/400/input.js000066400000000000000000000000241377064615700274760ustar00rootroot00000000000000function t(null) { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json000066400000000000000000000023571377064615700302470ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/401/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/401/input.js000066400000000000000000000000231377064615700274760ustar00rootroot00000000000000function null() { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json000066400000000000000000000020311377064615700302350ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/402/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/402/input.js000066400000000000000000000000231377064615700274770ustar00rootroot00000000000000function true() { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json000066400000000000000000000020311377064615700302360ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/403/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/403/input.js000066400000000000000000000000241377064615700275010ustar00rootroot00000000000000function false() { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json000066400000000000000000000020341377064615700302420ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/404/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/404/input.js000066400000000000000000000000211377064615700274770ustar00rootroot00000000000000function if() { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json000066400000000000000000000020231377064615700302410ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/405/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/405/input.js000066400000000000000000000000041377064615700275010ustar00rootroot00000000000000a b;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/405/options.json000066400000000000000000000000711377064615700303760ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/406/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/406/input.js000066400000000000000000000000051377064615700275030ustar00rootroot00000000000000if.a;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/406/options.json000066400000000000000000000000711377064615700303770ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \"(\" (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/407/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/407/input.js000066400000000000000000000000051377064615700275040ustar00rootroot00000000000000a if;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/407/options.json000066400000000000000000000000711377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/408/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/408/input.js000066400000000000000000000000101377064615700275010ustar00rootroot00000000000000a class;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/408/options.json000066400000000000000000000000711377064615700304010ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/409/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/409/input.js000066400000000000000000000000061377064615700275070ustar00rootroot00000000000000break babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json000066400000000000000000000010611377064615700302470ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/41/000077500000000000000000000000001377064615700257265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/41/input.js000066400000000000000000000000421377064615700274170ustar00rootroot00000000000000x = { set null(w) { m_null = w } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/41/output.json000066400000000000000000000064331377064615700301670ustar00rootroot00000000000000{ "type": "File", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "program": { "type": "Program", "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":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}}, "method": false, "key": { "type": "Identifier", "start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"null"}, "name": "null" }, "computed": false, "kind": "set", "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":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "m_null" }, "right": { "type": "Identifier", "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"w"}, "name": "w" } } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/410/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/410/input.js000066400000000000000000000000101377064615700274720ustar00rootroot00000000000000break 1;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/410/options.json000066400000000000000000000000511377064615700303700ustar00rootroot00000000000000{ "throws": "Unexpected token (1:6)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/411/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/411/input.js000066400000000000000000000000111377064615700274740ustar00rootroot00000000000000continue babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json000066400000000000000000000010671377064615700302460ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/412/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/412/input.js000066400000000000000000000000131377064615700274770ustar00rootroot00000000000000continue 2;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/412/options.json000066400000000000000000000000511377064615700303720ustar00rootroot00000000000000{ "throws": "Unexpected token (1:9)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/413/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/413/input.js000066400000000000000000000000051377064615700275010ustar00rootroot00000000000000throwbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/413/options.json000066400000000000000000000000511377064615700303730ustar00rootroot00000000000000{ "throws": "Unexpected token (1:5)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/414/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/414/input.js000066400000000000000000000000061377064615700275030ustar00rootroot00000000000000throw;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/414/options.json000066400000000000000000000000511377064615700303740ustar00rootroot00000000000000{ "throws": "Unexpected token (1:5)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/415/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/415/input.js000066400000000000000000000000261377064615700275060ustar00rootroot00000000000000for (var i, i2 in {});babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/415/options.json000066400000000000000000000000721377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:15)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/416/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/416/input.js000066400000000000000000000000201377064615700275010ustar00rootroot00000000000000for ((i in {}));babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/416/options.json000066400000000000000000000000721377064615700304010ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \";\" (1:14)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/417/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/417/input.js000066400000000000000000000000221377064615700275040ustar00rootroot00000000000000for (i + 1 in {});babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json000066400000000000000000000031131377064615700302460ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/418/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/418/input.js000066400000000000000000000000171377064615700275110ustar00rootroot00000000000000for (+i in {});babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json000066400000000000000000000025101377064615700302470ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/419/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/419/input.js000066400000000000000000000000111377064615700275040ustar00rootroot00000000000000if(false)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/419/options.json000066400000000000000000000000511377064615700304010ustar00rootroot00000000000000{ "throws": "Unexpected token (1:9)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/42/000077500000000000000000000000001377064615700257275ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/42/input.js000066400000000000000000000000441377064615700274220ustar00rootroot00000000000000x = { set "null"(w) { m_null = w } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/42/output.json000066400000000000000000000066071377064615700301730ustar00rootroot00000000000000{ "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": "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": "ObjectMethod", "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}}, "extra": { "rawValue": "null", "raw": "\"null\"" }, "value": "null" }, "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":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "m_null" }, "right": { "type": "Identifier", "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"w"}, "name": "w" } } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/420/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/420/input.js000066400000000000000000000000301377064615700274750ustar00rootroot00000000000000if(false) doThis(); elsebabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/420/options.json000066400000000000000000000000521377064615700303720ustar00rootroot00000000000000{ "throws": "Unexpected token (1:24)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/421/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/421/input.js000066400000000000000000000000021377064615700274750ustar00rootroot00000000000000dobabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/421/options.json000066400000000000000000000000511377064615700303720ustar00rootroot00000000000000{ "throws": "Unexpected token (1:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/422/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/422/input.js000066400000000000000000000000141377064615700275010ustar00rootroot00000000000000while(false)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/422/options.json000066400000000000000000000000521377064615700303740ustar00rootroot00000000000000{ "throws": "Unexpected token (1:12)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/423/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/423/input.js000066400000000000000000000000071377064615700275040ustar00rootroot00000000000000for(;;)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/423/options.json000066400000000000000000000000511377064615700303740ustar00rootroot00000000000000{ "throws": "Unexpected token (1:7)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/424/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/424/input.js000066400000000000000000000000071377064615700275050ustar00rootroot00000000000000with(x)babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/424/options.json000066400000000000000000000000511377064615700303750ustar00rootroot00000000000000{ "throws": "Unexpected token (1:7)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/425/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/425/input.js000066400000000000000000000000071377064615700275060ustar00rootroot00000000000000try { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json000066400000000000000000000014541377064615700302530ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/426/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/426/input.js000066400000000000000000000000101377064615700275010ustar00rootroot00000000000000‿ = 10babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/426/options.json000066400000000000000000000000631377064615700304020ustar00rootroot00000000000000{ "throws": "Unexpected character '‿' (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/427/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/427/input.js000066400000000000000000000000401377064615700275050ustar00rootroot00000000000000switch (c) { default: default: }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json000066400000000000000000000023031377064615700302470ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/428/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/428/input.js000066400000000000000000000000131377064615700275060ustar00rootroot00000000000000new X()."s"babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/428/options.json000066400000000000000000000000511377064615700304010ustar00rootroot00000000000000{ "throws": "Unexpected token (1:8)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/429/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/429/input.js000066400000000000000000000000021377064615700275050ustar00rootroot00000000000000/*babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/429/options.json000066400000000000000000000000551377064615700304060ustar00rootroot00000000000000{ "throws": "Unterminated comment (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/43/000077500000000000000000000000001377064615700257305ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/43/input.js000066400000000000000000000000401377064615700274170ustar00rootroot00000000000000x = { set 10(w) { m_null = w } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/43/output.json000066400000000000000000000065721377064615700301750ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "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":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}}, "method": false, "key": { "type": "NumericLiteral", "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "extra": { "rawValue": 10, "raw": "10" }, "value": 10 }, "computed": false, "kind": "set", "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":"w"}, "name": "w" } ], "body": { "type": "BlockStatement", "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}}, "expression": { "type": "AssignmentExpression", "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"}, "name": "m_null" }, "right": { "type": "Identifier", "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"w"}, "name": "w" } } } ], "directives": [] } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/430/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/430/input.js000066400000000000000000000000051377064615700275000ustar00rootroot00000000000000/* babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/430/options.json000066400000000000000000000000551377064615700303760ustar00rootroot00000000000000{ "throws": "Unterminated comment (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/431/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/431/input.js000066400000000000000000000000031377064615700274770ustar00rootroot00000000000000/**babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/431/options.json000066400000000000000000000000551377064615700303770ustar00rootroot00000000000000{ "throws": "Unterminated comment (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/432/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/432/input.js000066400000000000000000000000051377064615700275020ustar00rootroot00000000000000/* *babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/432/options.json000066400000000000000000000000551377064615700304000ustar00rootroot00000000000000{ "throws": "Unterminated comment (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/433/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/433/input.js000066400000000000000000000000071377064615700275050ustar00rootroot00000000000000/*hellobabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/433/options.json000066400000000000000000000000551377064615700304010ustar00rootroot00000000000000{ "throws": "Unterminated comment (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/434/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/434/input.js000066400000000000000000000000121377064615700275020ustar00rootroot00000000000000/*hello *babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/434/options.json000066400000000000000000000000551377064615700304020ustar00rootroot00000000000000{ "throws": "Unterminated comment (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/435/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/435/input.js000066400000000000000000000000021377064615700275020ustar00rootroot00000000000000 ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/435/options.json000066400000000000000000000000511377064615700303770ustar00rootroot00000000000000{ "throws": "Unexpected token (2:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/436/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/436/input.js000066400000000000000000000000021377064615700275030ustar00rootroot00000000000000 ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/436/options.json000066400000000000000000000000511377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected token (2:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/437/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/437/input.js000066400000000000000000000000021377064615700275040ustar00rootroot00000000000000 ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/437/options.json000066400000000000000000000000511377064615700304010ustar00rootroot00000000000000{ "throws": "Unexpected token (2:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/438/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/438/input.js000066400000000000000000000000031377064615700275060ustar00rootroot00000000000000 ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/438/options.json000066400000000000000000000000511377064615700304020ustar00rootroot00000000000000{ "throws": "Unexpected token (3:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/439/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/439/input.js000066400000000000000000000000041377064615700275100ustar00rootroot00000000000000// ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/439/options.json000066400000000000000000000000511377064615700304030ustar00rootroot00000000000000{ "throws": "Unexpected token (2:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/44/000077500000000000000000000000001377064615700257315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/44/input.js000066400000000000000000000000171377064615700274240ustar00rootroot00000000000000x = { get: 42 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/44/output.json000066400000000000000000000036721377064615700301740ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/440/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/440/input.js000066400000000000000000000000051377064615700275010ustar00rootroot00000000000000// ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/440/options.json000066400000000000000000000000511377064615700303730ustar00rootroot00000000000000{ "throws": "Unexpected token (3:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/441/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/441/input.js000066400000000000000000000000051377064615700275020ustar00rootroot00000000000000/a\ /babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/441/options.json000066400000000000000000000000701377064615700303750ustar00rootroot00000000000000{ "throws": "Unterminated regular expression (1:1)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/442/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/442/input.js000066400000000000000000000000061377064615700275040ustar00rootroot00000000000000// ]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/442/options.json000066400000000000000000000000511377064615700303750ustar00rootroot00000000000000{ "throws": "Unexpected token (3:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/443/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/443/input.js000066400000000000000000000000061377064615700275050ustar00rootroot00000000000000/* */]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/443/options.json000066400000000000000000000000511377064615700303760ustar00rootroot00000000000000{ "throws": "Unexpected token (2:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/444/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/444/input.js000066400000000000000000000000071377064615700275070ustar00rootroot00000000000000/* */]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/444/options.json000066400000000000000000000000511377064615700303770ustar00rootroot00000000000000{ "throws": "Unexpected token (3:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/445/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/445/input.js000066400000000000000000000000101377064615700275020ustar00rootroot00000000000000/* */]babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/445/options.json000066400000000000000000000000511377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected token (3:2)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/446/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/446/input.js000066400000000000000000000000021377064615700275040ustar00rootroot00000000000000\\babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json000066400000000000000000000015221377064615700302520ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/447/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/447/input.js000066400000000000000000000000061377064615700275110ustar00rootroot00000000000000\u005cbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json000066400000000000000000000013631377064615700302560ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/448/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/448/input.js000066400000000000000000000000021377064615700275060ustar00rootroot00000000000000\xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json000066400000000000000000000014101377064615700302500ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/449/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/449/input.js000066400000000000000000000000061377064615700275130ustar00rootroot00000000000000\u0000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json000066400000000000000000000013731377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/45/000077500000000000000000000000001377064615700257325ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/45/input.js000066400000000000000000000000171377064615700274250ustar00rootroot00000000000000x = { set: 43 }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/45/output.json000066400000000000000000000036721377064615700301750ustar00rootroot00000000000000{ "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": "AssignmentExpression", "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"}, "name": "x" }, "right": { "type": "ObjectExpression", "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}}, "method": false, "key": { "type": "Identifier", "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}}, "extra": { "rawValue": 43, "raw": "43" }, "value": 43 } } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/450/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/450/input.js000066400000000000000000000000101377064615700274760ustar00rootroot00000000000000‌ = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/450/options.json000066400000000000000000000000631377064615700303770ustar00rootroot00000000000000{ "throws": "Unexpected character '‌' (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/451/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/451/input.js000066400000000000000000000000101377064615700274770ustar00rootroot00000000000000‍ = []babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/451/options.json000066400000000000000000000000631377064615700304000ustar00rootroot00000000000000{ "throws": "Unexpected character '‍' (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/452/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/452/input.js000066400000000000000000000000021377064615700275010ustar00rootroot00000000000000"\babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/452/options.json000066400000000000000000000000651377064615700304030ustar00rootroot00000000000000{ "throws": "Unterminated string constant (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/453/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/453/input.js000066400000000000000000000000031377064615700275030ustar00rootroot00000000000000"\ubabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json000066400000000000000000000000651377064615700304040ustar00rootroot00000000000000{ "throws": "Unterminated string constant (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/454/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/454/input.js000066400000000000000000000000061377064615700275070ustar00rootroot00000000000000returnbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json000066400000000000000000000011001377064615700302410ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/455/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/455/input.js000066400000000000000000000000051377064615700275070ustar00rootroot00000000000000breakbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json000066400000000000000000000010611377064615700302500ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/456/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/456/input.js000066400000000000000000000000101377064615700275040ustar00rootroot00000000000000continuebabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json000066400000000000000000000010671377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/457/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/457/input.js000066400000000000000000000000411377064615700275110ustar00rootroot00000000000000switch (x) { default: continue; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json000066400000000000000000000023111377064615700302510ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/458/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/458/input.js000066400000000000000000000000121377064615700275100ustar00rootroot00000000000000do { x } *babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/458/options.json000066400000000000000000000000751377064615700304120ustar00rootroot00000000000000{ "throws": "Unexpected token, expected \"while\" (1:9)" } babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/459/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/459/input.js000066400000000000000000000000311377064615700275120ustar00rootroot00000000000000while (true) { break x; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json000066400000000000000000000025171377064615700302630ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/46/000077500000000000000000000000001377064615700257335ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/46/input.js000066400000000000000000000000261377064615700274260ustar00rootroot00000000000000/* block comment */ 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/46/output.json000066400000000000000000000022521377064615700301670ustar00rootroot00000000000000{ "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":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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 }, "leadingComments": [ { "type": "CommentBlock", "value": " block comment ", "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": " block comment ", "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/460/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/460/input.js000066400000000000000000000000341377064615700275050ustar00rootroot00000000000000while (true) { continue x; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json000066400000000000000000000025251377064615700302520ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/461/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/461/input.js000066400000000000000000000000571377064615700275130ustar00rootroot00000000000000x: while (true) { (function () { break x; }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json000066400000000000000000000053401377064615700302510ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/462/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/462/input.js000066400000000000000000000000621377064615700275100ustar00rootroot00000000000000x: while (true) { (function () { continue x; }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json000066400000000000000000000053461377064615700302600ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/463/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/463/input.js000066400000000000000000000000551377064615700275130ustar00rootroot00000000000000x: while (true) { (function () { break; }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json000066400000000000000000000047531377064615700302620ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/464/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/464/input.js000066400000000000000000000000601377064615700275100ustar00rootroot00000000000000x: while (true) { (function () { continue; }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json000066400000000000000000000047611377064615700302620ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/465/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/465/input.js000066400000000000000000000000471377064615700275160ustar00rootroot00000000000000x: while (true) { x: while (true) { } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json000066400000000000000000000046661377064615700302670ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/466/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/466/input.js000066400000000000000000000000531377064615700275140ustar00rootroot00000000000000(function () { 'use strict'; delete i; }())babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json000066400000000000000000000052601377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/467/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/467/input.js000066400000000000000000000000531377064615700275150ustar00rootroot00000000000000(function () { 'use strict'; with (i); }())babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json000066400000000000000000000050701377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/468/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/468/input.js000066400000000000000000000000601377064615700275140ustar00rootroot00000000000000function hello() {'use strict'; var eval = 10; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json000066400000000000000000000051501377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/469/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/469/input.js000066400000000000000000000000651377064615700275220ustar00rootroot00000000000000function hello() {'use strict'; var arguments = 10; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json000066400000000000000000000051671377064615700302700ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/47/000077500000000000000000000000001377064615700257345ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/47/input.js000066400000000000000000000000251377064615700274260ustar00rootroot0000000000000042 /*The*/ /*Answer*/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/47/output.json000066400000000000000000000027551377064615700302000ustar00rootroot00000000000000{ "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": "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": 42, "raw": "42" }, "value": 42 }, "trailingComments": [ { "type": "CommentBlock", "value": "The", "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}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "The", "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/470/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/470/input.js000066400000000000000000000000721377064615700275100ustar00rootroot00000000000000function hello() {'use strict'; try { } catch (eval) { } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json000066400000000000000000000052771377064615700302620ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/471/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/471/input.js000066400000000000000000000000771377064615700275160ustar00rootroot00000000000000function hello() {'use strict'; try { } catch (arguments) { } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json000066400000000000000000000053161377064615700302550ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/472/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/472/input.js000066400000000000000000000000541377064615700275120ustar00rootroot00000000000000function hello() {'use strict'; eval = 10; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json000066400000000000000000000050601377064615700302520ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/473/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/473/input.js000066400000000000000000000000611377064615700275110ustar00rootroot00000000000000function hello() {'use strict'; arguments = 10; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json000066400000000000000000000050771377064615700302630ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/474/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/474/input.js000066400000000000000000000000511377064615700275110ustar00rootroot00000000000000function hello() {'use strict'; ++eval; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json000066400000000000000000000043701377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/475/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/475/input.js000066400000000000000000000000511377064615700275120ustar00rootroot00000000000000function hello() {'use strict'; --eval; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json000066400000000000000000000043701377064615700302600ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/476/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/476/input.js000066400000000000000000000000561377064615700275200ustar00rootroot00000000000000function hello() {'use strict'; ++arguments; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json000066400000000000000000000044071377064615700302620ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/477/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/477/input.js000066400000000000000000000000561377064615700275210ustar00rootroot00000000000000function hello() {'use strict'; --arguments; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json000066400000000000000000000044071377064615700302630ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/478/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/478/input.js000066400000000000000000000000511377064615700275150ustar00rootroot00000000000000function hello() {'use strict'; eval++; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json000066400000000000000000000043711377064615700302640ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/479/000077500000000000000000000000001377064615700260255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/479/input.js000066400000000000000000000000511377064615700275160ustar00rootroot00000000000000function hello() {'use strict'; eval--; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json000066400000000000000000000043711377064615700302650ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/48/000077500000000000000000000000001377064615700257355ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/48/input.js000066400000000000000000000000251377064615700274270ustar00rootroot0000000000000042 /*the*/ /*answer*/babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/48/output.json000066400000000000000000000027551377064615700302010ustar00rootroot00000000000000{ "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": "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": 42, "raw": "42" }, "value": 42 }, "trailingComments": [ { "type": "CommentBlock", "value": "the", "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}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "the", "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}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/480/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/480/input.js000066400000000000000000000000561377064615700275130ustar00rootroot00000000000000function hello() {'use strict'; arguments++; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json000066400000000000000000000044101377064615700302470ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/481/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/481/input.js000066400000000000000000000000561377064615700275140ustar00rootroot00000000000000function hello() {'use strict'; arguments--; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json000066400000000000000000000044101377064615700302500ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/482/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/482/input.js000066400000000000000000000000651377064615700275150ustar00rootroot00000000000000function hello() {'use strict'; function eval() { } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json000066400000000000000000000044631377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/483/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/483/input.js000066400000000000000000000000721377064615700275140ustar00rootroot00000000000000function hello() {'use strict'; function arguments() { } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json000066400000000000000000000045021377064615700302540ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/484/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/484/input.js000066400000000000000000000000401377064615700275100ustar00rootroot00000000000000function eval() {'use strict'; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json000066400000000000000000000030641377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/485/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/485/input.js000066400000000000000000000000451377064615700275160ustar00rootroot00000000000000function arguments() {'use strict'; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json000066400000000000000000000031031377064615700302520ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/486/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/486/input.js000066400000000000000000000000711377064615700275160ustar00rootroot00000000000000function hello() {'use strict'; (function eval() { }()) }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json000066400000000000000000000056201377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/487/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/487/input.js000066400000000000000000000000761377064615700275240ustar00rootroot00000000000000function hello() {'use strict'; (function arguments() { }()) }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json000066400000000000000000000056371377064615700302720ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/488/000077500000000000000000000000001377064615700260255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/488/input.js000066400000000000000000000000441377064615700275200ustar00rootroot00000000000000(function eval() {'use strict'; })()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json000066400000000000000000000042011377064615700302550ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/489/000077500000000000000000000000001377064615700260265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/489/input.js000066400000000000000000000000511377064615700275170ustar00rootroot00000000000000(function arguments() {'use strict'; })()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json000066400000000000000000000042201377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/49/000077500000000000000000000000001377064615700257365ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/49/input.js000066400000000000000000000000541377064615700274320ustar00rootroot00000000000000/* multiline comment should be ignored */ 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/49/output.json000066400000000000000000000023361377064615700301750ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 }, "leadingComments": [ { "type": "CommentBlock", "value": " multiline\ncomment\nshould\nbe\nignored ", "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": " multiline\ncomment\nshould\nbe\nignored ", "start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":10}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/490/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/490/input.js000066400000000000000000000000771377064615700275170ustar00rootroot00000000000000function hello() {'use strict'; ({ s: function eval() { } }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json000066400000000000000000000070471377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/491/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/491/input.js000066400000000000000000000000471377064615700275150ustar00rootroot00000000000000(function package() {'use strict'; })()babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json000066400000000000000000000042121377064615700302510ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/492/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/492/input.js000066400000000000000000000000771377064615700275210ustar00rootroot00000000000000function hello() {'use strict'; ({ i: 10, set s(eval) { } }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json000066400000000000000000000104361377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/493/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/493/input.js000066400000000000000000000000701377064615700275130ustar00rootroot00000000000000function hello() {'use strict'; ({ set s(eval) { } }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json000066400000000000000000000065441377064615700302650ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/494/000077500000000000000000000000001377064615700260225ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/494/input.js000066400000000000000000000001001377064615700275060ustar00rootroot00000000000000function hello() {'use strict'; ({ s: function s(eval) { } }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json000066400000000000000000000075201377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/495/000077500000000000000000000000001377064615700260235ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/495/input.js000066400000000000000000000000441377064615700275160ustar00rootroot00000000000000function hello(eval) {'use strict';}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json000066400000000000000000000034221377064615700302570ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/496/000077500000000000000000000000001377064615700260245ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/496/input.js000066400000000000000000000000511377064615700275150ustar00rootroot00000000000000function hello(arguments) {'use strict';}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json000066400000000000000000000034411377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/497/000077500000000000000000000000001377064615700260255ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/497/input.js000066400000000000000000000000721377064615700275210ustar00rootroot00000000000000function hello() { 'use strict'; function inner(eval) {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json000066400000000000000000000050641377064615700302650ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/498/000077500000000000000000000000001377064615700260265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/498/input.js000066400000000000000000000000771377064615700275270ustar00rootroot00000000000000function hello() { 'use strict'; function inner(arguments) {} }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json000066400000000000000000000051031377064615700302600ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/5/000077500000000000000000000000001377064615700256465ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/5/input.js000066400000000000000000000000101377064615700273320ustar00rootroot00000000000000/[a-z]/gbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/5/output.json000066400000000000000000000013731377064615700301050ustar00rootroot00000000000000{ "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": "RegExpLiteral", "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "extra": { "raw": "/[a-z]/g" }, "pattern": "[a-z]", "flags": "g" } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/50/000077500000000000000000000000001377064615700257265ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/50/input.js000066400000000000000000000000121377064615700274140ustar00rootroot00000000000000/*a b*/ 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/50/output.json000066400000000000000000000022101377064615700301540ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 }, "leadingComments": [ { "type": "CommentBlock", "value": "a\nb", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "a\nb", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/500/000077500000000000000000000000001377064615700260065ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/500/input.js000066400000000000000000000000471377064615700275040ustar00rootroot00000000000000function hello() { 'use strict'; 021; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json000066400000000000000000000041251377064615700302430ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/502/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/502/input.js000066400000000000000000000000611377064615700275020ustar00rootroot00000000000000function hello() { 'use strict'; ({ 021: 42 }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json000066400000000000000000000062471377064615700302540ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/504/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/504/input.js000066400000000000000000000000621377064615700275050ustar00rootroot00000000000000function hello() { "use strict"; var implements; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json000066400000000000000000000044641377064615700302550ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/505/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/505/input.js000066400000000000000000000000611377064615700275050ustar00rootroot00000000000000function hello() { "use strict"; var interface; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json000066400000000000000000000044611377064615700302530ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/506/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/506/input.js000066400000000000000000000000571377064615700275130ustar00rootroot00000000000000function hello() { "use strict"; var package; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json000066400000000000000000000044531377064615700302550ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/507/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/507/input.js000066400000000000000000000000571377064615700275140ustar00rootroot00000000000000function hello() { "use strict"; var private; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json000066400000000000000000000044531377064615700302560ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/508/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/508/input.js000066400000000000000000000000611377064615700275100ustar00rootroot00000000000000function hello() { "use strict"; var protected; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json000066400000000000000000000044611377064615700302560ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/509/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/509/input.js000066400000000000000000000000561377064615700275150ustar00rootroot00000000000000function hello() { "use strict"; var public; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json000066400000000000000000000044501377064615700302550ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/51/000077500000000000000000000000001377064615700257275ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/51/input.js000066400000000000000000000000121377064615700274150ustar00rootroot00000000000000/*a b*/ 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/51/output.json000066400000000000000000000022101377064615700301550ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 }, "leadingComments": [ { "type": "CommentBlock", "value": "a\rb", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "a\rb", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/510/000077500000000000000000000000001377064615700260075ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/510/input.js000066400000000000000000000000561377064615700275050ustar00rootroot00000000000000function hello() { "use strict"; var static; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json000066400000000000000000000044501377064615700302450ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/511/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/511/input.js000066400000000000000000000000501377064615700275000ustar00rootroot00000000000000function hello(static) { "use strict"; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json000066400000000000000000000034321377064615700302450ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/512/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/512/input.js000066400000000000000000000000431377064615700275030ustar00rootroot00000000000000function static() { "use strict"; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json000066400000000000000000000030741377064615700302500ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/513/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/513/input.js000066400000000000000000000000431377064615700275040ustar00rootroot00000000000000"use strict"; function static() { }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json000066400000000000000000000027531377064615700302540ustar00rootroot00000000000000{ "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/514/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/514/input.js000066400000000000000000000000421377064615700275040ustar00rootroot00000000000000function a(t, t) { "use strict"; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json000066400000000000000000000037111377064615700302500ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/515/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/515/input.js000066400000000000000000000000421377064615700275050ustar00rootroot00000000000000function a(eval) { "use strict"; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json000066400000000000000000000034141377064615700302510ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/516/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/516/input.js000066400000000000000000000000451377064615700275110ustar00rootroot00000000000000function a(package) { "use strict"; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json000066400000000000000000000034251377064615700302540ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/517/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/517/input.js000066400000000000000000000000641377064615700275130ustar00rootroot00000000000000function a() { "use strict"; function b(t, t) { }; }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json000066400000000000000000000056541377064615700302630ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/518/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/518/input.js000066400000000000000000000000441377064615700275120ustar00rootroot00000000000000(function a(t, t) { "use strict"; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json000066400000000000000000000044451377064615700302610ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/519/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/519/input.js000066400000000000000000000000661377064615700275170ustar00rootroot00000000000000function a() { "use strict"; (function b(t, t) { }); }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json000066400000000000000000000061621377064615700302600ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/52/000077500000000000000000000000001377064615700257305ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/52/input.js000066400000000000000000000000121377064615700274160ustar00rootroot00000000000000/*a b*/ 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/52/output.json000066400000000000000000000022101377064615700301560ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 }, "leadingComments": [ { "type": "CommentBlock", "value": "a\nb", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "a\nb", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/520/000077500000000000000000000000001377064615700260105ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/520/input.js000066400000000000000000000000441377064615700275030ustar00rootroot00000000000000(function a(eval) { "use strict"; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json000066400000000000000000000041361377064615700302470ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/521/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/521/input.js000066400000000000000000000000471377064615700275070ustar00rootroot00000000000000(function a(package) { "use strict"; })babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json000066400000000000000000000041471377064615700302520ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/522/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/522/input.js000066400000000000000000000001051377064615700275030ustar00rootroot00000000000000"use strict";function foo(){"use strict";}function bar(){var v = 015}babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json000066400000000000000000000073011377064615700302460ustar00rootroot00000000000000{ "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" } } } ] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/523/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/523/input.js000066400000000000000000000000161377064615700275050ustar00rootroot00000000000000var this = 10;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json000066400000000000000000000024401377064615700302460ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/524/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/524/input.js000066400000000000000000000000111377064615700275010ustar00rootroot00000000000000throw 10;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json000066400000000000000000000014641377064615700302540ustar00rootroot00000000000000{ "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": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/525/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/525/input.js000066400000000000000000000000051377064615700275050ustar00rootroot00000000000000let xbabel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/525/output.json000066400000000000000000000016621377064615700302550ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"}, "name": "x" }, "init": null } ], "kind": "let" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/526/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/526/input.js000066400000000000000000000000111377064615700275030ustar00rootroot00000000000000let x, y;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/526/output.json000066400000000000000000000025101377064615700302470ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "id": { "type": "Identifier", "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"y"}, "name": "y" }, "init": null } ], "kind": "let" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/527/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/527/input.js000066400000000000000000000000121377064615700275050ustar00rootroot00000000000000let x = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/527/output.json000066400000000000000000000023221377064615700302510ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ], "kind": "let" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/528/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/528/input.js000066400000000000000000000000351377064615700275130ustar00rootroot00000000000000let eval = 42, arguments = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/528/output.json000066400000000000000000000036421377064615700302600ustar00rootroot00000000000000{ "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": "script", "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":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"}, "name": "eval" }, "init": { "type": "NumericLiteral", "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, { "type": "VariableDeclarator", "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"}, "name": "arguments" }, "init": { "type": "NumericLiteral", "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ], "kind": "let" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/529/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/529/input.js000066400000000000000000000000331377064615700275120ustar00rootroot00000000000000let x = 14, y = 3, z = 1977babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/529/output.json000066400000000000000000000051051377064615700302550ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 14, "raw": "14" }, "value": 14 } }, { "type": "VariableDeclarator", "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"}, "name": "y" }, "init": { "type": "NumericLiteral", "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 } }, { "type": "VariableDeclarator", "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"}, "name": "z" }, "init": { "type": "NumericLiteral", "start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}, "extra": { "rawValue": 1977, "raw": "1977" }, "value": 1977 } } ], "kind": "let" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/53/000077500000000000000000000000001377064615700257315ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/53/input.js000066400000000000000000000000121377064615700274170ustar00rootroot00000000000000/*a c*/ 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/53/output.json000066400000000000000000000022101377064615700301570ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ExpressionStatement", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 }, "leadingComments": [ { "type": "CommentBlock", "value": "a\nc", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "a\nc", "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":3}} } ] }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/530/000077500000000000000000000000001377064615700260115ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/530/input.js000066400000000000000000000000211377064615700274770ustar00rootroot00000000000000for(let x = 0;;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/530/output.json000066400000000000000000000031531377064615700302460ustar00rootroot00000000000000{ "type": "File", "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}}, "sourceType": "script", "interpreter": null, "body": [ { "type": "ForStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": { "type": "NumericLiteral", "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } ], "kind": "let" }, "test": null, "update": null, "body": { "type": "EmptyStatement", "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/531/000077500000000000000000000000001377064615700260125ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/531/input.js000066400000000000000000000000301377064615700275000ustar00rootroot00000000000000for(let x = 0, y = 1;;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/531/output.json000066400000000000000000000045041377064615700302500ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": { "type": "NumericLiteral", "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, { "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":"y"}, "name": "y" }, "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": "let" }, "test": null, "update": null, "body": { "type": "EmptyStatement", "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/532/000077500000000000000000000000001377064615700260135ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/532/input.js000066400000000000000000000000371377064615700275100ustar00rootroot00000000000000for (let x in list) process(x);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/532/output.json000066400000000000000000000042311377064615700302460ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "ForInStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": null } ], "kind": "let" }, "right": { "type": "Identifier", "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}}, "expression": { "type": "CallExpression", "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"}, "name": "process" }, "arguments": [ { "type": "Identifier", "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"x"}, "name": "x" } ] } } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/533/000077500000000000000000000000001377064615700260145ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/533/input.js000066400000000000000000000000141377064615700275040ustar00rootroot00000000000000const x = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/533/output.json000066400000000000000000000023261377064615700302520ustar00rootroot00000000000000{ "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": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ], "kind": "const" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/534/000077500000000000000000000000001377064615700260155ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/534/input.js000066400000000000000000000000371377064615700275120ustar00rootroot00000000000000const eval = 42, arguments = 42babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/534/output.json000066400000000000000000000036461377064615700302610ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } }, { "type": "VariableDeclarator", "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"}, "name": "arguments" }, "init": { "type": "NumericLiteral", "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}}, "extra": { "rawValue": 42, "raw": "42" }, "value": 42 } } ], "kind": "const" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/535/000077500000000000000000000000001377064615700260165ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/535/input.js000066400000000000000000000000351377064615700275110ustar00rootroot00000000000000const x = 14, y = 3, z = 1977babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/535/output.json000066400000000000000000000051111377064615700302470ustar00rootroot00000000000000{ "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": "script", "interpreter": null, "body": [ { "type": "VariableDeclaration", "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}}, "id": { "type": "Identifier", "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}}, "extra": { "rawValue": 14, "raw": "14" }, "value": 14 } }, { "type": "VariableDeclarator", "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"}, "name": "y" }, "init": { "type": "NumericLiteral", "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}}, "extra": { "rawValue": 3, "raw": "3" }, "value": 3 } }, { "type": "VariableDeclarator", "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"}, "name": "z" }, "init": { "type": "NumericLiteral", "start":25,"end":29,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":29}}, "extra": { "rawValue": 1977, "raw": "1977" }, "value": 1977 } } ], "kind": "const" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/536/000077500000000000000000000000001377064615700260175ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/536/input.js000066400000000000000000000000101377064615700275030ustar00rootroot00000000000000const a;babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/536/output.json000066400000000000000000000020231377064615700302470ustar00rootroot00000000000000{ "type": "File", "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "errors": [ "SyntaxError: Const declarations require an initialization value (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": "VariableDeclaration", "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, "declarations": [ { "type": "VariableDeclarator", "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":"a"}, "name": "a" }, "init": null } ], "kind": "const" } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/537/000077500000000000000000000000001377064615700260205ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/537/input.js000066400000000000000000000000231377064615700275100ustar00rootroot00000000000000for(const x = 0;;);babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/537/output.json000066400000000000000000000031631377064615700302560ustar00rootroot00000000000000{ "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": "ForStatement", "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}}, "declarations": [ { "type": "VariableDeclarator", "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"}, "name": "x" }, "init": { "type": "NumericLiteral", "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } ], "kind": "const" }, "test": null, "update": null, "body": { "type": "EmptyStatement", "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} } } ], "directives": [] } }babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/538/000077500000000000000000000000001377064615700260215ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/core/uncategorised/538/input.js000066400000000000000000000000061377064615700275120ustar00rootroot00000000000000 options.json000066400000000000000000000001031377064615700343610ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/es2015/modules/invalid-xml-comment-in-module{ "sourceType": "module", "throws": "Unexpected token (1:0)" } babel-7.12.12/packages/babel-parser/test/fixtures/es2015/modules/options.json000066400000000000000000000000351377064615700266710ustar00rootroot00000000000000{ "sourceType": "module" } babel-7.12.12/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-module/000077500000000000000000000000001377064615700304345ustar00rootroot00000000000000babel-7.12.12/packages/babel-parser/test/fixtures/es2015/modules/xml-comment-in-module/input.js000066400000000000000000000000141377064615700321240ustar00rootroot00000000000000foo