diff --git a/.gitignore b/.gitignore index 213ae9c36aa4..41847c7fd604 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,5 @@ typings/ .next .DS_Store -.vscode .idea dist diff --git a/.huskyrc b/.huskyrc new file mode 100644 index 000000000000..a3f3f7002ed4 --- /dev/null +++ b/.huskyrc @@ -0,0 +1,8 @@ +{ + "hooks": { + "pre-commit": [ + "yarn test && lint-staged" + ], + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } +} diff --git a/.lintstagedrc b/.lintstagedrc new file mode 100644 index 000000000000..889b734ac28f --- /dev/null +++ b/.lintstagedrc @@ -0,0 +1,6 @@ +{ + "*.{ts,js,json,md}": [ + "prettier --write", + "git add" + ] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000000..0a2e1c827047 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig" + ], + "unwantedRecommendations": ["hookyqr.beautify", "dbaeumer.jshint"] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000000..18bf27ada556 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Jest Test Current eslint-plugin Rule", + "cwd": "${workspaceFolder}/packages/eslint-plugin/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--colors", + "${workspaceFolder}/packages/eslint-plugin/tests/lib/rules/${fileBasename}" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000000..adcf2422e8f3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,26 @@ + +{ + // An array of language ids which should be validated by ESLint + "eslint.validate": [ + "javascript", + "javascriptreact", + { + "language": "typescript", + "autoFix": true + }, + { + "language": "typescriptreact", + "autoFix": true + } + ], + + // When enabled, will trim trailing whitespace when saving a file. + "files.trimTrailingWhitespace": true, + + // typescript auto-format settings + "typescript.tsdk": "node_modules/typescript/lib", + "javascript.preferences.importModuleSpecifier": "auto", + "typescript.preferences.importModuleSpecifier": "auto", + "javascript.preferences.quoteStyle": "single", + "typescript.preferences.quoteStyle": "single" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fbb5db67f5c..ccbbce028b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) + +### Bug Fixes + +- **eslint-plugin:** make parser services error clearer ([#132](https://github.com/typescript-eslint/typescript-eslint/issues/132)) ([aa9d1e1](https://github.com/typescript-eslint/typescript-eslint/commit/aa9d1e1)) +- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003)) +- **ts-estree:** expand optional property to include question token ([#138](https://github.com/typescript-eslint/typescript-eslint/issues/138)) ([9068b62](https://github.com/typescript-eslint/typescript-eslint/commit/9068b62)) + +### Performance Improvements + +- **ts-estree:** don't create Program in parse() ([#148](https://github.com/typescript-eslint/typescript-eslint/issues/148)) ([aacf5b0](https://github.com/typescript-eslint/typescript-eslint/commit/aacf5b0)) + # [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) ### Bug Fixes diff --git a/lerna.json b/lerna.json index 844b711bb0fe..06bbd031b2c8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.1.0", + "version": "1.1.1", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/package.json b/package.json index c7a27e9a643d..18059f7381ed 100644 --- a/package.json +++ b/package.json @@ -21,22 +21,14 @@ "test": "lerna run test --parallel", "build": "lerna run build", "clean": "lerna clean && lerna run clean", - "precommit": "yarn test && lint-staged", "lint": "eslint . --ext .js,.ts", "lint-fix": "eslint . --ext .js,.ts --fix", "cz": "git-cz", - "commitmsg": "commitlint -E GIT_PARAMS", "check-format": "prettier --list-different \"./**/*.{ts,js,json,md}\"", "format": "prettier --write \"./**/*.{ts,js,json,md}\"", "integration-tests": "docker-compose -f tests/integration/docker-compose.yml up", "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local" }, - "lint-staged": { - "*.{ts,js,json,md}": [ - "prettier --write", - "git add" - ] - }, "config": { "commitizen": { "path": "./node_modules/cz-conventional-changelog" @@ -65,13 +57,13 @@ "@types/semver": "^5.5.0", "cz-conventional-changelog": "2.1.0", "eslint": "^5.12.1", - "eslint-plugin-jest": "^22.1.3", "eslint-plugin-eslint-plugin": "^2.0.1", + "eslint-plugin-jest": "^22.1.3", "glob": "7.1.2", - "husky": "0.14.3", + "husky": "^1.3.1", "jest": "23.6.0", "lerna": "^3.10.5", - "lint-staged": "7.3.0", + "lint-staged": "8.1.0", "lodash.isplainobject": "4.0.6", "prettier": "^1.14.3", "rimraf": "^2.6.3", diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 6b4306f26855..46f2c1960d94 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + # [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index fbe9ea5521e0..b54084d620e4 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "1.1.0", + "version": "1.1.1", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -11,7 +11,7 @@ "tslint" ], "engines": { - "node": ">=6" + "node": "^6.14.0 || ^8.10.0 || >=9.10.0" }, "repository": "typescript-eslint/typescript-eslint", "bugs": { @@ -28,11 +28,12 @@ "lodash.memoize": "^4.1.2" }, "peerDependencies": { + "eslint": "^5.0.0", "tslint": "^5.0.0" }, "devDependencies": { "@types/eslint": "^4.16.3", "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "1.1.0" + "@typescript-eslint/parser": "1.1.1" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 39a512dab49e..992ae046dde3 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) + +### Bug Fixes + +- **eslint-plugin:** make parser services error clearer ([#132](https://github.com/typescript-eslint/typescript-eslint/issues/132)) ([aa9d1e1](https://github.com/typescript-eslint/typescript-eslint/commit/aa9d1e1)) +- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003)) + # [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) ### Bug Fixes diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 108dd0f994be..4f6f771d47c4 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -51,6 +51,23 @@ You can also enable all the recommended rules at once. Add `plugin:@typescript-e } ``` +If you want to use rules which require type information, you will need to specify a path to your tsconfig.json file in the "project" property of "parserOptions". + +```json +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "./tsconfig.json" + }, + "plugins": ["@typescript-eslint"], + "rules": { + "@typescript-eslint/restrict-plus-operands": "error" + } +} +``` + +See [@typescript-eslint/parser's README.md](../parser/README.md) for more information on the available "parserOptions". + ## Supported Rules @@ -59,41 +76,41 @@ You can also enable all the recommended rules at once. Add `plugin:@typescript-e **Key**: :heavy_check_mark: = recommended, :wrench: = fixable -| Name | Description | :heavy_check_mark: | :wrench: | -| ---- | ----------- | ------------------ | -------- | -| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive (`adjacent-overload-signatures` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays (`array-type` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Enforces that types will not to be used (`ban-types` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | -| [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names (`class-name` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | -| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods (`member-access` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/generic-type-naming`](./docs/rules/generic-type-naming.md) | Enforces naming of generic type variables | | | -| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation (`indent` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names be prefixed with `I` (`interface-name` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/member-naming`](./docs/rules/member-naming.md) | Enforces naming conventions for class members by visibility. | | | -| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order (`member-ordering` from TSLint) | | | -| [`@typescript-eslint/no-angle-bracket-type-assertion`](./docs/rules/no-angle-bracket-type-assertion.md) | Enforces the use of `as Type` assertions instead of `` assertions (`no-angle-bracket-type-assertion` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces (`no-empty-interface` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type (`no-any` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces (`no-unnecessary-class` from TSLint) | | | -| [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean. (`no-inferrable-types` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor`. (`no-misused-new` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces (`no-namespace` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator (`no-non-null-assertion` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-object-literal-type-assertion`](./docs/rules/no-object-literal-type-assertion.md) | Forbids an object literal to appear in a type assertion expression (`no-object-literal-type-assertion` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors. (`no-parameter-properties` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` (`no-this-assignment` from TSLint) | | | -| [`@typescript-eslint/no-triple-slash-reference`](./docs/rules/no-triple-slash-reference.md) | Disallow `/// ` comments (`no-reference` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases (`interface-over-type-literal` from TSLint) | | | -| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables (`no-unused-variable` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | -| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements (`no-var-requires` from TSLint) | :heavy_check_mark: | | -| [`@typescript-eslint/prefer-interface`](./docs/rules/prefer-interface.md) | Prefer an interface declaration over a type literal (type T = { ... }) (`interface-over-type-literal` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules. (`no-internal-module` from TSLint) | :heavy_check_mark: | :wrench: | -| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string. (`restrict-plus-operands` from TSLint) | | | -| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations (`typedef-whitespace` from TSLint) | :heavy_check_mark: | :wrench: | +| Name | Description | :heavy_check_mark: | :wrench: | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | +| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive (`adjacent-overload-signatures` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays (`array-type` from TSLint) | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Enforces that types will not to be used (`ban-types` from TSLint) | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | +| [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names (`class-name` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | +| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods (`member-access` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/generic-type-naming`](./docs/rules/generic-type-naming.md) | Enforces naming of generic type variables | | | +| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation (`indent` from TSLint) | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names be prefixed with `I` (`interface-name` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/member-naming`](./docs/rules/member-naming.md) | Enforces naming conventions for class members by visibility. | | | +| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order (`member-ordering` from TSLint) | | | +| [`@typescript-eslint/no-angle-bracket-type-assertion`](./docs/rules/no-angle-bracket-type-assertion.md) | Enforces the use of `as Type` assertions instead of `` assertions (`no-angle-bracket-type-assertion` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces (`no-empty-interface` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type (`no-any` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces (`no-unnecessary-class` from TSLint) | | | +| [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean. (`no-inferrable-types` from TSLint) | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor`. (`no-misused-new` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces (`no-namespace` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator (`no-non-null-assertion` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-object-literal-type-assertion`](./docs/rules/no-object-literal-type-assertion.md) | Forbids an object literal to appear in a type assertion expression (`no-object-literal-type-assertion` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors. (`no-parameter-properties` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` (`no-this-assignment` from TSLint) | | | +| [`@typescript-eslint/no-triple-slash-reference`](./docs/rules/no-triple-slash-reference.md) | Disallow `/// ` comments (`no-reference` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases (`interface-over-type-literal` from TSLint) | | | +| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables (`no-unused-variable` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | +| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements (`no-var-requires` from TSLint) | :heavy_check_mark: | | +| [`@typescript-eslint/prefer-interface`](./docs/rules/prefer-interface.md) | Prefer an interface declaration over a type literal (type T = { ... }) (`interface-over-type-literal` from TSLint) | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules. (`no-internal-module` from TSLint) | :heavy_check_mark: | :wrench: | +| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string. (`restrict-plus-operands` from TSLint) | | | +| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations (`typedef-whitespace` from TSLint) | :heavy_check_mark: | :wrench: | diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index eb0cf5e33ec4..1fce16992a9c 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -10,30 +10,30 @@ ### TypeScript-specific -| TSLint rule | | ESLint rule | -| --------------------------------- | :-: | -------------------------------------------- | -| [`adjacent-overload-signatures`] | ✅ | [`typescript/adjacent-overload-signatures`] | -| [`ban-types`] | ✅ | [`typescript/ban-types`] | -| [`member-access`] | ✅ | [`typescript/explicit-member-accessibility`] | -| [`member-ordering`] | ✅ | [`typescript/member-ordering`] | -| [`no-any`] | ✅ | [`typescript/no-explicit-any`] | -| [`no-empty-interface`] | ✅ | [`typescript/no-empty-interface`] | -| [`no-import-side-effect`] | 🔌 | [`import/no-unassigned-import`] | -| [`no-inferrable-types`] | ✅ | [`typescript/no-inferrable-types`] | -| [`no-internal-module`] | ✅ | [`typescript/prefer-namespace-keyword`] | -| [`no-magic-numbers`] | 🌟 | [`no-magic-numbers`][no-magic-numbers] | -| [`no-namespace`] | ✅ | [`typescript/no-namespace`] | -| [`no-non-null-assertion`] | ✅ | [`typescript/no-non-null-assertion`] | -| [`no-parameter-reassignment`] | ✅ | [`no-param-reassign`][no-param-reassign] | -| [`no-reference`] | ✅ | [`typescript/no-triple-slash-reference`] | -| [`no-unnecessary-type-assertion`] | 🛑 | N/A | -| [`no-var-requires`] | ✅ | [`typescript/no-var-requires`] | -| [`only-arrow-functions`] | 🔌 | [`prefer-arrow/prefer-arrow-functions`] | -| [`prefer-for-of`] | 🛑 | N/A | -| [`promise-function-async`] | 🛑 | N/A ([relevant plugin][plugin:promise]) | -| [`typedef`] | 🛑 | N/A | -| [`typedef-whitespace`] | ✅ | [`typescript/type-annotation-spacing`] | -| [`unified-signatures`] | 🛑 | N/A | +| TSLint rule | | ESLint rule | +| --------------------------------- | :-: | ---------------------------------------------------- | +| [`adjacent-overload-signatures`] | ✅ | [`@typescript-eslint/adjacent-overload-signatures`] | +| [`ban-types`] | ✅ | [`@typescript-eslint/ban-types`] | +| [`member-access`] | ✅ | [`@typescript-eslint/explicit-member-accessibility`] | +| [`member-ordering`] | ✅ | [`@typescript-eslint/member-ordering`] | +| [`no-any`] | ✅ | [`@typescript-eslint/no-explicit-any`] | +| [`no-empty-interface`] | ✅ | [`@typescript-eslint/no-empty-interface`] | +| [`no-import-side-effect`] | 🔌 | [`import/no-unassigned-import`] | +| [`no-inferrable-types`] | ✅ | [`@typescript-eslint/no-inferrable-types`] | +| [`no-internal-module`] | ✅ | [`@typescript-eslint/prefer-namespace-keyword`] | +| [`no-magic-numbers`] | 🌟 | [`no-magic-numbers`][no-magic-numbers] | +| [`no-namespace`] | ✅ | [`@typescript-eslint/no-namespace`] | +| [`no-non-null-assertion`] | ✅ | [`@typescript-eslint/no-non-null-assertion`] | +| [`no-parameter-reassignment`] | ✅ | [`no-param-reassign`][no-param-reassign] | +| [`no-reference`] | ✅ | [`@typescript-eslint/no-triple-slash-reference`] | +| [`no-unnecessary-type-assertion`] | 🛑 | N/A | +| [`no-var-requires`] | ✅ | [`@typescript-eslint/no-var-requires`] | +| [`only-arrow-functions`] | 🔌 | [`prefer-arrow/prefer-arrow-functions`] | +| [`prefer-for-of`] | 🛑 | N/A | +| [`promise-function-async`] | 🛑 | N/A ([relevant plugin][plugin:promise]) | +| [`typedef`] | 🛑 | N/A | +| [`typedef-whitespace`] | ✅ | [`@typescript-eslint/type-annotation-spacing`] | +| [`unified-signatures`] | 🛑 | N/A | ### Functionality @@ -64,9 +64,9 @@ | [`no-inferred-empty-object-type`] | 🛑 | N/A | | [`no-invalid-template-strings`] | 🌟 | [`no-template-curly-in-string`][no-template-curly-in-string] | | [`no-invalid-this`] | 🌟 | [`no-invalid-this`][no-invalid-this] | -| [`no-misused-new`] | ✅ | [`typescript/no-misused-new`] | +| [`no-misused-new`] | ✅ | [`@typescript-eslint/no-misused-new`] | | [`no-null-keyword`] | 🔌 | [`no-null/no-null`] (doesn’t handle `null` type) | -| [`no-object-literal-type-assertion`] | ✅ | [`typescript/no-object-literal-type-assertion`] | +| [`no-object-literal-type-assertion`] | ✅ | [`@typescript-eslint/no-object-literal-type-assertion`] | | [`no-return-await`] | 🌟 | [`no-return-await`][no-return-await] | | [`no-shadowed-variable`] | 🌟 | [`no-shadow`][no-shadow] | | [`no-sparse-arrays`] | 🌟 | [`no-sparse-arrays`][no-sparse-arrays] | @@ -74,14 +74,14 @@ | [`no-string-throw`] | 🌟 | [`no-throw-literal`][no-throw-literal] | | [`no-submodule-imports`] | 🌓 | [`import/no-internal-modules`] (slightly different) | | [`no-switch-case-fall-through`] | 🌟 | [`no-fallthrough`][no-fallthrough] | -| [`no-this-assignment`] | ✅ | [`typescript/no-this-alias`] | +| [`no-this-assignment`] | ✅ | [`@typescript-eslint/no-this-alias`] | | [`no-unbound-method`] | 🛑 | N/A | -| [`no-unnecessary-class`] | ✅ | [`typescript/no-extraneous-class`] | +| [`no-unnecessary-class`] | ✅ | [`@typescript-eslint/no-extraneous-class`] | | [`no-unsafe-any`] | 🛑 | N/A | | [`no-unsafe-finally`] | 🌟 | [`no-unsafe-finally`][no-unsafe-finally] | | [`no-unused-expression`] | 🌟 | [`no-unused-expression`][no-unused-expressions] | | [`no-unused-variable`] | 🌓 | [`no-unused-vars`][no-unused-vars] [2] | -| [`no-use-before-declare`] | ✅ | [`typescript/no-use-before-define`] | +| [`no-use-before-declare`] | ✅ | [`@typescript-eslint/no-use-before-define`] | | [`no-var-keyword`] | 🌟 | [`no-var`][no-var] | | [`no-void-expression`] | 🌟 | [`no-void`][no-void] | | [`prefer-conditional-expression`] | 🛑 | N/A | @@ -97,7 +97,7 @@ | [`use-isnan`] | 🌟 | [`use-isnan`][use-isnan] | [1] The ESLint rule also supports silencing with an extra set of parens (`if ((foo = bar)) {}`) -[2] Missing private class member support. [`typescript/no-unused-vars`] adds support for some TS-specific features. +[2] Missing private class member support. [`@typescript-eslint/no-unused-vars`] adds support for some TS-specific features. ### Maintainability @@ -106,7 +106,7 @@ | [`cyclomatic-complexity`] | 🌟 | [`complexity`][complexity] | | [`deprecation`] | 🌓 | [`import/no-deprecated`] [1] | | [`eofline`] | 🌟 | [`eol-last`][eol-last] | -| [`indent`] | ✅ | [`typescript/indent`] or [Prettier] | +| [`indent`] | ✅ | [`@typescript-eslint/indent`] or [Prettier] | | [`linebreak-style`] | 🌟 | [`linebreak-style`][linebreak-style] or [Prettier] | | [`max-classes-per-file`] | 🌟 | [`max-classes-per-file`][max-classes-per-file] | | [`max-file-line-count`] | 🌟 | [`max-lines`][max-lines] | @@ -128,30 +128,30 @@ | TSLint rule | | ESLint rule | | ----------------------------------- | :-: | ----------------------------------------------------------------------------------- | | [`align`] | 🛑 | N/A | -| [`array-type`] | ✅ | [`typescript/array-type`] | +| [`array-type`] | ✅ | [`@typescript-eslint/array-type`] | | [`arrow-parens`] | 🌟 | [`arrow-parens`][arrow-parens] | | [`arrow-return-shorthand`] | 🌟 | [`arrow-body-style`][arrow-body-style] | | [`binary-expression-operand-order`] | 🌟 | [`yoda`][yoda] | | [`callable-types`] | 🛑 | N/A | -| [`class-name`] | ✅ | [`typescript/class-name-casing`] | +| [`class-name`] | ✅ | [`@typescript-eslint/class-name-casing`] | | [`comment-format`] | 🌟 | [`capitalized-comments`][capitalized-comments] & [`spaced-comment`][spaced-comment] | | [`completed-docs`] | 🔌 | [`eslint-plugin-jsdoc`][plugin:jsdoc] | | [`encoding`] | 🛑 | N/A | | [`file-header`] | 🔌 | [`eslint-plugin-header`][plugin:header] or [`-file-header`][plugin:file-header] | | [`file-name-casing`] | 🔌 | [`unicorn/filename-case`] | | [`import-spacing`] | 🔌 | Use [Prettier] | -| [`interface-name`] | ✅ | [`typescript/interface-name-prefix`] | -| [`interface-over-type-literal`] | ✅ | [`typescript/prefer-interface`] | +| [`interface-name`] | ✅ | [`@typescript-eslint/interface-name-prefix`] | +| [`interface-over-type-literal`] | ✅ | [`@typescript-eslint/prefer-interface`] | | [`jsdoc-format`] | 🌓 | [`valid-jsdoc`][valid-jsdoc] or [`eslint-plugin-jsdoc`][plugin:jsdoc] | | [`match-default-export-name`] | 🛑 | N/A | | [`newline-before-return`] | 🌟 | [`padding-line-between-statements`][padding-line-between-statements] [1] | | [`newline-per-chained-call`] | 🌟 | [`newline-per-chained-call`][newline-per-chained-call] | | [`new-parens`] | 🌟 | [`new-parens`][new-parens] | -| [`no-angle-bracket-type-assertion`] | ✅ | [`typescript/no-angle-bracket-type-assertion`] | +| [`no-angle-bracket-type-assertion`] | ✅ | [`@typescript-eslint/no-angle-bracket-type-assertion`] | | [`no-boolean-literal-compare`] | 🛑 | N/A | | [`no-consecutive-blank-lines`] | 🌟 | [`no-multiple-empty-lines`][no-multiple-empty-lines] | | [`no-irregular-whitespace`] | 🌟 | [`no-irregular-whitespace`][no-irregular-whitespace] with `skipStrings: false` | -| [`no-parameter-properties`] | ✅ | [`typescript/no-parameter-properties`] | +| [`no-parameter-properties`] | ✅ | [`@typescript-eslint/no-parameter-properties`] | | [`no-redundant-jsdoc`] | 🛑 | N/A ([open issue](https://github.com/gajus/eslint-plugin-jsdoc/issues/134)) | | [`no-reference-import`] | 🛑 | N/A | | [`no-trailing-whitespace`] | 🌟 | [`no-trailing-spaces`][no-trailing-spaces] | @@ -175,12 +175,12 @@ | [`space-before-function-paren`] | 🌟 | [`space-before-function-paren`][space-after-function-paren] | | [`space-within-parens`] | 🌟 | [`space-in-parens`][space-in-parens] | | [`switch-final-break`] | 🛑 | N/A | -| [`type-literal-delimiter`] | ✅ | [`typescript/member-delimiter-style`] | +| [`type-literal-delimiter`] | ✅ | [`@typescript-eslint/member-delimiter-style`] | | [`variable-name`] | 🌟 | [2] | | [`whitespace`] | 🔌 | Use [Prettier] | [1] Recommended config: `["error", { blankLine: "always", prev: "*", next: "return" }]` -[2] [`camelcase`][camelcase], [`no-underscore-dangle`][no-underscore-dangle], [`id-blacklist`][id-blacklist], and/or [`id-match`] +[2] [`camelcase`][camelcase], [`no-underscore-dangle`][no-underscore-dangle], [`id-blacklist`][id-blacklist], and/or [`id-match`][id-match] ## tslint-microsoft-contrib rules @@ -200,10 +200,10 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- ### TypeScript -| tslint-microsoft-contrib rule | | ESLint rule | -| ----------------------------- | :-: | -------------------------------------------------- | -| `prefer-array-literal` | 🌓 | [`typescript/no-array-constructor`] [1] | -| `prefer-type-cast` | 🛑 | N/A | +| tslint-microsoft-contrib rule | | ESLint rule | +| ----------------------------- | :-: | ---------------------------------------------------------- | +| `prefer-array-literal` | 🌓 | [`@typescript-eslint/no-array-constructor`] [1] | +| `prefer-type-cast` | 🛑 | N/A | [1] ESLint rule is slightly less strict, allowing `new Array()` and `Array(2)`. @@ -282,7 +282,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- | `no-exec-script` | 🌓 | Use [`no-restricted-syntax`][no-restricted-syntax] | | `no-jquery-raw-elements` | 🛑 | N/A | | `no-unsupported-browser-code` | 🔌 | [`eslint-plugin-compat`][plugin:compat] | -| `react-this-binding-issue` | 🛑 | | +| `react-this-binding-issue` | 🛑 | N/A | | `react-tsx-curly-spacing` | 🔌 | [`react/jsx-curly-spacing`] | | `react-unused-props-and-state` | 🌓 | [`react/no-unused-state`] | @@ -557,34 +557,34 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- -[`typescript/adjacent-overload-signatures`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/adjacent-overload-signatures.md -[`typescript/ban-types`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/ban-types.md -[`typescript/explicit-member-accessibility`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/explicit-member-accessibility.md -[`typescript/member-ordering`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/member-ordering.md -[`typescript/no-explicit-any`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-explicit-any.md -[`typescript/no-empty-interface`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-empty-interface.md -[`typescript/no-inferrable-types`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-inferrable-types.md -[`typescript/prefer-namespace-keyword`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/prefer-namespace-keyword.md -[`typescript/no-namespace`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-namespace.md -[`typescript/no-non-null-assertion`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-non-null-assertion.md -[`typescript/no-triple-slash-reference`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-triple-slash-reference.md -[`typescript/no-var-requires`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-var-requires.md -[`typescript/type-annotation-spacing`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/type-annotation-spacing.md -[`typescript/no-misused-new`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-misused-new.md -[`typescript/no-object-literal-type-assertion`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-object-literal-type-assertion.md -[`typescript/no-this-alias`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-this-alias.md -[`typescript/no-extraneous-class`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-extraneous-class.md -[`typescript/no-unused-vars`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-unused-vars.md -[`typescript/no-use-before-define`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-use-before-define.md -[`typescript/indent`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/indent.md -[`typescript/array-type`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/array-type.md -[`typescript/class-name-casing`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/class-name-casing.md -[`typescript/interface-name-prefix`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/interface-name-prefix.md -[`typescript/no-angle-bracket-type-assertion`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-angle-bracket-type-assertion.md -[`typescript/no-parameter-properties`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-parameter-properties.md -[`typescript/member-delimiter-style`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/member-delimiter-style.md -[`typescript/prefer-interface`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/prefer-interface.md -[`typescript/no-array-constructor`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-array-constructor.md +[`@typescript-eslint/adjacent-overload-signatures`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/adjacent-overload-signatures.md +[`@typescript-eslint/ban-types`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/ban-types.md +[`@typescript-eslint/explicit-member-accessibility`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/explicit-member-accessibility.md +[`@typescript-eslint/member-ordering`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/member-ordering.md +[`@typescript-eslint/no-explicit-any`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-explicit-any.md +[`@typescript-eslint/no-empty-interface`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-empty-interface.md +[`@typescript-eslint/no-inferrable-types`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-inferrable-types.md +[`@typescript-eslint/prefer-namespace-keyword`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/prefer-namespace-keyword.md +[`@typescript-eslint/no-namespace`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-namespace.md +[`@typescript-eslint/no-non-null-assertion`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-non-null-assertion.md +[`@typescript-eslint/no-triple-slash-reference`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-triple-slash-reference.md +[`@typescript-eslint/no-var-requires`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-var-requires.md +[`@typescript-eslint/type-annotation-spacing`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/type-annotation-spacing.md +[`@typescript-eslint/no-misused-new`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-misused-new.md +[`@typescript-eslint/no-object-literal-type-assertion`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-object-literal-type-assertion.md +[`@typescript-eslint/no-this-alias`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-this-alias.md +[`@typescript-eslint/no-extraneous-class`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-extraneous-class.md +[`@typescript-eslint/no-unused-vars`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-unused-vars.md +[`@typescript-eslint/no-use-before-define`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-use-before-define.md +[`@typescript-eslint/indent`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/indent.md +[`@typescript-eslint/array-type`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/array-type.md +[`@typescript-eslint/class-name-casing`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/class-name-casing.md +[`@typescript-eslint/interface-name-prefix`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/interface-name-prefix.md +[`@typescript-eslint/no-angle-bracket-type-assertion`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-angle-bracket-type-assertion.md +[`@typescript-eslint/no-parameter-properties`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-parameter-properties.md +[`@typescript-eslint/member-delimiter-style`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/member-delimiter-style.md +[`@typescript-eslint/prefer-interface`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/prefer-interface.md +[`@typescript-eslint/no-array-constructor`]: https://github.com/bradzacher/@typescript-eslint/eslint-plugin/blob/master/docs/rules/no-array-constructor.md diff --git a/packages/eslint-plugin/lib/util.js b/packages/eslint-plugin/lib/util.js index 1df02bfb9e8e..e12e15f80413 100644 --- a/packages/eslint-plugin/lib/util.js +++ b/packages/eslint-plugin/lib/util.js @@ -117,8 +117,12 @@ exports.getParserServices = context => { !context.parserServices.program || !context.parserServices.esTreeNodeToTSNodeMap ) { + /** + * The user needs to have configured "project" in their parserOptions + * for @typescript-eslint/parser + */ throw new Error( - 'This rule requires you to use `@typescript-eslint/parser`.' + `You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.` ); } return context.parserServices; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 7cd6f21b1ab3..5e824cfd98c3 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "1.1.0", + "version": "1.1.1", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -9,7 +9,7 @@ "typescript" ], "engines": { - "node": ">=6" + "node": "^6.14.0 || ^8.10.0 || >=9.10.0" }, "repository": "typescript-eslint/typescript-eslint", "bugs": { @@ -24,7 +24,7 @@ "recommended:update": "node tools/update-recommended.js" }, "dependencies": { - "@typescript-eslint/parser": "1.1.0", + "@typescript-eslint/parser": "1.1.1", "requireindex": "^1.2.0" }, "devDependencies": { @@ -32,7 +32,7 @@ "eslint-docs": "^0.2.6" }, "peerDependencies": { - "eslint": ">=4.13.1 < 6", + "eslint": "^5.0.0", "typescript": "~3.2.1" } } diff --git a/packages/eslint-plugin/tests/lib/rules/no-unused-vars.js b/packages/eslint-plugin/tests/lib/rules/no-unused-vars.js index 726f755c3956..2fe854b2c442 100644 --- a/packages/eslint-plugin/tests/lib/rules/no-unused-vars.js +++ b/packages/eslint-plugin/tests/lib/rules/no-unused-vars.js @@ -557,7 +557,20 @@ export interface Bar extends foo.i18n {} import foo from 'foo'; import bar from 'foo'; export interface Bar extends foo.i18n {} - ` + `, + // https://github.com/typescript-eslint/typescript-eslint/issues/141 + { + filename: 'test.tsx', + code: ` +import { TypeA } from './interface'; +export const a = />; + `, + parserOptions: { + ecmaFeatures: { + jsx: true + } + } + } ], invalid: [ diff --git a/packages/eslint-plugin/tests/lib/rules/restrict-plus-operands.js b/packages/eslint-plugin/tests/lib/rules/restrict-plus-operands.js index a13b7cea3e47..d5a07e596982 100644 --- a/packages/eslint-plugin/tests/lib/rules/restrict-plus-operands.js +++ b/packages/eslint-plugin/tests/lib/rules/restrict-plus-operands.js @@ -22,7 +22,6 @@ const rootPath = path.join(process.cwd(), 'tests/fixtures/'); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { - generateServices: true, tsconfigRootDir: rootPath, project: './tsconfig.json' } diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 3c8b8d4e4efc..f2047e5c6d25 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) + +### Bug Fixes + +- **eslint-plugin:** make parser services error clearer ([#132](https://github.com/typescript-eslint/typescript-eslint/issues/132)) ([aa9d1e1](https://github.com/typescript-eslint/typescript-eslint/commit/aa9d1e1)) +- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003)) +- **ts-estree:** expand optional property to include question token ([#138](https://github.com/typescript-eslint/typescript-eslint/issues/138)) ([9068b62](https://github.com/typescript-eslint/typescript-eslint/commit/9068b62)) + # [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) ### Bug Fixes diff --git a/packages/parser/README.md b/packages/parser/README.md index f348ae4617dc..d0a6879b4e57 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -48,6 +48,12 @@ The following additional configuration options are available by specifying them - **`useJSXTextNode`** - default `true`. Please set `false` if you use this parser on ESLint v4. If this is `false`, the parser creates the AST of JSX texts as the legacy style. +- **`project`** - default `undefined`. This option allows you to provide a path to your project's `tsconfig.json`. **This setting is required if you want to use rules which require type information**. You may want to use this setting in tandem with the `tsconfigRootDir` option below. + +- **`tsconfigRootDir`** - default `undefined`. This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above. + +- **`extraFileExtensions`** - default `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. E.g. a `.vue` file + ### .eslintrc.json ```json @@ -57,7 +63,10 @@ The following additional configuration options are available by specifying them "ecmaFeatures": { "jsx": true }, - "useJSXTextNode": true + "useJSXTextNode": true, + "project": "./tsconfig.json", + "tsconfigRootDir": "../../", + "extraFileExtensions": [".vue"] } } ``` diff --git a/packages/parser/package.json b/packages/parser/package.json index 23fe47afce3f..6cf42f6ce6db 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.1.0", + "version": "1.1.1", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "files": [ @@ -9,7 +9,7 @@ "LICENSE" ], "engines": { - "node": ">=6.14.0" + "node": "^6.14.0 || ^8.10.0 || >=9.10.0" }, "repository": "typescript-eslint/typescript-eslint", "bugs": { @@ -32,11 +32,11 @@ "test": "jest --coverage" }, "peerDependencies": { - "eslint": ">=4.19.1", + "eslint": "^5.0.0", "typescript": "*" }, "dependencies": { - "@typescript-eslint/typescript-estree": "1.1.0", + "@typescript-eslint/typescript-estree": "1.1.1", "eslint-scope": "^4.0.0", "eslint-visitor-keys": "^1.0.0" }, @@ -44,6 +44,6 @@ "@types/eslint": "^4.16.5", "@types/eslint-visitor-keys": "^1.0.0", "@types/estree": "^0.0.39", - "@typescript-eslint/shared-fixtures": "1.1.0" + "@typescript-eslint/shared-fixtures": "1.1.1" } } diff --git a/packages/parser/src/analyze-scope.ts b/packages/parser/src/analyze-scope.ts index dc17e977683b..eb9f3c92c752 100644 --- a/packages/parser/src/analyze-scope.ts +++ b/packages/parser/src/analyze-scope.ts @@ -235,6 +235,15 @@ class Referencer extends OriginalReferencer { } } + /** + * Override. + */ + JSXOpeningElement(node: any) { + this.visit(node.name); + this.visitTypeParameters(node); + this.visit(node.attributes); + } + /** * Override. * Don't create the reference object in the type mode. diff --git a/packages/parser/src/visitor-keys.ts b/packages/parser/src/visitor-keys.ts index d1dd5e616aeb..d3938529e820 100644 --- a/packages/parser/src/visitor-keys.ts +++ b/packages/parser/src/visitor-keys.ts @@ -1,6 +1,8 @@ import eslintVisitorKeys from 'eslint-visitor-keys'; export const visitorKeys = eslintVisitorKeys.unionWith({ + // Additional estree nodes. + Import: [], // Additional Properties. ArrayPattern: ['elements', 'typeAnnotation'], ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'], @@ -30,6 +32,11 @@ export const visitorKeys = eslintVisitorKeys.unionWith({ RestElement: ['argument', 'typeAnnotation'], NewExpression: ['callee', 'typeParameters', 'arguments'], CallExpression: ['callee', 'typeParameters', 'arguments'], + // JSX + JSXOpeningElement: ['name', 'typeParameters', 'attributes'], + JSXClosingFragment: [], + JSXOpeningFragment: [], + JSXSpreadChild: ['expression'], // Additional Nodes. BigIntLiteral: [], diff --git a/packages/parser/tests/fixtures/scope-analysis/import-keyword.ts b/packages/parser/tests/fixtures/scope-analysis/import-keyword.ts new file mode 100644 index 000000000000..3beea868f04b --- /dev/null +++ b/packages/parser/tests/fixtures/scope-analysis/import-keyword.ts @@ -0,0 +1 @@ +import('test'); diff --git a/packages/parser/tests/fixtures/scope-analysis/typed-jsx-element.tsx b/packages/parser/tests/fixtures/scope-analysis/typed-jsx-element.tsx new file mode 100644 index 000000000000..29158b30c8dc --- /dev/null +++ b/packages/parser/tests/fixtures/scope-analysis/typed-jsx-element.tsx @@ -0,0 +1 @@ +const a = />; diff --git a/packages/parser/tests/lib/__snapshots__/javascript.ts.snap b/packages/parser/tests/lib/__snapshots__/javascript.ts.snap index b31c5e710a2b..6a51ccfcd4de 100644 --- a/packages/parser/tests/lib/__snapshots__/javascript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/javascript.ts.snap @@ -99362,126 +99362,218 @@ Object { } `; -exports[`javascript fixtures/generators/anonymous-generator.src 1`] = ` +exports[`javascript fixtures/function/return-multiline-sequence.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "expressions": Array [ + Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 3, }, }, - "name": "v", + "name": "x", "range": Array [ - 22, - 23, + 40, + 41, ], "type": "Identifier", }, - "delegate": false, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - "start": Object { - "column": 16, - "line": 1, + "name": "y", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, }, + "name": "z", + "range": Array [ + 54, + 55, + ], + "type": "Identifier", }, - "range": Array [ - 16, - 23, - ], - "type": "YieldExpression", - }, + ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 16, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 16, - 23, + 40, + 55, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, + "type": "SequenceExpression", }, - "start": Object { - "column": 14, - "line": 1, + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, }, + "range": Array [ + 27, + 60, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 1, }, - "range": Array [ - 14, - 25, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": true, - "id": null, + "range": Array [ + 23, + 62, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 9, "line": 1, }, }, - "params": Array [], + "name": "foo", "range": Array [ - 1, - 25, + 9, + 12, ], - "type": "FunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 7, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + ], "range": Array [ 0, - 27, + 62, ], - "type": "ExpressionStatement", + "type": "FunctionDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -99490,14 +99582,14 @@ Object { }, "range": Array [ 0, - 27, + 63, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -99507,378 +99599,313 @@ Object { }, "range": Array [ 0, - 1, + 8, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 9, "line": 1, }, }, "range": Array [ - 1, 9, + 12, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": "*", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 12, + 14, + 15, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 15, "line": 1, }, }, "range": Array [ - 12, - 13, + 15, + 16, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 17, "line": 1, }, }, "range": Array [ - 14, - 15, + 17, + 18, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 1, }, "start": Object { - "column": 16, + "column": 18, "line": 1, }, }, "range": Array [ - 16, - 21, + 18, + 19, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 1, }, "start": Object { - "column": 22, + "column": 20, "line": 1, }, }, "range": Array [ - 22, - 23, + 20, + 21, ], "type": "Identifier", - "value": "v", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 22, "line": 1, }, "start": Object { - "column": 24, + "column": 21, "line": 1, }, }, "range": Array [ - 24, - 25, + 21, + 22, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 24, "line": 1, }, "start": Object { - "column": 25, + "column": 23, "line": 1, }, }, "range": Array [ - 25, - 26, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 26, 27, + 33, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "return", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/generators/async-generator-function.src 1`] = ` -Object { - "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 23, - 27, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 10, + "line": 2, }, "start": Object { - "column": 0, + "column": 9, "line": 2, }, }, - "params": Array [], "range": Array [ - 1, - 27, + 34, + 35, ], - "type": "FunctionDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 1, - 28, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 2, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 1, - 6, + 40, + 41, ], "type": "Identifier", - "value": "async", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 6, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 7, - 15, + 41, + 42, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 15, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 16, - 17, + 47, + 48, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 6, + "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, }, "range": Array [ - 17, - 20, + 48, + 49, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 5, + "line": 5, }, "start": Object { - "column": 19, - "line": 2, + "column": 4, + "line": 5, }, }, "range": Array [ - 20, - 21, + 54, + 55, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 3, + "line": 6, }, "start": Object { - "column": 20, - "line": 2, + "column": 2, + "line": 6, }, }, "range": Array [ - 21, - 22, + 58, + 59, ], "type": "Punctuator", "value": ")", @@ -99886,35 +99913,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 4, + "line": 6, }, "start": Object { - "column": 22, - "line": 2, + "column": 3, + "line": 6, }, }, "range": Array [ - 23, - 24, + 59, + 60, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 7, }, "start": Object { "column": 0, - "line": 4, + "line": 7, }, }, "range": Array [ - 26, - 27, + 61, + 62, ], "type": "Punctuator", "value": "}", @@ -99924,258 +99951,2241 @@ Object { } `; -exports[`javascript fixtures/generators/async-generator-method.src 1`] = ` +exports[`javascript fixtures/function/return-sequence.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { "body": Array [ Object { - "computed": false, - "key": Object { + "argument": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "z", + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 2, }, "start": Object { - "column": 12, + "column": 10, "line": 2, }, }, - "name": "f", "range": Array [ - 22, - 23, + 35, + 42, ], - "type": "Identifier", + "type": "SequenceExpression", }, - "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 19, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 14, - 63, + 27, + 44, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 42, - 43, - ], - "type": "Identifier", - }, - "init": Object { - "argument": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 3, - }, - "start": Object { - "column": 25, - "line": 3, - }, - }, - "name": "g", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 25, - "line": 3, - }, - }, - "range": Array [ - 53, - 56, - ], - "type": "CallExpression", - }, - "delegate": true, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "range": Array [ - 46, - 56, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 42, - 56, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 36, - 57, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 63, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 23, - 63, - ], - "type": "FunctionExpression", - }, + "type": "ReturnStatement", }, ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 8, + "column": 23, "line": 1, }, }, "range": Array [ - 8, - 65, + 23, + 46, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 46, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/anonymous-generator.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 25, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/async-generator-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 1, + 27, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/async-generator-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "f", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 63, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "init": Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "name": "g", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "CallExpression", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 56, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 56, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 57, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 65, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 51, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/double-yield.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "type": "YieldExpression", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 32, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 32, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/empty-generator-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, ], - "type": "ClassBody", + "type": "BlockStatement", }, + "expression": false, + "generator": true, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, - "name": "C", + "name": "t", "range": Array [ - 6, - 7, + 10, + 11, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 16, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 65, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 17, + "line": 1, }, "start": Object { "column": 0, @@ -100184,14 +102194,14 @@ Object { }, "range": Array [ 0, - 66, + 17, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -100201,331 +102211,467 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "class", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { - "column": 6, + "column": 8, "line": 1, }, }, "range": Array [ - 6, - 7, + 8, + 9, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, ], "type": "Identifier", - "value": "C", + "value": "t", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, "range": Array [ - 8, - 9, + 11, + 12, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, }, "range": Array [ 14, - 19, + 15, ], - "type": "Identifier", - "value": "async", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 20, - 21, + 15, + 16, ], "type": "Punctuator", - "value": "*", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 22, - 23, + 16, + 17, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/generator-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 0, + "line": 1, }, }, + "params": Array [], "range": Array [ - 23, - 24, + 0, + 30, ], - "type": "Punctuator", - "value": "(", + "type": "FunctionDeclaration", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 30, + "line": 1, }, }, "range": Array [ - 24, - 25, + 30, + 31, ], - "type": "Punctuator", - "value": ")", + "type": "EmptyStatement", }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 8, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { "column": 8, - "line": 3, + "line": 1, }, }, "range": Array [ - 36, - 41, + 8, + 9, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 42, - 43, + 10, + 14, ], "type": "Identifier", - "value": "x", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 44, - 45, + 15, + 16, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 16, + "line": 1, }, }, "range": Array [ - 46, - 51, + 16, + 17, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 3, + "column": 19, + "line": 1, }, "start": Object { - "column": 23, - "line": 3, + "column": 18, + "line": 1, }, }, "range": Array [ - 51, - 52, + 18, + 19, ], "type": "Punctuator", - "value": "*", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 25, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 53, - 54, + 20, + 25, ], - "type": "Identifier", - "value": "g", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 3, + "line": 1, }, "start": Object { "column": 26, - "line": 3, + "line": 1, }, }, "range": Array [ - 54, - 55, + 26, + 27, ], "type": "Punctuator", - "value": "(", + "value": "*", }, Object { "loc": Object { "end": Object { "column": 28, - "line": 3, + "line": 1, }, "start": Object { "column": 27, - "line": 3, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, + "line": 1, }, }, "range": Array [ - 56, - 57, + 27, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 30, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 29, + "line": 1, }, }, "range": Array [ - 62, - 63, + 29, + 30, ], "type": "Punctuator", "value": "}", @@ -100533,27 +102679,27 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 30, + "line": 1, }, }, "range": Array [ - 64, - 65, + 30, + 31, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`javascript fixtures/generators/double-yield.src 1`] = ` +exports[`javascript fixtures/generators/yield-delegation.src 1`] = ` Object { "body": Array [ Object { @@ -100564,46 +102710,27 @@ Object { Object { "expression": Object { "argument": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 30, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "delegate": false, "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 22, + "column": 23, "line": 1, }, }, + "name": "v", "range": Array [ - 22, - 30, + 23, + 24, ], - "type": "YieldExpression", + "type": "Identifier", }, - "delegate": false, + "delegate": true, "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { @@ -100613,13 +102740,13 @@ Object { }, "range": Array [ 16, - 30, + 24, ], "type": "YieldExpression", }, "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { @@ -100629,14 +102756,14 @@ Object { }, "range": Array [ 16, - 30, + 24, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { @@ -100646,7 +102773,7 @@ Object { }, "range": Array [ 14, - 32, + 26, ], "type": "BlockStatement", }, @@ -100655,7 +102782,7 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { @@ -100666,13 +102793,13 @@ Object { "params": Array [], "range": Array [ 1, - 32, + 26, ], "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 34, + "column": 28, "line": 1, }, "start": Object { @@ -100682,7 +102809,7 @@ Object { }, "range": Array [ 0, - 34, + 28, ], "type": "ExpressionStatement", }, @@ -100690,7 +102817,7 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 34, + "column": 28, "line": 1, }, "start": Object { @@ -100700,7 +102827,7 @@ Object { }, "range": Array [ 0, - 34, + 28, ], "sourceType": "module", "tokens": Array [ @@ -100833,7 +102960,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 23, "line": 1, }, "start": Object { @@ -100843,43 +102970,43 @@ Object { }, "range": Array [ 22, - 27, + 23, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 28, + "column": 23, "line": 1, }, }, "range": Array [ - 28, - 30, + 23, + 24, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { - "column": 31, + "column": 25, "line": 1, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "Punctuator", "value": "}", @@ -100887,17 +103014,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 27, "line": 1, }, "start": Object { - "column": 32, + "column": 26, "line": 1, }, }, "range": Array [ - 32, - 33, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -100905,17 +103032,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 28, "line": 1, }, "start": Object { - "column": 33, + "column": 27, "line": 1, }, }, "range": Array [ - 33, - 34, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -100925,52 +103052,90 @@ Object { } `; -exports[`javascript fixtures/generators/empty-generator-declaration.src 1`] = ` +exports[`javascript fixtures/generators/yield-without-value.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, + "range": Array [ + 14, + 24, + ], + "type": "BlockStatement", }, - "range": Array [ - 14, - 16, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { + "expression": false, + "generator": true, + "id": null, "loc": Object { "end": Object { - "column": 11, + "column": 24, "line": 1, }, "start": Object { - "column": 10, + "column": 1, "line": 1, }, }, - "name": "t", + "params": Array [], "range": Array [ - 10, - 11, + 1, + 24, ], - "type": "Identifier", + "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { @@ -100978,36 +103143,18 @@ Object { "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 16, - ], - "type": "FunctionDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, + 26, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -101016,14 +103163,14 @@ Object { }, "range": Array [ 0, - 17, + 27, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -101033,7 +103180,25 @@ Object { }, "range": Array [ 0, - 8, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, ], "type": "Keyword", "value": "function", @@ -101041,17 +103206,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "range": Array [ - 8, 9, + 10, ], "type": "Punctuator", "value": "*", @@ -101059,107 +103224,143 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], - "type": "Identifier", - "value": "t", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 21, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 21, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 22, "line": 1, }, "start": Object { - "column": 12, + "column": 21, "line": 1, }, }, "range": Array [ - 12, - 13, + 21, + 22, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 24, "line": 1, }, "start": Object { - "column": 14, + "column": 23, "line": 1, }, }, "range": Array [ - 14, - 15, + 23, + 24, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 25, "line": 1, }, "start": Object { - "column": 15, + "column": 24, "line": 1, }, }, "range": Array [ - 15, - 16, + 24, + 25, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 26, "line": 1, }, "start": Object { - "column": 16, + "column": 25, "line": 1, }, }, "range": Array [ - 16, - 17, + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -101169,102 +103370,123 @@ Object { } `; -exports[`javascript fixtures/generators/generator-declaration.src 1`] = ` +exports[`javascript fixtures/generators/yield-without-value-in-call.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "YieldExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "fn", + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, + "column": 25, "line": 1, }, "start": Object { - "column": 27, + "column": 16, "line": 1, }, }, - "name": "v", "range": Array [ - 27, - 28, + 16, + 25, ], - "type": "Identifier", + "type": "CallExpression", }, - "delegate": true, "loc": Object { "end": Object { - "column": 28, + "column": 26, "line": 1, }, "start": Object { - "column": 20, + "column": 16, "line": 1, }, }, "range": Array [ - 20, - 28, + 16, + 26, ], - "type": "YieldExpression", + "type": "ExpressionStatement", }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 20, - 28, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, }, + "range": Array [ + 14, + 28, + ], + "type": "BlockStatement", }, - "range": Array [ - 18, - 30, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { + "expression": false, + "generator": true, + "id": null, "loc": Object { "end": Object { - "column": 14, + "column": 28, "line": 1, }, "start": Object { - "column": 10, + "column": 1, "line": 1, }, }, - "name": "test", + "params": Array [], "range": Array [ - 10, - 14, + 1, + 28, ], - "type": "Identifier", + "type": "FunctionExpression", }, "loc": Object { "end": Object { @@ -101276,36 +103498,18 @@ Object { "line": 1, }, }, - "params": Array [], "range": Array [ 0, 30, ], - "type": "FunctionDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "comments": Array [], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -101321,7 +103525,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -101331,7 +103535,25 @@ Object { }, "range": Array [ 0, - 8, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, ], "type": "Keyword", "value": "function", @@ -101339,61 +103561,79 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, "range": Array [ - 8, - 9, + 11, + 12, ], "type": "Punctuator", - "value": "*", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 14, + 12, + 13, ], - "type": "Identifier", - "value": "test", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 14, "line": 1, }, }, "range": Array [ + 14, 15, - 16, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -101403,10 +103643,10 @@ Object { }, "range": Array [ 16, - 17, + 18, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { @@ -101424,22 +103664,22 @@ Object { 19, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ - 20, - 25, + 19, + 24, ], "type": "Keyword", "value": "yield", @@ -101447,20 +103687,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 25, "line": 1, }, "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { "column": 26, "line": 1, }, + "start": Object { + "column": 25, + "line": 1, + }, }, "range": Array [ + 25, 26, - 27, ], "type": "Punctuator", - "value": "*", + "value": ";", }, Object { "loc": Object { @@ -101477,41 +103735,41 @@ Object { 27, 28, ], - "type": "Identifier", - "value": "v", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 29, "line": 1, }, "start": Object { - "column": 29, + "column": 28, "line": 1, }, }, "range": Array [ + 28, 29, - 30, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 1, }, "start": Object { - "column": 30, + "column": 29, "line": 1, }, }, "range": Array [ + 29, 30, - 31, ], "type": "Punctuator", "value": ";", @@ -101521,7 +103779,7 @@ Object { } `; -exports[`javascript fixtures/generators/yield-delegation.src 1`] = ` +exports[`javascript fixtures/generators/yield-without-value-no-semi.src 1`] = ` Object { "body": Array [ Object { @@ -101531,28 +103789,11 @@ Object { "body": Array [ Object { "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "v", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "delegate": true, + "argument": null, + "delegate": false, "loc": Object { "end": Object { - "column": 24, + "column": 21, "line": 1, }, "start": Object { @@ -101562,13 +103803,13 @@ Object { }, "range": Array [ 16, - 24, + 21, ], "type": "YieldExpression", }, "loc": Object { "end": Object { - "column": 24, + "column": 21, "line": 1, }, "start": Object { @@ -101578,14 +103819,14 @@ Object { }, "range": Array [ 16, - 24, + 21, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { @@ -101595,7 +103836,7 @@ Object { }, "range": Array [ 14, - 26, + 23, ], "type": "BlockStatement", }, @@ -101604,7 +103845,7 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { @@ -101615,13 +103856,13 @@ Object { "params": Array [], "range": Array [ 1, - 26, + 23, ], "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 28, + "column": 25, "line": 1, }, "start": Object { @@ -101631,7 +103872,7 @@ Object { }, "range": Array [ 0, - 28, + 25, ], "type": "ExpressionStatement", }, @@ -101639,8 +103880,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -101649,7 +103890,7 @@ Object { }, "range": Array [ 0, - 28, + 26, ], "sourceType": "module", "tokens": Array [ @@ -101755,116 +103996,275 @@ Object { }, }, "range": Array [ - 14, - 15, + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/globalReturn/return-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "fooz", + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, ], - "type": "Punctuator", - "value": "{", + "type": "ReturnStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, + "column": 6, "line": 1, }, "start": Object { - "column": 16, + "column": 0, "line": 1, }, }, "range": Array [ - 16, - 21, + 0, + 6, ], "type": "Keyword", - "value": "yield", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 11, "line": 1, }, "start": Object { - "column": 22, + "column": 7, "line": 1, }, }, "range": Array [ - 22, - 23, + 7, + 11, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "fooz", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { - "column": 23, + "column": 11, "line": 1, }, }, "range": Array [ - 23, - 24, + 11, + 12, ], - "type": "Identifier", - "value": "v", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/globalReturn/return-no-arg.src 1`] = ` +Object { + "body": Array [ Object { + "argument": null, "loc": Object { "end": Object { - "column": 26, + "column": 7, "line": 1, }, "start": Object { - "column": 25, + "column": 0, "line": 1, }, }, "range": Array [ - 25, - 26, + 0, + 7, ], - "type": "Punctuator", - "value": "}", + "type": "ReturnStatement", }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 6, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 6, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 7, "line": 1, }, "start": Object { - "column": 27, + "column": 6, "line": 1, }, }, "range": Array [ - 27, - 28, + 6, + 7, ], "type": "Punctuator", "value": ";", @@ -101874,90 +104274,32 @@ Object { } `; -exports[`javascript fixtures/generators/yield-without-value.src 1`] = ` +exports[`javascript fixtures/globalReturn/return-true.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": null, - "delegate": false, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 21, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 22, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 24, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, + "argument": Object { "loc": Object { "end": Object { - "column": 24, + "column": 11, "line": 1, }, "start": Object { - "column": 1, + "column": 7, "line": 1, }, }, - "params": Array [], "range": Array [ - 1, - 24, + 7, + 11, ], - "type": "FunctionExpression", + "raw": "true", + "type": "Literal", + "value": true, }, "loc": Object { "end": Object { - "column": 26, + "column": 12, "line": 1, }, "start": Object { @@ -101967,9 +104309,9 @@ Object { }, "range": Array [ 0, - 26, + 12, ], - "type": "ExpressionStatement", + "type": "ReturnStatement", }, ], "comments": Array [], @@ -101985,14 +104327,14 @@ Object { }, "range": Array [ 0, - 27, + 13, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -102002,46 +104344,28 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 9, + 6, ], "type": "Keyword", - "value": "function", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 10, + 7, + 11, ], - "type": "Punctuator", - "value": "*", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { @@ -102055,134 +104379,206 @@ Object { }, }, "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ + 11, 12, - 13, ], "type": "Punctuator", - "value": ")", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/hexLiterals/invalid.src 1`] = `"';' expected."`; + +exports[`javascript fixtures/hexLiterals/lowercase.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "raw": "0x2343", + "type": "Literal", + "value": 9027, + }, "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, + "column": 6, "line": 1, }, "start": Object { - "column": 16, + "column": 0, "line": 1, }, }, "range": Array [ - 16, - 21, + 0, + 6, ], - "type": "Keyword", - "value": "yield", + "type": "Numeric", + "value": "0x2343", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 7, "line": 1, }, "start": Object { - "column": 21, + "column": 6, "line": 1, }, }, "range": Array [ - 21, - 22, + 6, + 7, ], "type": "Punctuator", "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/hexLiterals/uppercase.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "raw": "0X2343", + "type": "Literal", + "value": 9027, + }, "loc": Object { "end": Object { - "column": 24, + "column": 7, "line": 1, }, "start": Object { - "column": 23, + "column": 0, "line": 1, }, }, "range": Array [ - 23, - 24, + 0, + 7, ], - "type": "Punctuator", - "value": "}", + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 25, + "column": 6, "line": 1, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, "range": Array [ - 24, - 25, + 0, + 6, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "0X2343", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 7, "line": 1, }, "start": Object { - "column": 25, + "column": 6, "line": 1, }, }, "range": Array [ - 25, - 26, + 6, + 7, ], "type": "Punctuator", "value": ";", @@ -102192,127 +104588,102 @@ Object { } `; -exports[`javascript fixtures/generators/yield-without-value-in-call.src 1`] = ` +exports[`javascript fixtures/importMeta/simple-import-meta.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "argument": null, - "delegate": false, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "YieldExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "fn", - "range": Array [ - 16, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 25, - ], - "type": "CallExpression", + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "import", + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 16, - 26, - ], - "type": "ExpressionStatement", }, + "name": "meta", + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 11, ], + "type": "MetaProperty", + }, + "property": Object { "loc": Object { "end": Object { - "column": 28, + "column": 15, "line": 1, }, "start": Object { - "column": 14, + "column": 12, "line": 1, }, }, + "name": "url", "range": Array [ - 14, - 28, + 12, + 15, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "type": "Identifier", }, - "params": Array [], "range": Array [ - 1, - 28, + 0, + 15, ], - "type": "FunctionExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 30, + "column": 16, "line": 1, }, "start": Object { @@ -102322,7 +104693,7 @@ Object { }, "range": Array [ 0, - 30, + 16, ], "type": "ExpressionStatement", }, @@ -102340,14 +104711,14 @@ Object { }, "range": Array [ 0, - 31, + 17, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -102357,46 +104728,46 @@ Object { }, "range": Array [ 0, - 1, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 9, + 6, + 7, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 10, + 7, + 11, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "meta", }, Object { "loc": Object { @@ -102414,12 +104785,12 @@ Object { 12, ], "type": "Punctuator", - "value": "(", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -102429,169 +104800,25 @@ Object { }, "range": Array [ 12, - 13, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 18, - ], - "type": "Identifier", - "value": "fn", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "Keyword", - "value": "yield", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, + 15, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "url", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 16, "line": 1, }, "start": Object { - "column": 29, + "column": 15, "line": 1, }, }, "range": Array [ - 29, - 30, + 15, + 16, ], "type": "Punctuator", "value": ";", @@ -102601,91 +104828,140 @@ Object { } `; -exports[`javascript fixtures/generators/yield-without-value-no-semi.src 1`] = ` +exports[`javascript fixtures/labels/label-break.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, + "body": Object { "body": Object { "body": Array [ Object { - "expression": Object { - "argument": null, - "delegate": false, + "label": Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 3, }, }, + "name": "loop1", "range": Array [ - 16, - 21, + 33, + 38, ], - "type": "YieldExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 16, - 21, + 27, + 39, ], - "type": "ExpressionStatement", + "type": "BreakStatement", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "BreakStatement", }, ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 14, - "line": 1, + "line": 2, }, }, "range": Array [ - 14, - 23, + 21, + 54, ], "type": "BlockStatement", }, - "expression": false, - "generator": true, - "id": null, "loc": Object { "end": Object { - "column": 23, + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 9, + 54, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + "label": Object { + "loc": Object { + "end": Object { + "column": 5, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, - "params": Array [], + "name": "loop1", "range": Array [ - 1, - 23, + 0, + 5, ], - "type": "FunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, @@ -102694,16 +104970,16 @@ Object { }, "range": Array [ 0, - 25, + 54, ], - "type": "ExpressionStatement", + "type": "LabeledStatement", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -102712,14 +104988,14 @@ Object { }, "range": Array [ 0, - 26, + 55, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -102729,79 +105005,97 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "loop1", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 1, + "column": 5, "line": 1, }, }, "range": Array [ - 1, + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ 9, + 14, ], "type": "Keyword", - "value": "function", + "value": "while", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 9, - 10, + 14, + 15, ], "type": "Punctuator", - "value": "*", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 11, - 12, + 15, + 19, ], - "type": "Punctuator", - "value": "(", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 1, + "line": 2, }, "start": Object { "column": 12, - "line": 1, + "line": 2, }, }, "range": Array [ - 12, - 13, + 19, + 20, ], "type": "Punctuator", "value": ")", @@ -102810,16 +105104,16 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 1, + "line": 2, }, "start": Object { "column": 14, - "line": 1, + "line": 2, }, }, "range": Array [ - 14, - 15, + 21, + 22, ], "type": "Punctuator", "value": "{", @@ -102827,204 +105121,250 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + "value": "loop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 16, - 21, + 38, + 39, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 9, + "line": 4, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 22, - 23, + 44, + 49, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "break", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 10, + "line": 4, }, "start": Object { - "column": 23, - "line": 1, + "column": 9, + "line": 4, }, }, "range": Array [ - 23, - 24, + 49, + 50, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 24, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 24, - 25, + 53, + 54, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`javascript fixtures/globalReturn/return-identifier.src 1`] = ` +exports[`javascript fixtures/labels/label-continue.src 1`] = ` Object { "body": Array [ Object { - "argument": Object { + "body": Object { + "body": Object { + "body": Array [ + Object { + "label": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "loop1", + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 42, + ], + "type": "ContinueStatement", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "ContinueStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 21, + 60, + ], + "type": "BlockStatement", + }, "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "fooz", "range": Array [ - 7, - 11, + 9, + 60, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 12, - ], - "type": "ReturnStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 13, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "test": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "raw": "true", + "type": "Literal", + "value": true, }, + "type": "WhileStatement", }, - "range": Array [ - 7, - 11, - ], - "type": "Identifier", - "value": "fooz", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, + "label": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "name": "loop1", + "range": Array [ + 0, + 5, + ], + "type": "Identifier", }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/globalReturn/return-no-arg.src 1`] = ` -Object { - "body": Array [ - Object { - "argument": null, "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, @@ -103033,16 +105373,16 @@ Object { }, "range": Array [ 0, - 7, + 60, ], - "type": "ReturnStatement", + "type": "LabeledStatement", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -103051,14 +105391,14 @@ Object { }, "range": Array [ 0, - 8, + 61, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 5, "line": 1, }, "start": Object { @@ -103068,123 +105408,79 @@ Object { }, "range": Array [ 0, - 6, + 5, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "loop1", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ + 5, 6, - 7, ], "type": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/globalReturn/return-true.src 1`] = ` -Object { - "body": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 0, - 12, + 9, + 14, ], - "type": "ReturnStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "while", }, - }, - "range": Array [ - 0, - 13, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 0, - 6, + 14, + 15, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 7, - 11, + 15, + 19, ], "type": "Boolean", "value": "true", @@ -103192,273 +105488,205 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 11, - 12, + 19, + 20, ], "type": "Punctuator", - "value": ";", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/hexLiterals/invalid.src 1`] = `"';' expected."`; - -exports[`javascript fixtures/hexLiterals/lowercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, }, - "range": Array [ - 0, - 6, - ], - "raw": "0x2343", - "type": "Literal", - "value": 9027, }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 0, - 7, + 27, + 35, ], - "type": "ExpressionStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "continue", }, - }, - "range": Array [ - 0, - 8, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 0, - 6, + 36, + 41, ], - "type": "Numeric", - "value": "0x2343", + "type": "Identifier", + "value": "loop1", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 6, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 6, - 7, + 41, + 42, ], "type": "Punctuator", "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/hexLiterals/uppercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "raw": "0X2343", - "type": "Literal", - "value": 9027, - }, "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 12, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 0, - 7, + 47, + 55, ], - "type": "ExpressionStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "continue", }, - }, - "range": Array [ - 0, - 8, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 12, + "line": 4, }, }, "range": Array [ - 0, - 6, + 55, + 56, ], - "type": "Numeric", - "value": "0X2343", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 6, - 7, + 59, + 60, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`javascript fixtures/importMeta/simple-import-meta.src 1`] = ` +exports[`javascript fixtures/modules/error-delete.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "source": Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, - "object": Object { + "range": Array [ + 14, + 17, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "specifiers": Array [ + Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 1, }, "start": Object { - "column": 0, + "column": 7, "line": 1, }, }, - "meta": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "import", - "range": Array [ - 0, - 6, - ], - "type": "Identifier", - }, - "property": Object { + "local": Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 1, }, "start": Object { @@ -103466,56 +105694,73 @@ Object { "line": 1, }, }, - "name": "meta", + "name": "x", "range": Array [ 7, - 11, + 8, ], "type": "Identifier", }, "range": Array [ - 0, - 11, + 7, + 8, ], - "type": "MetaProperty", + "type": "ImportDefaultSpecifier", }, - "property": Object { + ], + "type": "ImportDeclaration", + }, + Object { + "expression": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 2, }, }, - "name": "url", + "name": "x", "range": Array [ - 12, - 15, + 26, + 27, ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "delete", + "prefix": true, "range": Array [ - 0, - 15, + 19, + 27, ], - "type": "MemberExpression", + "type": "UnaryExpression", }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 16, + 19, + 28, ], "type": "ExpressionStatement", }, @@ -103524,7 +105769,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 3, }, "start": Object { "column": 0, @@ -103533,7 +105778,7 @@ Object { }, "range": Array [ 0, - 17, + 29, ], "sourceType": "module", "tokens": Array [ @@ -103558,89 +105803,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, ], - "type": "Punctuator", - "value": ".", + "type": "String", + "value": "\\"x\\"", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, "range": Array [ - 7, - 11, + 17, + 18, ], - "type": "Identifier", - "value": "meta", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 11, - 12, + 19, + 25, ], - "type": "Punctuator", - "value": ".", + "type": "Keyword", + "value": "delete", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 12, - 15, + 26, + 27, ], "type": "Identifier", - "value": "url", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 15, - 16, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -103650,158 +105931,108 @@ Object { } `; -exports[`javascript fixtures/labels/label-break.src 1`] = ` +exports[`javascript fixtures/modules/error-function.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { - "body": Object { - "body": Array [ - Object { - "label": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "name": "loop1", - "range": Array [ - 33, - 38, - ], - "type": "Identifier", - }, + "body": Array [ + Object { + "declaration": Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 23, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 16, + "line": 2, }, }, + "name": "friends", "range": Array [ - 27, - 39, + 31, + 38, ], - "type": "BreakStatement", + "type": "Identifier", }, - Object { - "label": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, }, - "range": Array [ - 44, - 50, - ], - "type": "BreakStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 2, }, + "range": Array [ + 16, + 39, + ], + "type": "ExportDefaultDeclaration", }, - "range": Array [ - 21, - 54, - ], - "type": "BlockStatement", - }, + ], "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { - "column": 2, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 9, - 54, + 13, + 41, ], - "test": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 15, - 19, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - "type": "WhileStatement", + "type": "BlockStatement", }, - "label": Object { + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 1, }, "start": Object { - "column": 0, + "column": 9, "line": 1, }, }, - "name": "loop1", + "name": "x", "range": Array [ - 0, - 5, + 9, + 10, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 54, + 41, ], - "type": "LabeledStatement", + "type": "FunctionDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 5, }, "start": Object { "column": 0, @@ -103810,14 +106041,14 @@ Object { }, "range": Array [ 0, - 55, + 43, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -103827,61 +106058,43 @@ Object { }, "range": Array [ 0, - 5, + 8, ], - "type": "Identifier", - "value": "loop1", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, - "range": Array [ - 5, - 6, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, "range": Array [ 9, - 14, + 10, ], - "type": "Keyword", - "value": "while", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -103890,101 +106103,101 @@ Object { "loc": Object { "end": Object { "column": 12, - "line": 2, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 15, - 19, + 11, + 12, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 19, - 20, + 13, + 14, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { - "column": 14, + "column": 1, "line": 2, }, }, "range": Array [ - 21, + 16, 22, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 15, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 27, - 32, + 23, + 30, ], "type": "Keyword", - "value": "break", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 23, + "line": 2, }, "start": Object { - "column": 10, - "line": 3, + "column": 16, + "line": 2, }, }, "range": Array [ - 33, + 31, 38, ], "type": "Identifier", - "value": "loop1", + "value": "friends", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 24, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 23, + "line": 2, }, }, "range": Array [ @@ -103997,207 +106210,263 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 44, - 49, + 40, + 41, ], - "type": "Keyword", - "value": "break", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/modules/error-strict.src 1`] = ` +Object { + "body": Array [ Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 26, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 49, - 50, + 0, + 26, ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, + "source": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, }, + "range": Array [ + 18, + 25, + ], + "raw": "\\"house\\"", + "type": "Literal", + "value": "house", }, - "range": Array [ - 53, - 54, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "house", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 12, + ], + "type": "ImportDefaultSpecifier", + }, ], - "type": "Punctuator", - "value": "}", + "type": "ImportDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/labels/label-continue.src 1`] = ` -Object { - "body": Array [ Object { "body": Object { - "body": Object { - "body": Array [ - Object { - "label": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "roof", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 13, - "line": 3, + "column": 1, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "console", + "range": Array [ + 44, + 51, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, }, + "name": "log", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", }, - "name": "loop1", "range": Array [ - 36, - 41, + 44, + 55, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "type": "MemberExpression", }, - "range": Array [ - 27, - 42, - ], - "type": "ContinueStatement", - }, - Object { - "label": null, "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 4, }, "start": Object { - "column": 4, + "column": 1, "line": 4, }, }, "range": Array [ - 47, - 56, + 44, + 61, ], - "type": "ContinueStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 5, + "type": "CallExpression", }, - "start": Object { - "column": 14, - "line": 2, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, }, + "range": Array [ + 44, + 62, + ], + "type": "ExpressionStatement", }, - "range": Array [ - 21, - 60, - ], - "type": "BlockStatement", - }, + ], "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 5, }, "start": Object { - "column": 2, - "line": 2, + "column": 13, + "line": 3, }, }, "range": Array [ - 9, - 60, + 41, + 64, ], - "test": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 15, - 19, - ], - "raw": "true", - "type": "Literal", - "value": true, + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, }, - "type": "WhileStatement", }, - "label": Object { + "object": Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 3, }, }, - "name": "loop1", + "name": "house", "range": Array [ - 0, - 5, + 34, + 39, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, "range": Array [ - 0, - 60, + 28, + 64, ], - "type": "LabeledStatement", + "type": "WithStatement", }, ], "comments": Array [], @@ -104213,14 +106482,14 @@ Object { }, "range": Array [ 0, - 61, + 65, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { @@ -104230,169 +106499,79 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Identifier", - "value": "loop1", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, 6, ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 9, - 14, - ], "type": "Keyword", - "value": "while", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 15, - 19, - ], - "type": "Boolean", - "value": "true", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { "column": 12, - "line": 2, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 21, - 22, + 7, + 12, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "house", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 17, + "line": 1, }, - "start": Object { - "column": 4, - "line": 3, + "start": Object { + "column": 13, + "line": 1, }, }, "range": Array [ - 27, - 35, + 13, + 17, ], - "type": "Keyword", - "value": "continue", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 18, + "line": 1, }, }, "range": Array [ - 36, - 41, + 18, + 25, ], - "type": "Identifier", - "value": "loop1", + "type": "String", + "value": "\\"house\\"", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 1, }, }, "range": Array [ - 41, - 42, + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -104400,526 +106579,356 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 4, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 47, - 55, + 28, + 32, ], "type": "Keyword", - "value": "continue", + "value": "with", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 6, + "line": 3, }, "start": Object { - "column": 12, - "line": 4, + "column": 5, + "line": 3, }, }, "range": Array [ - 55, - 56, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 11, + "line": 3, }, "start": Object { - "column": 2, - "line": 5, + "column": 6, + "line": 3, }, }, "range": Array [ - 59, - 60, + 34, + 39, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "house", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/modules/error-delete.src 1`] = ` -Object { - "body": Array [ Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 0, - 18, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 17, - ], - "raw": "\\"x\\"", - "type": "Literal", - "value": "x", - }, - "specifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, - "range": Array [ - 7, - 8, - ], - "type": "ImportDefaultSpecifier", - }, + 39, + 40, ], - "type": "ImportDeclaration", + "type": "Punctuator", + "value": ")", }, Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "operator": "delete", - "prefix": true, - "range": Array [ - 19, - 27, - ], - "type": "UnaryExpression", - }, "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 13, + "line": 3, }, }, "range": Array [ - 19, - 28, + 41, + 42, ], - "type": "ExpressionStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 1, + "line": 4, }, }, "range": Array [ - 0, - 6, + 44, + 51, ], - "type": "Keyword", - "value": "import", + "type": "Identifier", + "value": "console", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 9, + "line": 4, }, "start": Object { - "column": 7, - "line": 1, + "column": 8, + "line": 4, }, }, "range": Array [ - 7, - 8, + 51, + 52, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 12, + "line": 4, }, "start": Object { "column": 9, - "line": 1, + "line": 4, }, }, "range": Array [ - 9, - 13, + 52, + 55, ], "type": "Identifier", - "value": "from", + "value": "log", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 14, - "line": 1, + "column": 12, + "line": 4, }, }, "range": Array [ - 14, - 17, + 55, + 56, ], - "type": "String", - "value": "\\"x\\"", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 17, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 13, + "line": 4, }, }, "range": Array [ - 17, - 18, + 56, + 60, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "roof", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 18, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 17, + "line": 4, }, }, "range": Array [ - 19, - 25, + 60, + 61, ], - "type": "Keyword", - "value": "delete", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 19, + "line": 4, }, "start": Object { - "column": 7, - "line": 2, + "column": 18, + "line": 4, }, }, "range": Array [ - 26, - 27, + 61, + 62, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 1, + "line": 5, }, "start": Object { - "column": 8, - "line": 2, + "column": 0, + "line": 5, }, }, "range": Array [ - 27, - 28, + 63, + 64, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`javascript fixtures/modules/error-function.src 1`] = ` +exports[`javascript fixtures/modules/export-async-named-function.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "declaration": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "friends", - "range": Array [ - 31, - 38, - ], - "type": "Identifier", + "declaration": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, + "start": Object { + "column": 28, + "line": 1, }, - "range": Array [ - 16, - 39, - ], - "type": "ExportDefaultDeclaration", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 1, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", }, - "range": Array [ - 13, - 41, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 30, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, - "name": "x", + "params": Array [], "range": Array [ - 9, - 10, + 7, + 30, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 30, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 41, + 30, ], - "type": "FunctionDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 43, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "x", + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 11, + "column": 6, "line": 1, }, "start": Object { - "column": 10, + "column": 0, "line": 1, }, }, "range": Array [ - 10, - 11, + 0, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { @@ -104928,21 +106937,21 @@ Object { "line": 1, }, "start": Object { - "column": 11, + "column": 7, "line": 1, }, }, "range": Array [ - 11, + 7, 12, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "async", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 21, "line": 1, }, "start": Object { @@ -104952,97 +106961,97 @@ Object { }, "range": Array [ 13, - 14, + 21, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 16, 22, + 25, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 23, - 30, + 25, + 26, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 31, - 38, + 26, + 27, ], - "type": "Identifier", - "value": "friends", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 38, - 39, + 28, + 29, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 30, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 40, - 41, + 29, + 30, ], "type": "Punctuator", "value": "}", @@ -105052,250 +107061,108 @@ Object { } `; -exports[`javascript fixtures/modules/error-strict.src 1`] = ` +exports[`javascript fixtures/modules/export-const.src 1`] = ` Object { "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 25, - ], - "raw": "\\"house\\"", - "type": "Literal", - "value": "house", - }, - "specifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "house", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "range": Array [ - 7, - 12, - ], - "type": "ImportDefaultSpecifier", - }, - ], - "type": "ImportDeclaration", - }, - Object { - "body": Object { - "body": Array [ + "declaration": Object { + "declarations": Array [ Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "name": "roof", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "name": "console", - "range": Array [ - 44, - 51, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "log", - "range": Array [ - 52, - 55, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 44, - 55, - ], - "type": "MemberExpression", }, + "name": "foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 20, + "line": 1, }, "start": Object { - "column": 1, - "line": 4, + "column": 19, + "line": 1, }, }, "range": Array [ - 44, - 61, + 19, + 20, ], - "type": "CallExpression", + "raw": "2", + "type": "Literal", + "value": 2, }, "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 20, + "line": 1, }, "start": Object { - "column": 1, - "line": 4, + "column": 13, + "line": 1, }, }, "range": Array [ - 44, - 62, + 13, + 20, ], - "type": "ExpressionStatement", + "type": "VariableDeclarator", }, ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 21, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 41, - 64, + 7, + 21, ], - "type": "BlockStatement", + "type": "VariableDeclaration", }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 21, + "line": 1, }, "start": Object { "column": 0, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, + "line": 1, }, - "name": "house", - "range": Array [ - 34, - 39, - ], - "type": "Identifier", }, "range": Array [ - 28, - 64, + 0, + 21, ], - "type": "WithStatement", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -105304,7 +107171,7 @@ Object { }, "range": Array [ 0, - 65, + 22, ], "sourceType": "module", "tokens": Array [ @@ -105324,7 +107191,7 @@ Object { 6, ], "type": "Keyword", - "value": "import", + "value": "export", }, Object { "loc": Object { @@ -105341,13 +107208,13 @@ Object { 7, 12, ], - "type": "Identifier", - "value": "house", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { @@ -105357,295 +107224,268 @@ Object { }, "range": Array [ 13, - 17, + 16, ], "type": "Identifier", - "value": "from", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 1, }, "start": Object { - "column": 18, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 18, - 25, ], - "type": "String", - "value": "\\"house\\"", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 1, }, "start": Object { - "column": 25, + "column": 19, "line": 1, }, }, "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 28, - 32, - ], - "type": "Keyword", - "value": "with", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 34, - 39, - ], - "type": "Identifier", - "value": "house", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, + 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 21, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 41, - 42, + 20, + 21, ], "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "range": Array [ - 44, - 51, - ], - "type": "Identifier", - "value": "console", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/modules/export-default-array.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, + "declaration": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, + "range": Array [ + 15, + 17, + ], + "type": "ArrayExpression", }, - "range": Array [ - 51, - 52, - ], - "type": "Punctuator", - "value": ".", - }, - Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 52, - 55, + 0, + 18, ], - "type": "Identifier", - "value": "log", + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 6, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 55, - 56, + 0, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 14, + "line": 1, }, "start": Object { - "column": 13, - "line": 4, + "column": 7, + "line": 1, }, }, "range": Array [ - 56, - 60, + 7, + 14, ], - "type": "Identifier", - "value": "roof", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 15, + "line": 1, }, }, "range": Array [ - 60, - 61, + 15, + 16, ], "type": "Punctuator", - "value": ")", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 16, + "line": 1, }, }, "range": Array [ - 61, - 62, + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 18, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 17, + "line": 1, }, }, "range": Array [ - 63, - 64, + 17, + 18, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`javascript fixtures/modules/export-default-array.src 1`] = ` +exports[`javascript fixtures/modules/export-default-async-named-function.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "elements": Array [], + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 17, + "column": 38, "line": 1, }, "start": Object { @@ -105653,15 +107493,16 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 15, - 17, + 38, ], - "type": "ArrayExpression", + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 18, + "column": 38, "line": 1, }, "start": Object { @@ -105671,7 +107512,7 @@ Object { }, "range": Array [ 0, - 18, + 38, ], "type": "ExportDefaultDeclaration", }, @@ -105689,7 +107530,7 @@ Object { }, "range": Array [ 0, - 19, + 39, ], "sourceType": "module", "tokens": Array [ @@ -105732,56 +107573,128 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 29, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, "line": 1, }, "start": Object { - "column": 15, + "column": 34, "line": 1, }, }, "range": Array [ - 15, - 16, + 34, + 35, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 37, "line": 1, }, "start": Object { - "column": 16, + "column": 36, "line": 1, }, }, "range": Array [ - 16, - 17, + 36, + 37, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 38, "line": 1, }, "start": Object { - "column": 17, + "column": 37, "line": 1, }, }, "range": Array [ - 17, - 18, + 37, + 38, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", @@ -109520,6 +111433,233 @@ Object { } `; +exports[`javascript fixtures/modules/export-let.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 19, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`javascript fixtures/modules/export-named-as-default.src 1`] = ` Object { "body": Array [ diff --git a/packages/parser/tests/lib/__snapshots__/scope-analysis.ts.snap b/packages/parser/tests/lib/__snapshots__/scope-analysis.ts.snap index 0644b066632e..8fd73916d216 100644 --- a/packages/parser/tests/lib/__snapshots__/scope-analysis.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/scope-analysis.ts.snap @@ -5225,6 +5225,56 @@ Object { } `; +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/import-keyword.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 16, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 16, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/interface-type.ts 1`] = ` Object { "$id": 1, @@ -6822,6 +6872,137 @@ Object { } `; +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typed-jsx-element.tsx 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 39, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 39, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 37, + ], + "type": "JSXElement", + }, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 37, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 38, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof.ts 1`] = ` Object { "$id": 4, @@ -15395,6 +15576,31 @@ Object { } `; +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/import-keyword.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 16, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/interface-type.ts 1`] = ` Object { "$id": 0, @@ -16775,6 +16981,112 @@ Object { } `; +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typed-jsx-element.tsx 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 39, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 37, + ], + "type": "JSXElement", + }, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 37, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 38, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof.ts 1`] = ` Object { "$id": 3, diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 39c74ab7586d..f540948a5558 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -814,12 +814,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 68, ], "superClass": null, @@ -1262,12 +1262,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 86, ], "superClass": null, @@ -2567,12 +2567,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 78, ], "superClass": null, @@ -2955,12 +2955,12 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 31, ], "type": "TSInterfaceDeclaration", @@ -3114,6 +3114,398 @@ Object { } `; +exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": false, + "body": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "k", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 9, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "k", + "optional": true, + "range": Array [ + 2, + 4, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 1, + 14, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "k", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "k", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` Object { "body": Array [ @@ -35463,7 +35855,7 @@ Object { "line": 4, }, "start": Object { - "column": 21, + "column": 7, "line": 1, }, }, @@ -35559,7 +35951,7 @@ Object { }, ], "range": Array [ - 21, + 7, 54, ], "type": "TSEnumDeclaration", @@ -35851,7 +36243,7 @@ Object { "line": 4, }, "start": Object { - "column": 15, + "column": 7, "line": 1, }, }, @@ -35947,7 +36339,7 @@ Object { }, ], "range": Array [ - 15, + 7, 48, ], "type": "TSEnumDeclaration", @@ -48454,7 +48846,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 12, }, "start": Object { @@ -48466,7 +48858,7 @@ Object { "optional": true, "range": Array [ 253, - 254, + 255, ], "type": "Identifier", }, @@ -48544,7 +48936,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 13, }, "start": Object { @@ -48556,7 +48948,7 @@ Object { "optional": true, "range": Array [ 281, - 282, + 283, ], "type": "Identifier", }, @@ -53553,7 +53945,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 32, "line": 4, }, "start": Object { @@ -53565,7 +53957,7 @@ Object { "optional": true, "range": Array [ 73, - 76, + 77, ], "type": "Identifier", }, @@ -89438,7 +89830,7 @@ Object { "line": 1, }, "start": Object { - "column": 63, + "column": 7, "line": 1, }, }, @@ -89565,7 +89957,7 @@ Object { }, ], "range": Array [ - 63, + 7, 72, ], "type": "TSEnumDeclaration", diff --git a/packages/parser/tests/lib/scope-analysis.ts b/packages/parser/tests/lib/scope-analysis.ts index 8eec626225f1..b8eafccc63e9 100644 --- a/packages/parser/tests/lib/scope-analysis.ts +++ b/packages/parser/tests/lib/scope-analysis.ts @@ -159,7 +159,9 @@ describe('TypeScript scope analysis', () => { range: true, tokens: true, sourceType: 'module', - ecmaFeatures: {} + ecmaFeatures: { + jsx: path.extname(filePath) === '.tsx' + } }); const { globalScope } = scopeManager; @@ -191,7 +193,9 @@ describe('TypeScript scope analysis', () => { range: true, tokens: true, sourceType: 'script', - ecmaFeatures: {} + ecmaFeatures: { + jsx: path.extname(filePath) === '.tsx' + } }); const { globalScope } = scopeManager; diff --git a/packages/parser/tests/lib/visitor-keys.ts b/packages/parser/tests/lib/visitor-keys.ts new file mode 100644 index 000000000000..00fcde2a005e --- /dev/null +++ b/packages/parser/tests/lib/visitor-keys.ts @@ -0,0 +1,28 @@ +import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; +import { visitorKeys } from '../../src/visitor-keys'; + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +const astTypes = Object.keys(AST_NODE_TYPES); +astTypes.push('TSEmptyBodyFunctionExpression'); // node created by parser.ts + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe('visitor-keys', () => { + for (const type of astTypes) { + it(`type ${type} should be present in visitor-keys`, () => { + expect(visitorKeys).toHaveProperty(type); + }); + } + + it('check if there is no deprecated TS nodes', () => { + const TSTypes = Object.keys(visitorKeys).filter(type => + type.startsWith('TS') + ); + expect(astTypes).toEqual(expect.arrayContaining(TSTypes)); + }); +}); diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 3114aaabc99c..2c81f52bfe1e 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) diff --git a/packages/shared-fixtures/fixtures/javascript/function/function-with-return.js b/packages/shared-fixtures/fixtures/javascript/function/function-with-return.js new file mode 100644 index 000000000000..c98a373f0c38 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/function/function-with-return.js @@ -0,0 +1,3 @@ +function foo () { + return 1; +} diff --git a/packages/shared-fixtures/fixtures/javascript/function/return-multiline-sequence.src.js b/packages/shared-fixtures/fixtures/javascript/function/return-multiline-sequence.src.js new file mode 100644 index 000000000000..be3070488139 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/function/return-multiline-sequence.src.js @@ -0,0 +1,7 @@ +function foo (x, y, z) { + return ( + x, + y, + z + ); +} diff --git a/packages/shared-fixtures/fixtures/javascript/function/return-sequence.src.js b/packages/shared-fixtures/fixtures/javascript/function/return-sequence.src.js new file mode 100644 index 000000000000..3ffe77903028 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/function/return-sequence.src.js @@ -0,0 +1,3 @@ +function foo (x, y, z) { + return (x, y, z); +} diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-async-named-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-async-named-function.src.js new file mode 100644 index 000000000000..7c26b9ed6873 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/modules/export-async-named-function.src.js @@ -0,0 +1 @@ +export async function foo() {} diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-const.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-const.src.js new file mode 100644 index 000000000000..cc57a55e257d --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/modules/export-const.src.js @@ -0,0 +1 @@ +export const foo = 2; diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-default-async-named-function.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-default-async-named-function.src.js new file mode 100644 index 000000000000..c40a5f27d267 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/modules/export-default-async-named-function.src.js @@ -0,0 +1 @@ +export default async function foo() {} diff --git a/packages/shared-fixtures/fixtures/javascript/modules/export-let.src.js b/packages/shared-fixtures/fixtures/javascript/modules/export-let.src.js new file mode 100644 index 000000000000..a3bcdb0d8122 --- /dev/null +++ b/packages/shared-fixtures/fixtures/javascript/modules/export-let.src.js @@ -0,0 +1 @@ +export let foo = 2; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-optional-parameter.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-optional-parameter.src.ts new file mode 100644 index 000000000000..0289f3828aa8 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/arrow-function-with-optional-parameter.src.ts @@ -0,0 +1 @@ +((k?) => k + 1)(); diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 2424070165f4..e5b8b9613aad 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "1.1.0", + "version": "1.1.1", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index be11f821f745..2fcfd25aae42 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.1.0...v1.1.1) (2019-01-29) + +### Bug Fixes + +- **parser:** add visiting of type parameters in JSXOpeningElement ([#150](https://github.com/typescript-eslint/typescript-eslint/issues/150)) ([5e16003](https://github.com/typescript-eslint/typescript-eslint/commit/5e16003)) +- **ts-estree:** expand optional property to include question token ([#138](https://github.com/typescript-eslint/typescript-eslint/issues/138)) ([9068b62](https://github.com/typescript-eslint/typescript-eslint/commit/9068b62)) + +### Performance Improvements + +- **ts-estree:** don't create Program in parse() ([#148](https://github.com/typescript-eslint/typescript-eslint/issues/148)) ([aacf5b0](https://github.com/typescript-eslint/typescript-eslint/commit/aacf5b0)) + # [1.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.0.0...v1.1.0) (2019-01-23) ### Bug Fixes diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index a8490f513a68..2be4fceecffc 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,8 +1,9 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "1.1.0", + "version": "1.1.1", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", + "types": "dist/parser.d.ts", "files": [ "dist", "README.md", @@ -41,7 +42,7 @@ "typescript": "*" }, "devDependencies": { - "@typescript-eslint/shared-fixtures": "1.1.0", + "@typescript-eslint/shared-fixtures": "1.1.1", "typescript": "~3.2.1" } } diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 64120d6a8d85..9a7adebc8e2e 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -23,10 +23,10 @@ import { isComma, getBinaryExpressionType, isOptional, - findFirstMatchingToken, unescapeStringLiteralText, getDeclarationKind, - getLastModifier + getLastModifier, + getLineAndCharacterFor } from './node-utils'; import { AST_NODE_TYPES } from './ast-node-types'; import { ESTreeNode } from './temp-types-based-on-js-source'; @@ -796,21 +796,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null { } case SyntaxKind.ComputedPropertyName: - if (parent!.kind === SyntaxKind.ObjectLiteralExpression) { - // TODO: ComputedPropertyName has no name field - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild((node as any).name), - value: convertChild((node as any).name), - computed: false, - method: false, - shorthand: true, - kind: 'init' - }); - } else { - return convertChild(node.expression); - } - break; + return convertChild(node.expression); case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); @@ -858,38 +844,19 @@ export default function convert(config: ConvertConfig): ESTreeNode | null { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.MethodDeclaration: { - const openingParen = findFirstMatchingToken( - node.name, - ast, - (token: any) => { - if (!token || !token.kind) { - return false; - } - return getTextForTokenKind(token.kind) === '('; - }, - ast - ); - - const methodLoc = ast.getLineAndCharacterOfPosition( - (openingParen as any).getStart(ast) - ), - nodeIsMethod = node.kind === SyntaxKind.MethodDeclaration, - method: ESTreeNode = { - type: AST_NODE_TYPES.FunctionExpression, - id: null, - generator: !!node.asteriskToken, - expression: false, // ESTreeNode as ESTreeNode here - async: hasModifier(SyntaxKind.AsyncKeyword, node), - body: convertChild(node.body), - range: [node.parameters.pos - 1, result.range[1]], - loc: { - start: { - line: methodLoc.line + 1, - column: methodLoc.character - }, - end: result.loc.end - } - } as any; + const method: ESTreeNode = { + type: AST_NODE_TYPES.FunctionExpression, + id: null, + generator: !!node.asteriskToken, + expression: false, // ESTreeNode as ESTreeNode here + async: hasModifier(SyntaxKind.AsyncKeyword, node), + body: convertChild(node.body), + range: [node.parameters.pos - 1, result.range[1]], + loc: { + start: getLineAndCharacterFor(node.parameters.pos - 1, ast), + end: result.loc.end + } + } as any; if (node.type) { (method as any).returnType = convertTypeAnnotation(node.type); @@ -903,7 +870,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null { key: convertChild(node.name), value: method, computed: isComputedProperty(node.name), - method: nodeIsMethod, + method: node.kind === SyntaxKind.MethodDeclaration, shorthand: false, kind: 'init' }); @@ -992,10 +959,6 @@ export default function convert(config: ConvertConfig): ESTreeNode | null { constructorToken.end ]; - const constructorLoc = ast.getLineAndCharacterOfPosition( - node.parameters.pos - 1 - ); - const constructor: ESTreeNode = { type: AST_NODE_TYPES.FunctionExpression, id: null, @@ -1006,10 +969,7 @@ export default function convert(config: ConvertConfig): ESTreeNode | null { body: convertChild(node.body), range: [node.parameters.pos - 1, result.range[1]], loc: { - start: { - line: constructorLoc.line + 1, - column: constructorLoc.character - }, + start: getLineAndCharacterFor(node.parameters.pos - 1, ast), end: result.loc.end } } as any; @@ -1315,6 +1275,14 @@ export default function convert(config: ConvertConfig): ESTreeNode | null { } if (node.questionToken) { + if (node.questionToken.end > parameter.range[1]) { + parameter.range[1] = node.questionToken.end; + parameter.loc = getLocFor( + parameter.range[0], + parameter.range[1], + ast + ); + } parameter.optional = true; } @@ -1898,16 +1866,12 @@ export default function convert(config: ConvertConfig): ESTreeNode | null { break; case SyntaxKind.JsxExpression: { - const eloc = ast.getLineAndCharacterOfPosition(result.range[0] + 1); const expression = node.expression ? convertChild(node.expression) : { type: AST_NODE_TYPES.JSXEmptyExpression, loc: { - start: { - line: eloc.line + 1, - column: eloc.character - }, + start: getLineAndCharacterFor(result.range[0] + 1, ast), end: { line: result.loc.end.line, column: result.loc.end.column - 1 diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 240c4d1c9f71..d79353f755e6 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -9,7 +9,8 @@ import unescape from 'lodash.unescape'; import { ESTreeNodeLoc, ESTreeNode, - ESTreeToken + ESTreeToken, + LineAndColumnData } from './temp-types-based-on-js-source'; import { AST_NODE_TYPES } from './ast-node-types'; @@ -219,6 +220,23 @@ export function getBinaryExpressionType( return AST_NODE_TYPES.BinaryExpression; } +/** + * Returns line and column data for the given positions, + * @param pos position to check + * @param ast the AST object + * @returns line and column + */ +export function getLineAndCharacterFor( + pos: number, + ast: ts.SourceFile +): LineAndColumnData { + const loc = ast.getLineAndCharacterOfPosition(pos); + return { + line: loc.line + 1, + column: loc.character + }; +} + /** * Returns line and column data for the given start and end positions, * for the given AST @@ -232,18 +250,9 @@ export function getLocFor( end: number, ast: ts.SourceFile ): ESTreeNodeLoc { - const startLoc = ast.getLineAndCharacterOfPosition(start), - endLoc = ast.getLineAndCharacterOfPosition(end); - return { - start: { - line: startLoc.line + 1, - column: startLoc.character - }, - end: { - line: endLoc.line + 1, - column: endLoc.character - } + start: getLineAndCharacterFor(start, ast), + end: getLineAndCharacterFor(end, ast) }; } @@ -389,29 +398,6 @@ export function findNextToken( } } -/** - * Find the first matching token based on the given predicate function. - * @param {ts.Node} previousToken The previous ts.Token - * @param {ts.Node} parent The parent ts.Node - * @param {Function} predicate The predicate function to apply to each checked token - * @param {ts.SourceFile} ast The TS AST - * @returns {ts.Node|undefined} a matching ts.Token - */ -export function findFirstMatchingToken( - previousToken: ts.Node | undefined, - parent: ts.Node, - predicate: (node: ts.Node) => boolean, - ast: ts.SourceFile -): ts.Node | undefined { - while (previousToken) { - if (predicate(previousToken)) { - return previousToken; - } - previousToken = findNextToken(previousToken, parent, ast); - } - return undefined; -} - /** * Find the first matching ancestor based on the given predicate function. * @param {ts.Node} node The current ts.Node @@ -485,12 +471,14 @@ export function fixExports( ): ESTreeNode { // check for exports if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { - const exportKeyword = node.modifiers[0], - nextModifier = node.modifiers[1], - lastModifier = node.modifiers[node.modifiers.length - 1], - declarationIsDefault = - nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword, - varToken = findNextToken(lastModifier, ast, ast); + const exportKeyword = node.modifiers[0]; + const nextModifier = node.modifiers[1]; + const declarationIsDefault = + nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword; + + const varToken = declarationIsDefault + ? findNextToken(nextModifier, ast, ast) + : findNextToken(exportKeyword, ast, ast); result.range[0] = varToken!.getStart(ast); result.loc = getLocFor(result.range[0], result.range[1], ast); diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index ff2784aa9963..225899a106f9 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -36,7 +36,10 @@ let extra: Extra; let warnedAboutTSVersion = false; /** - * Compute the filename based on the parser options + * Compute the filename based on the parser options. + * + * Even if jsx option is set in typescript compiler, filename still has to + * contain .tsx file extension. * * @param options Parser options */ @@ -106,8 +109,6 @@ function getASTAndDefaultProject(code: string, options: ParserOptions) { * @returns {{ast: ts.SourceFile, program: ts.Program}} Returns a new source file and program corresponding to the linted code */ function createNewProgram(code: string) { - // Even if jsx option is set in typescript compiler, filename still has to - // contain .tsx file extension const FILENAME = getFileName(extra); const compilerHost = { @@ -178,6 +179,98 @@ function getProgramAndAST( ); } +function applyParserOptionsToExtra(options: ParserOptions): void { + /** + * Track range information in the AST + */ + extra.range = typeof options.range === 'boolean' && options.range; + extra.loc = typeof options.loc === 'boolean' && options.loc; + /** + * Track tokens in the AST + */ + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + /** + * Track comments in the AST + */ + if (typeof options.comment === 'boolean' && options.comment) { + extra.comment = true; + extra.comments = []; + } + /** + * Enable JSX - note the applicable file extension is still required + */ + if (typeof options.jsx === 'boolean' && options.jsx) { + extra.jsx = true; + } + /** + * The JSX AST changed the node type for string literals + * inside a JSX Element from `Literal` to `JSXText`. + * + * When value is `true`, these nodes will be parsed as type `JSXText`. + * When value is `false`, these nodes will be parsed as type `Literal`. + */ + if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { + extra.useJSXTextNode = true; + } + /** + * Allow the user to cause the parser to error if it encounters an unknown AST Node Type + * (used in testing) + */ + if ( + typeof options.errorOnUnknownASTType === 'boolean' && + options.errorOnUnknownASTType + ) { + extra.errorOnUnknownASTType = true; + } + /** + * Allow the user to override the function used for logging + */ + if (typeof options.loggerFn === 'function') { + extra.log = options.loggerFn; + } else if (options.loggerFn === false) { + extra.log = Function.prototype; + } + + if (typeof options.project === 'string') { + extra.projects = [options.project]; + } else if ( + Array.isArray(options.project) && + options.project.every(projectPath => typeof projectPath === 'string') + ) { + extra.projects = options.project; + } + + if (typeof options.tsconfigRootDir === 'string') { + extra.tsconfigRootDir = options.tsconfigRootDir; + } + + if ( + Array.isArray(options.extraFileExtensions) && + options.extraFileExtensions.every(ext => typeof ext === 'string') + ) { + extra.extraFileExtensions = options.extraFileExtensions; + } +} + +function warnAboutTSVersion(): void { + if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { + const border = '============='; + const versionWarning = [ + border, + 'WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.', + 'You may find that it works just fine, or you may not.', + `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, + `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, + 'Please only submit bug reports when using the officially supported version.', + border + ]; + extra.log(versionWarning.join('\n\n')); + warnedAboutTSVersion = true; + } +} + //------------------------------------------------------------------------------ // Parser //------------------------------------------------------------------------------ @@ -187,143 +280,118 @@ type AST = Program & (T['tokens'] extends true ? { tokens: ESTreeToken[] } : {}) & (T['comment'] extends true ? { comments: ESTreeComment[] } : {}); -/** - * Parses the given source code to produce a valid AST - * @param {string} code TypeScript code - * @param {boolean} shouldGenerateServices Flag determining whether to generate ast maps and program or not - * @param {ParserOptions} options configuration object for the parser - * @returns {Object} the AST - */ -function generateAST( +interface ParseAndGenerateServicesResult { + ast: AST; + services: { + program: ts.Program | undefined; + esTreeNodeToTSNodeMap: WeakMap | undefined; + tsNodeToESTreeNodeMap: WeakMap | undefined; + }; +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +export const version: string = packageJSON.version; + +export function parse( code: string, - options: T = {} as T, - shouldGenerateServices = false -): { - estree: AST; - program: typeof shouldGenerateServices extends true - ? ts.Program - : (ts.Program | undefined); - astMaps: typeof shouldGenerateServices extends true - ? { - esTreeNodeToTSNodeMap: WeakMap; - tsNodeToESTreeNodeMap: WeakMap; - } - : { - esTreeNodeToTSNodeMap?: WeakMap; - tsNodeToESTreeNodeMap?: WeakMap; - }; -} { + options?: T +): AST { + /** + * Reset the parse configuration + */ + resetExtra(); + /** + * Ensure users do not attempt to use parse() when they need parseAndGenerateServices() + */ + if (options && options.errorOnTypeScriptSyntacticAndSemanticIssues) { + throw new Error( + `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()` + ); + } + /** + * Ensure the source code is a string, and store a reference to it + */ if (typeof code !== 'string' && !((code as any) instanceof String)) { code = String(code); } + extra.code = code; + /** + * Apply the given parser options + */ + if (typeof options !== 'undefined') { + applyParserOptionsToExtra(options); + } + /** + * Warn if the user is using an unsupported version of TypeScript + */ + warnAboutTSVersion(); + /** + * Create a ts.SourceFile directly, no ts.Program is needed for a simple + * parse + */ + const ast = ts.createSourceFile( + getFileName(extra), + code, + ts.ScriptTarget.Latest, + /* setParentNodes */ true + ); + /** + * Convert the TypeScript AST to an ESTree-compatible one + */ + const { estree } = convert(ast, extra, false); + return estree; +} +export function parseAndGenerateServices< + T extends ParserOptions = ParserOptions +>(code: string, options: T): ParseAndGenerateServicesResult { + /** + * Reset the parse configuration + */ resetExtra(); - + /** + * Ensure the source code is a string, and store a reference to it + */ + if (typeof code !== 'string' && !((code as any) instanceof String)) { + code = String(code); + } + extra.code = code; + /** + * Apply the given parser options + */ if (typeof options !== 'undefined') { - extra.range = typeof options.range === 'boolean' && options.range; - extra.loc = typeof options.loc === 'boolean' && options.loc; - - if (typeof options.tokens === 'boolean' && options.tokens) { - extra.tokens = []; - } - - if (typeof options.comment === 'boolean' && options.comment) { - extra.comment = true; - extra.comments = []; - } - - if (typeof options.jsx === 'boolean' && options.jsx) { - extra.jsx = true; - } - - /** - * Allow the user to cause the parser to error if it encounters an unknown AST Node Type - * (used in testing). - */ - if ( - typeof options.errorOnUnknownASTType === 'boolean' && - options.errorOnUnknownASTType - ) { - extra.errorOnUnknownASTType = true; - } - - /** - * Retrieve semantic and syntactic diagnostics from the underlying TypeScript Program - * and turn them into parse errors - */ + applyParserOptionsToExtra(options); if ( - shouldGenerateServices && typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === 'boolean' && options.errorOnTypeScriptSyntacticAndSemanticIssues ) { extra.errorOnTypeScriptSyntacticAndSemanticIssues = true; } - - if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { - extra.useJSXTextNode = true; - } - - /** - * Allow the user to override the function used for logging - */ - if (typeof options.loggerFn === 'function') { - extra.log = options.loggerFn; - } else if (options.loggerFn === false) { - extra.log = Function.prototype; - } - - if (typeof options.project === 'string') { - extra.projects = [options.project]; - } else if ( - Array.isArray(options.project) && - options.project.every(projectPath => typeof projectPath === 'string') - ) { - extra.projects = options.project; - } - - if (typeof options.tsconfigRootDir === 'string') { - extra.tsconfigRootDir = options.tsconfigRootDir; - } - - if ( - Array.isArray(options.extraFileExtensions) && - options.extraFileExtensions.every(ext => typeof ext === 'string') - ) { - extra.extraFileExtensions = options.extraFileExtensions; - } } - - if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { - const border = '============='; - const versionWarning = [ - border, - 'WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.', - 'You may find that it works just fine, or you may not.', - `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, - `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, - 'Please only submit bug reports when using the officially supported version.', - border - ]; - extra.log(versionWarning.join('\n\n')); - warnedAboutTSVersion = true; - } - + /** + * Warn if the user is using an unsupported version of TypeScript + */ + warnAboutTSVersion(); + /** + * Generate a full ts.Program in order to be able to provide parser + * services, such as type-checking + */ const shouldProvideParserServices = - shouldGenerateServices && extra.projects && extra.projects.length > 0; + extra.projects && extra.projects.length > 0; const { ast, program } = getProgramAndAST( code, options, shouldProvideParserServices ); - - extra.code = code; - /** - * Convert the AST + * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve + * mappings between converted and original AST nodes */ const { estree, astMaps } = convert(ast, extra, shouldProvideParserServices); - /** * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, * there may be other syntactic or semantic issues in the code that we can optionally report on. @@ -334,42 +402,21 @@ function generateAST( throw convertError(error); } } - - return { - estree, - program: shouldProvideParserServices ? program : undefined, - astMaps: shouldProvideParserServices - ? astMaps! - : { esTreeNodeToTSNodeMap: undefined, tsNodeToESTreeNodeMap: undefined } - }; -} - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -export const version: string = packageJSON.version; - -export function parse( - code: string, - options?: T -) { - if (options && options.errorOnTypeScriptSyntacticAndSemanticIssues) { - throw new Error( - `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()` - ); - } - return generateAST(code, options).estree; -} - -export function parseAndGenerateServices(code: string, options: ParserOptions) { - const result = generateAST(code, options, /*shouldGenerateServices*/ true); + /** + * Return the converted AST and additional parser services + */ return { - ast: result.estree, + ast: estree, services: { - program: result.program, - esTreeNodeToTSNodeMap: result.astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: result.astMaps.tsNodeToESTreeNodeMap + program: shouldProvideParserServices ? program : undefined, + esTreeNodeToTSNodeMap: + shouldProvideParserServices && astMaps + ? astMaps.esTreeNodeToTSNodeMap + : undefined, + tsNodeToESTreeNodeMap: + shouldProvideParserServices && astMaps + ? astMaps.tsNodeToESTreeNodeMap + : undefined } }; } diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 3b1a21e43d80..e92f68f968f4 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -167,6 +167,15 @@ tester.addFixturePatternConfig('javascript/arrowFunctions', { 'error-strict-dup-params' // babel parse errors ] }); +tester.addFixturePatternConfig('javascript/function', { + ignore: [ + /** + * Babel has invalid end range of multiline SequenceExpression + * TODO: report it to babel + */ + 'return-multiline-sequence' + ] +}); tester.addFixturePatternConfig('javascript/bigIntLiterals'); tester.addFixturePatternConfig('javascript/binaryLiterals'); @@ -323,11 +332,6 @@ tester.addFixturePatternConfig('typescript/basics', { * TODO: Investigate in more depth, potentially split up different parts of the interface */ 'interface-with-all-property-types', // babel parse errors - /** - * there is difference in range between babel and ts-estree - */ - 'export-declare-const-named-enum', - 'interface-with-optional-properties', /** * Babel parses it as TSQualifiedName * ts parses it as MemberExpression @@ -358,7 +362,18 @@ tester.addFixturePatternConfig('typescript/basics', { * Babel parses this incorrectly * https://github.com/babel/babel/issues/9324 */ - 'type-assertion-arrow-function' + 'type-assertion-arrow-function', + /** + * PR for range of declare keyword has been merged into Babel: https://github.com/babel/babel/pull/9406 + * TODO: remove me in next babel > 7.3.1 + */ + 'export-declare-const-named-enum', + 'export-declare-named-enum', + /** + * Babel does not include optional keyword into range parameter in arrow function + * TODO: report it to babel + */ + 'arrow-function-with-optional-parameter' ], ignoreSourceType: [ /** @@ -417,13 +432,8 @@ tester.addFixturePatternConfig('typescript/declare', { tester.addFixturePatternConfig('typescript/namespaces-and-modules', { fileType: 'ts', - ignore: [ - /** - * Minor AST difference - */ - 'nested-internal-module' - ], ignoreSourceType: [ + 'nested-internal-module', 'module-with-default-exports', 'ambient-module-declaration-with-import', 'declare-namespace-with-exported-function' diff --git a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap index 8d02532b8d7f..85045786c853 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap @@ -99058,125 +99058,217 @@ Object { } `; -exports[`javascript fixtures/generators/anonymous-generator.src 1`] = ` +exports[`javascript fixtures/function/return-multiline-sequence.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "expressions": Array [ + Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 3, }, }, - "name": "v", + "name": "x", "range": Array [ - 22, - 23, + 40, + 41, ], "type": "Identifier", }, - "delegate": false, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - "start": Object { - "column": 16, - "line": 1, + "name": "y", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, }, + "name": "z", + "range": Array [ + 54, + 55, + ], + "type": "Identifier", }, - "range": Array [ - 16, - 23, - ], - "type": "YieldExpression", - }, + ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 16, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 16, - 23, + 40, + 55, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, + "type": "SequenceExpression", }, - "start": Object { - "column": 14, - "line": 1, + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, }, + "range": Array [ + 27, + 60, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 1, }, - "range": Array [ - 14, - 25, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": true, - "id": null, + "range": Array [ + 23, + 62, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 9, "line": 1, }, }, - "params": Array [], + "name": "foo", "range": Array [ - 1, - 25, + 9, + 12, ], - "type": "FunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 7, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + ], "range": Array [ 0, - 27, + 62, ], - "type": "ExpressionStatement", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -99185,14 +99277,14 @@ Object { }, "range": Array [ 0, - 27, + 63, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -99202,377 +99294,313 @@ Object { }, "range": Array [ 0, - 1, + 8, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 9, "line": 1, }, }, "range": Array [ - 1, 9, + 12, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": "*", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 12, + 14, + 15, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 15, "line": 1, }, }, "range": Array [ - 12, - 13, + 15, + 16, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 17, "line": 1, }, }, "range": Array [ - 14, - 15, + 17, + 18, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 1, }, "start": Object { - "column": 16, + "column": 18, "line": 1, }, }, "range": Array [ - 16, - 21, + 18, + 19, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 1, }, "start": Object { - "column": 22, + "column": 20, "line": 1, }, }, "range": Array [ - 22, - 23, + 20, + 21, ], "type": "Identifier", - "value": "v", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 22, "line": 1, }, "start": Object { - "column": 24, + "column": 21, "line": 1, }, }, "range": Array [ - 24, - 25, + 21, + 22, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 24, "line": 1, }, "start": Object { - "column": 25, + "column": 23, "line": 1, }, }, "range": Array [ - 25, - 26, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 26, 27, + 33, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "return", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/generators/async-generator-function.src 1`] = ` -Object { - "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 23, - 27, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 10, + "line": 2, }, "start": Object { - "column": 0, + "column": 9, "line": 2, }, }, - "params": Array [], "range": Array [ - 1, - 27, + 34, + 35, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 1, - 28, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 2, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 1, - 6, + 40, + 41, ], "type": "Identifier", - "value": "async", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 6, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 7, - 15, + 41, + 42, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 15, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 16, - 17, + 47, + 48, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 6, + "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, }, "range": Array [ - 17, - 20, + 48, + 49, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 5, + "line": 5, }, "start": Object { - "column": 19, - "line": 2, + "column": 4, + "line": 5, }, }, "range": Array [ - 20, - 21, + 54, + 55, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 3, + "line": 6, }, "start": Object { - "column": 20, - "line": 2, + "column": 2, + "line": 6, }, }, "range": Array [ - 21, - 22, + 58, + 59, ], "type": "Punctuator", "value": ")", @@ -99580,35 +99608,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 4, + "line": 6, }, "start": Object { - "column": 22, - "line": 2, + "column": 3, + "line": 6, }, }, "range": Array [ - 23, - 24, + 59, + 60, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 7, }, "start": Object { "column": 0, - "line": 4, + "line": 7, }, }, "range": Array [ - 26, - 27, + 61, + 62, ], "type": "Punctuator", "value": "}", @@ -99618,257 +99646,217 @@ Object { } `; -exports[`javascript fixtures/generators/async-generator-method.src 1`] = ` +exports[`javascript fixtures/function/return-sequence.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { "body": Array [ Object { - "computed": false, - "key": Object { + "argument": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "z", + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 2, }, "start": Object { - "column": 12, + "column": 10, "line": 2, }, }, - "name": "f", "range": Array [ - 22, - 23, + 35, + 42, ], - "type": "Identifier", + "type": "SequenceExpression", }, - "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 19, + "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 14, - 63, + 27, + 44, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 42, - 43, - ], - "type": "Identifier", - }, - "init": Object { - "argument": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 3, - }, - "start": Object { - "column": 25, - "line": 3, - }, - }, - "name": "g", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 25, - "line": 3, - }, - }, - "range": Array [ - 53, - 56, - ], - "type": "CallExpression", - }, - "delegate": true, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "range": Array [ - 46, - 56, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 42, - 56, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 36, - 57, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 63, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 23, - 63, - ], - "type": "FunctionExpression", - }, + "type": "ReturnStatement", }, ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 8, + "column": 23, "line": 1, }, }, "range": Array [ - 8, - 65, + 23, + 46, ], - "type": "ClassBody", + "type": "BlockStatement", }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "C", + "name": "foo", "range": Array [ - 6, - 7, + 9, + 12, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + ], "range": Array [ 0, - 65, + 46, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -99877,14 +99865,14 @@ Object { }, "range": Array [ 0, - 66, + 47, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -99893,332 +99881,2485 @@ Object { }, }, "range": Array [ - 0, - 5, + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/anonymous-generator.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 25, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/async-generator-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 1, + 27, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/async-generator-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "f", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 63, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "init": Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "name": "g", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "CallExpression", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 56, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 56, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 57, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 65, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 51, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/double-yield.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "type": "YieldExpression", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 32, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 32, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/empty-generator-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "t", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 16, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "t", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 11, "line": 1, }, }, "range": Array [ - 6, - 7, + 11, + 12, ], - "type": "Identifier", - "value": "C", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 12, "line": 1, }, }, "range": Array [ - 8, - 9, + 12, + 13, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ 14, - 19, + 15, ], - "type": "Identifier", - "value": "async", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 20, - 21, + 15, + 16, ], "type": "Punctuator", - "value": "*", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 22, - 23, + 16, + 17, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/generators/generator-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 0, + "line": 1, }, }, + "params": Array [], "range": Array [ - 23, - 24, + 0, + 30, ], - "type": "Punctuator", - "value": "(", + "type": "FunctionDeclaration", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 30, + "line": 1, }, }, "range": Array [ - 24, - 25, + 30, + 31, ], - "type": "Punctuator", - "value": ")", + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 8, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { "column": 8, - "line": 3, + "line": 1, }, }, "range": Array [ - 36, - 41, + 8, + 9, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { - "end": Object { - "column": 15, - "line": 3, + "end": Object { + "column": 14, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 42, - 43, + 10, + 14, ], "type": "Identifier", - "value": "x", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 44, - 45, + 15, + 16, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 16, + "line": 1, }, }, "range": Array [ - 46, - 51, + 16, + 17, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 3, + "column": 19, + "line": 1, }, "start": Object { - "column": 23, - "line": 3, + "column": 18, + "line": 1, }, }, "range": Array [ - 51, - 52, + 18, + 19, ], "type": "Punctuator", - "value": "*", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 25, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 53, - 54, + 20, + 25, ], - "type": "Identifier", - "value": "g", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 3, + "line": 1, }, "start": Object { "column": 26, - "line": 3, + "line": 1, }, }, "range": Array [ - 54, - 55, + 26, + 27, ], "type": "Punctuator", - "value": "(", + "value": "*", }, Object { "loc": Object { "end": Object { "column": 28, - "line": 3, + "line": 1, }, "start": Object { "column": 27, - "line": 3, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, + "line": 1, }, }, "range": Array [ - 56, - 57, + 27, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 30, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 29, + "line": 1, }, }, "range": Array [ - 62, - 63, + 29, + 30, ], "type": "Punctuator", "value": "}", @@ -100226,27 +102367,27 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 30, + "line": 1, }, }, "range": Array [ - 64, - 65, + 30, + 31, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`javascript fixtures/generators/double-yield.src 1`] = ` +exports[`javascript fixtures/generators/yield-delegation.src 1`] = ` Object { "body": Array [ Object { @@ -100257,46 +102398,27 @@ Object { Object { "expression": Object { "argument": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 30, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "delegate": false, "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 22, + "column": 23, "line": 1, }, }, + "name": "v", "range": Array [ - 22, - 30, + 23, + 24, ], - "type": "YieldExpression", + "type": "Identifier", }, - "delegate": false, + "delegate": true, "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { @@ -100306,13 +102428,13 @@ Object { }, "range": Array [ 16, - 30, + 24, ], "type": "YieldExpression", }, "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { @@ -100322,14 +102444,14 @@ Object { }, "range": Array [ 16, - 30, + 24, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { @@ -100339,7 +102461,7 @@ Object { }, "range": Array [ 14, - 32, + 26, ], "type": "BlockStatement", }, @@ -100348,7 +102470,7 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { @@ -100359,13 +102481,13 @@ Object { "params": Array [], "range": Array [ 1, - 32, + 26, ], "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 34, + "column": 28, "line": 1, }, "start": Object { @@ -100375,14 +102497,14 @@ Object { }, "range": Array [ 0, - 34, + 28, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 34, + "column": 28, "line": 1, }, "start": Object { @@ -100392,7 +102514,7 @@ Object { }, "range": Array [ 0, - 34, + 28, ], "sourceType": "script", "tokens": Array [ @@ -100525,7 +102647,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 23, "line": 1, }, "start": Object { @@ -100535,43 +102657,43 @@ Object { }, "range": Array [ 22, - 27, + 23, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 28, + "column": 23, "line": 1, }, }, "range": Array [ - 28, - 30, + 23, + 24, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { - "column": 31, + "column": 25, "line": 1, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "Punctuator", "value": "}", @@ -100579,17 +102701,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 27, "line": 1, }, "start": Object { - "column": 32, + "column": 26, "line": 1, }, }, "range": Array [ - 32, - 33, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -100597,17 +102719,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 28, "line": 1, }, "start": Object { - "column": 33, + "column": 27, "line": 1, }, }, "range": Array [ - 33, - 34, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -100617,52 +102739,90 @@ Object { } `; -exports[`javascript fixtures/generators/empty-generator-declaration.src 1`] = ` +exports[`javascript fixtures/generators/yield-without-value.src 1`] = ` Object { "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, + "range": Array [ + 14, + 24, + ], + "type": "BlockStatement", }, - "range": Array [ - 14, - 16, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { + "expression": false, + "generator": true, + "id": null, "loc": Object { "end": Object { - "column": 11, + "column": 24, "line": 1, }, "start": Object { - "column": 10, + "column": 1, "line": 1, }, }, - "name": "t", + "params": Array [], "range": Array [ - 10, - 11, + 1, + 24, ], - "type": "Identifier", + "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { @@ -100670,35 +102830,17 @@ Object { "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 16, - ], - "type": "FunctionDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, + 26, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -100707,14 +102849,14 @@ Object { }, "range": Array [ 0, - 17, + 27, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -100724,10 +102866,10 @@ Object { }, "range": Array [ 0, - 8, + 1, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -100736,34 +102878,34 @@ Object { "line": 1, }, "start": Object { - "column": 8, + "column": 1, "line": 1, }, }, "range": Array [ - 8, + 1, 9, ], - "type": "Punctuator", - "value": "*", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 11, ], - "type": "Identifier", - "value": "t", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { @@ -100822,17 +102964,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 15, + "column": 16, "line": 1, }, }, "range": Array [ - 15, 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, ], "type": "Punctuator", "value": "}", @@ -100840,17 +103018,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -100860,102 +103056,123 @@ Object { } `; -exports[`javascript fixtures/generators/generator-declaration.src 1`] = ` +exports[`javascript fixtures/generators/yield-without-value-in-call.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "YieldExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "fn", + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, + "column": 25, "line": 1, }, "start": Object { - "column": 27, + "column": 16, "line": 1, }, }, - "name": "v", "range": Array [ - 27, - 28, + 16, + 25, ], - "type": "Identifier", + "type": "CallExpression", }, - "delegate": true, "loc": Object { "end": Object { - "column": 28, + "column": 26, "line": 1, }, "start": Object { - "column": 20, + "column": 16, "line": 1, }, }, "range": Array [ - 20, - 28, + 16, + 26, ], - "type": "YieldExpression", + "type": "ExpressionStatement", }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 20, - 28, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, }, + "range": Array [ + 14, + 28, + ], + "type": "BlockStatement", }, - "range": Array [ - 18, - 30, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { + "expression": false, + "generator": true, + "id": null, "loc": Object { "end": Object { - "column": 14, + "column": 28, "line": 1, }, "start": Object { - "column": 10, + "column": 1, "line": 1, }, }, - "name": "test", + "params": Array [], "range": Array [ - 10, - 14, + 1, + 28, ], - "type": "Identifier", + "type": "FunctionExpression", }, "loc": Object { "end": Object { @@ -100967,35 +103184,17 @@ Object { "line": 1, }, }, - "params": Array [], "range": Array [ 0, 30, ], - "type": "FunctionDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -101011,7 +103210,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -101021,7 +103220,25 @@ Object { }, "range": Array [ 0, - 8, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, ], "type": "Keyword", "value": "function", @@ -101029,17 +103246,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "range": Array [ - 8, 9, + 10, ], "type": "Punctuator", "value": "*", @@ -101047,43 +103264,61 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, - 14, + 11, + 12, ], - "type": "Identifier", - "value": "test", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 13, "line": 1, }, "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { "column": 15, "line": 1, }, + "start": Object { + "column": 14, + "line": 1, + }, }, "range": Array [ + 14, 15, - 16, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -101093,10 +103328,10 @@ Object { }, "range": Array [ 16, - 17, + 18, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { @@ -101114,22 +103349,22 @@ Object { 19, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ - 20, - 25, + 19, + 24, ], "type": "Keyword", "value": "yield", @@ -101137,20 +103372,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 25, "line": 1, }, "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { "column": 26, "line": 1, }, + "start": Object { + "column": 25, + "line": 1, + }, }, "range": Array [ + 25, 26, - 27, ], "type": "Punctuator", - "value": "*", + "value": ";", }, Object { "loc": Object { @@ -101167,41 +103420,41 @@ Object { 27, 28, ], - "type": "Identifier", - "value": "v", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 29, "line": 1, }, "start": Object { - "column": 29, + "column": 28, "line": 1, }, }, "range": Array [ + 28, 29, - 30, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 1, }, "start": Object { - "column": 30, + "column": 29, "line": 1, }, }, "range": Array [ + 29, 30, - 31, ], "type": "Punctuator", "value": ";", @@ -101211,7 +103464,7 @@ Object { } `; -exports[`javascript fixtures/generators/yield-delegation.src 1`] = ` +exports[`javascript fixtures/generators/yield-without-value-no-semi.src 1`] = ` Object { "body": Array [ Object { @@ -101219,30 +103472,13 @@ Object { "async": false, "body": Object { "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "v", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "delegate": true, + Object { + "expression": Object { + "argument": null, + "delegate": false, "loc": Object { "end": Object { - "column": 24, + "column": 21, "line": 1, }, "start": Object { @@ -101252,13 +103488,13 @@ Object { }, "range": Array [ 16, - 24, + 21, ], "type": "YieldExpression", }, "loc": Object { "end": Object { - "column": 24, + "column": 21, "line": 1, }, "start": Object { @@ -101268,14 +103504,14 @@ Object { }, "range": Array [ 16, - 24, + 21, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { @@ -101285,7 +103521,7 @@ Object { }, "range": Array [ 14, - 26, + 23, ], "type": "BlockStatement", }, @@ -101294,7 +103530,7 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { @@ -101305,13 +103541,13 @@ Object { "params": Array [], "range": Array [ 1, - 26, + 23, ], "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 28, + "column": 25, "line": 1, }, "start": Object { @@ -101321,15 +103557,15 @@ Object { }, "range": Array [ 0, - 28, + 25, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -101338,7 +103574,7 @@ Object { }, "range": Array [ 0, - 28, + 26, ], "sourceType": "script", "tokens": Array [ @@ -101484,7 +103720,7 @@ Object { 23, ], "type": "Punctuator", - "value": "*", + "value": "}", }, Object { "loc": Object { @@ -101501,59 +103737,23 @@ Object { 23, 24, ], - "type": "Identifier", - "value": "v", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], "type": "Punctuator", "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 25, "line": 1, }, "start": Object { - "column": 27, + "column": 24, "line": 1, }, }, "range": Array [ - 27, - 28, + 24, + 25, ], "type": "Punctuator", "value": ";", @@ -101563,90 +103763,31 @@ Object { } `; -exports[`javascript fixtures/generators/yield-without-value.src 1`] = ` +exports[`javascript fixtures/globalReturn/return-identifier.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": null, - "delegate": false, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 21, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 22, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 24, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, + "argument": Object { "loc": Object { "end": Object { - "column": 24, + "column": 11, "line": 1, }, "start": Object { - "column": 1, + "column": 7, "line": 1, }, }, - "params": Array [], + "name": "fooz", "range": Array [ - 1, - 24, + 7, + 11, ], - "type": "FunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 26, + "column": 12, "line": 1, }, "start": Object { @@ -101656,9 +103797,9 @@ Object { }, "range": Array [ 0, - 26, + 12, ], - "type": "ExpressionStatement", + "type": "ReturnStatement", }, ], "loc": Object { @@ -101673,14 +103814,14 @@ Object { }, "range": Array [ 0, - 27, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -101690,46 +103831,28 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 9, + 6, ], "type": "Keyword", - "value": "function", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 10, + 7, + 11, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "fooz", }, Object { "loc": Object { @@ -101747,130 +103870,198 @@ Object { 12, ], "type": "Punctuator", - "value": "(", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/globalReturn/return-no-arg.src 1`] = ` +Object { + "body": Array [ Object { + "argument": null, "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 12, + "column": 0, "line": 1, }, }, "range": Array [ - 12, - 13, + 0, + 7, ], - "type": "Punctuator", - "value": ")", + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, + "column": 6, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 6, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 7, "line": 1, }, "start": Object { - "column": 16, + "column": 6, "line": 1, }, }, "range": Array [ - 16, - 21, + 6, + 7, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/globalReturn/return-true.src 1`] = ` +Object { + "body": Array [ Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, "loc": Object { "end": Object { - "column": 22, + "column": 12, "line": 1, }, "start": Object { - "column": 21, + "column": 0, "line": 1, }, }, "range": Array [ - 21, - 22, + 0, + 12, ], - "type": "Punctuator", - "value": ";", + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, + "column": 6, "line": 1, }, "start": Object { - "column": 23, + "column": 0, "line": 1, }, }, "range": Array [ - 23, - 24, + 0, + 6, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 11, "line": 1, }, "start": Object { - "column": 24, + "column": 7, "line": 1, }, }, "range": Array [ - 24, - 25, + 7, + 11, ], - "type": "Punctuator", - "value": ")", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 12, "line": 1, }, "start": Object { - "column": 25, + "column": 11, "line": 1, }, }, "range": Array [ - 25, - 26, + 11, + 12, ], "type": "Punctuator", "value": ";", @@ -101880,127 +104071,34 @@ Object { } `; -exports[`javascript fixtures/generators/yield-without-value-in-call.src 1`] = ` +exports[`javascript fixtures/hexLiterals/invalid.src 1`] = `"';' expected."`; + +exports[`javascript fixtures/hexLiterals/lowercase.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "argument": null, - "delegate": false, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "YieldExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "fn", - "range": Array [ - 16, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 25, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 26, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 28, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, "loc": Object { "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, - "params": Array [], "range": Array [ - 1, - 28, + 0, + 6, ], - "type": "FunctionExpression", + "raw": "0x2343", + "type": "Literal", + "value": 9027, }, "loc": Object { "end": Object { - "column": 30, + "column": 7, "line": 1, }, "start": Object { @@ -102010,7 +104108,7 @@ Object { }, "range": Array [ 0, - 30, + 7, ], "type": "ExpressionStatement", }, @@ -102027,14 +104125,14 @@ Object { }, "range": Array [ 0, - 31, + 8, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -102044,241 +104142,361 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 9, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, + 6, ], - "type": "Punctuator", - "value": "*", + "type": "Numeric", + "value": "0x2343", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 7, "line": 1, }, "start": Object { - "column": 11, + "column": 6, "line": 1, }, }, "range": Array [ - 11, - 12, + 6, + 7, ], "type": "Punctuator", - "value": "(", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/hexLiterals/uppercase.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "raw": "0X2343", + "type": "Literal", + "value": 9027, + }, "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 12, + "column": 0, "line": 1, }, }, "range": Array [ - 12, - 13, + 0, + 7, ], - "type": "Punctuator", - "value": ")", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, + "column": 6, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 6, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "0X2343", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 7, "line": 1, }, "start": Object { - "column": 16, + "column": 6, "line": 1, }, }, "range": Array [ - 16, - 18, + 6, + 7, ], - "type": "Identifier", - "value": "fn", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/importMeta/simple-import-meta.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "import", + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "meta", + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 11, + ], + "type": "MetaProperty", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "url", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 15, + ], + "type": "MemberExpression", + }, "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 16, ], - "type": "Punctuator", - "value": "(", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, + "column": 6, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 24, + 0, + 6, ], "type": "Keyword", - "value": "yield", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 7, "line": 1, }, "start": Object { - "column": 24, + "column": 6, "line": 1, }, }, "range": Array [ - 24, - 25, + 6, + 7, ], "type": "Punctuator", - "value": ")", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 11, "line": 1, }, "start": Object { - "column": 25, + "column": 7, "line": 1, }, }, "range": Array [ - 25, - 26, + 7, + 11, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "meta", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 12, "line": 1, }, "start": Object { - "column": 27, + "column": 11, "line": 1, }, }, "range": Array [ - 27, - 28, + 11, + 12, ], "type": "Punctuator", - "value": "}", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 15, "line": 1, }, "start": Object { - "column": 28, + "column": 12, "line": 1, }, }, "range": Array [ - 28, - 29, + 12, + 15, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "url", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 16, "line": 1, }, "start": Object { - "column": 29, + "column": 15, "line": 1, }, }, "range": Array [ - 29, - 30, + 15, + 16, ], "type": "Punctuator", "value": ";", @@ -102288,91 +104506,140 @@ Object { } `; -exports[`javascript fixtures/generators/yield-without-value-no-semi.src 1`] = ` +exports[`javascript fixtures/labels/label-break.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, + "body": Object { "body": Object { "body": Array [ Object { - "expression": Object { - "argument": null, - "delegate": false, + "label": Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 3, }, }, + "name": "loop1", "range": Array [ - 16, - 21, + 33, + 38, ], - "type": "YieldExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 16, - 21, + 27, + 39, ], - "type": "ExpressionStatement", + "type": "BreakStatement", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "BreakStatement", }, ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 14, - "line": 1, + "line": 2, }, }, "range": Array [ - 14, - 23, + 21, + 54, ], "type": "BlockStatement", }, - "expression": false, - "generator": true, - "id": null, "loc": Object { "end": Object { - "column": 23, + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 9, + 54, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + "label": Object { + "loc": Object { + "end": Object { + "column": 5, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, - "params": Array [], + "name": "loop1", "range": Array [ - 1, - 23, + 0, + 5, ], - "type": "FunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, @@ -102381,15 +104648,15 @@ Object { }, "range": Array [ 0, - 25, + 54, ], - "type": "ExpressionStatement", + "type": "LabeledStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -102398,14 +104665,14 @@ Object { }, "range": Array [ 0, - 26, + 55, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -102415,79 +104682,97 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "loop1", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 1, + "column": 5, "line": 1, }, }, "range": Array [ - 1, + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ 9, + 14, ], "type": "Keyword", - "value": "function", + "value": "while", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 9, - 10, + 14, + 15, ], "type": "Punctuator", - "value": "*", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 11, - 12, + 15, + 19, ], - "type": "Punctuator", - "value": "(", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 1, + "line": 2, }, "start": Object { "column": 12, - "line": 1, + "line": 2, }, }, "range": Array [ - 12, - 13, + 19, + 20, ], "type": "Punctuator", "value": ")", @@ -102496,220 +104781,267 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 1, + "line": 2, }, "start": Object { "column": 14, - "line": 1, + "line": 2, }, }, "range": Array [ - 14, - 15, + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 33, + 38, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "loop1", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 16, - 21, + 38, + 39, ], - "type": "Keyword", - "value": "yield", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 9, + "line": 4, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 22, - 23, + 44, + 49, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "break", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 10, + "line": 4, }, "start": Object { - "column": 23, - "line": 1, + "column": 9, + "line": 4, }, }, "range": Array [ - 23, - 24, + 49, + 50, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 24, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 24, - 25, + 53, + 54, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`javascript fixtures/globalReturn/return-identifier.src 1`] = ` +exports[`javascript fixtures/labels/label-continue.src 1`] = ` Object { "body": Array [ Object { - "argument": Object { + "body": Object { + "body": Object { + "body": Array [ + Object { + "label": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "loop1", + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 42, + ], + "type": "ContinueStatement", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "ContinueStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 21, + 60, + ], + "type": "BlockStatement", + }, "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "fooz", "range": Array [ - 7, - 11, + 9, + 60, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 12, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 13, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "test": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "raw": "true", + "type": "Literal", + "value": true, }, + "type": "WhileStatement", }, - "range": Array [ - 7, - 11, - ], - "type": "Identifier", - "value": "fooz", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, + "label": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "name": "loop1", + "range": Array [ + 0, + 5, + ], + "type": "Identifier", }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/globalReturn/return-no-arg.src 1`] = ` -Object { - "body": Array [ - Object { - "argument": null, "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, @@ -102718,15 +105050,15 @@ Object { }, "range": Array [ 0, - 7, + 60, ], - "type": "ReturnStatement", + "type": "LabeledStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -102735,14 +105067,14 @@ Object { }, "range": Array [ 0, - 8, + 61, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 5, "line": 1, }, "start": Object { @@ -102752,122 +105084,79 @@ Object { }, "range": Array [ 0, - 6, + 5, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "loop1", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ + 5, 6, - 7, ], "type": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/globalReturn/return-true.src 1`] = ` -Object { - "body": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 0, - 12, + 9, + 14, ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "while", }, - }, - "range": Array [ - 0, - 13, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 0, - 6, + 14, + 15, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 7, - 11, + 15, + 19, ], "type": "Boolean", "value": "true", @@ -102875,271 +105164,205 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 11, - 12, + 19, + 20, ], "type": "Punctuator", - "value": ";", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/hexLiterals/invalid.src 1`] = `"';' expected."`; - -exports[`javascript fixtures/hexLiterals/lowercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, }, - "range": Array [ - 0, - 6, - ], - "raw": "0x2343", - "type": "Literal", - "value": 9027, }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 0, - 7, + 27, + 35, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "continue", }, - }, - "range": Array [ - 0, - 8, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 18, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 0, - 6, + 36, + 41, ], - "type": "Numeric", - "value": "0x2343", + "type": "Identifier", + "value": "loop1", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 19, + "line": 3, }, "start": Object { - "column": 6, - "line": 1, + "column": 18, + "line": 3, }, }, "range": Array [ - 6, - 7, + 41, + 42, ], "type": "Punctuator", "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/hexLiterals/uppercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "raw": "0X2343", - "type": "Literal", - "value": 9027, - }, "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 12, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 0, - 7, + 47, + 55, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "continue", }, - }, - "range": Array [ - 0, - 8, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 12, + "line": 4, }, }, "range": Array [ - 0, - 6, + 55, + 56, ], - "type": "Numeric", - "value": "0X2343", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 6, - 7, + 59, + 60, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`javascript fixtures/importMeta/simple-import-meta.src 1`] = ` +exports[`javascript fixtures/modules/error-delete.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "source": Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, - "object": Object { + "range": Array [ + 14, + 17, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "specifiers": Array [ + Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 1, }, "start": Object { - "column": 0, + "column": 7, "line": 1, }, }, - "meta": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "import", - "range": Array [ - 0, - 6, - ], - "type": "Identifier", - }, - "property": Object { + "local": Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 1, }, "start": Object { @@ -103147,56 +105370,73 @@ Object { "line": 1, }, }, - "name": "meta", + "name": "x", "range": Array [ 7, - 11, + 8, ], "type": "Identifier", }, "range": Array [ - 0, - 11, + 7, + 8, ], - "type": "MetaProperty", + "type": "ImportDefaultSpecifier", }, - "property": Object { + ], + "type": "ImportDeclaration", + }, + Object { + "expression": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 2, }, }, - "name": "url", + "name": "x", "range": Array [ - 12, - 15, + 26, + 27, ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "delete", + "prefix": true, "range": Array [ - 0, - 15, + 19, + 27, ], - "type": "MemberExpression", + "type": "UnaryExpression", }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 16, + 19, + 28, ], "type": "ExpressionStatement", }, @@ -103204,7 +105444,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 3, }, "start": Object { "column": 0, @@ -103213,7 +105453,7 @@ Object { }, "range": Array [ 0, - 17, + 29, ], "sourceType": "module", "tokens": Array [ @@ -103238,89 +105478,125 @@ Object { Object { "loc": Object { "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { "column": 7, "line": 1, }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, "start": Object { - "column": 6, + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, "line": 1, }, }, "range": Array [ - 6, - 7, + 14, + 17, ], - "type": "Punctuator", - "value": ".", + "type": "String", + "value": "\\"x\\"", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, "range": Array [ - 7, - 11, + 17, + 18, ], - "type": "Identifier", - "value": "meta", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 11, - 12, + 19, + 25, ], - "type": "Punctuator", - "value": ".", + "type": "Keyword", + "value": "delete", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 12, - 15, + 26, + 27, ], "type": "Identifier", - "value": "url", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 15, - 16, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -103330,157 +105606,107 @@ Object { } `; -exports[`javascript fixtures/labels/label-break.src 1`] = ` +exports[`javascript fixtures/modules/error-function.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { - "body": Object { - "body": Array [ - Object { - "label": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "name": "loop1", - "range": Array [ - 33, - 38, - ], - "type": "Identifier", - }, + "body": Array [ + Object { + "declaration": Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 23, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 16, + "line": 2, }, }, + "name": "friends", "range": Array [ - 27, - 39, + 31, + 38, ], - "type": "BreakStatement", + "type": "Identifier", }, - Object { - "label": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, }, - "range": Array [ - 44, - 50, - ], - "type": "BreakStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 2, }, + "range": Array [ + 16, + 39, + ], + "type": "ExportDefaultDeclaration", }, - "range": Array [ - 21, - 54, - ], - "type": "BlockStatement", - }, + ], "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { - "column": 2, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 9, - 54, + 13, + 41, ], - "test": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 15, - 19, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - "type": "WhileStatement", + "type": "BlockStatement", }, - "label": Object { + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 1, }, "start": Object { - "column": 0, + "column": 9, "line": 1, }, }, - "name": "loop1", + "name": "x", "range": Array [ - 0, - 5, + 9, + 10, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 54, + 41, ], - "type": "LabeledStatement", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 5, }, "start": Object { "column": 0, @@ -103489,14 +105715,14 @@ Object { }, "range": Array [ 0, - 55, + 43, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -103506,61 +105732,43 @@ Object { }, "range": Array [ 0, - 5, + 8, ], - "type": "Identifier", - "value": "loop1", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, - "range": Array [ - 5, - 6, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, "range": Array [ 9, - 14, + 10, ], - "type": "Keyword", - "value": "while", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -103569,101 +105777,101 @@ Object { "loc": Object { "end": Object { "column": 12, - "line": 2, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 15, - 19, + 11, + 12, ], - "type": "Boolean", - "value": "true", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 19, - 20, + 13, + 14, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { - "column": 14, + "column": 1, "line": 2, }, }, "range": Array [ - 21, + 16, 22, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 15, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 8, + "line": 2, }, }, "range": Array [ - 27, - 32, + 23, + 30, ], "type": "Keyword", - "value": "break", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 23, + "line": 2, }, "start": Object { - "column": 10, - "line": 3, + "column": 16, + "line": 2, }, }, "range": Array [ - 33, + 31, 38, ], "type": "Identifier", - "value": "loop1", + "value": "friends", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 24, + "line": 2, }, "start": Object { - "column": 15, - "line": 3, + "column": 23, + "line": 2, }, }, "range": Array [ @@ -103676,207 +105884,263 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 1, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 44, - 49, + 40, + 41, ], - "type": "Keyword", - "value": "break", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/modules/error-strict.src 1`] = ` +Object { + "body": Array [ Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 26, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 49, - 50, + 0, + 26, ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, + "source": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, }, + "range": Array [ + 18, + 25, + ], + "raw": "\\"house\\"", + "type": "Literal", + "value": "house", }, - "range": Array [ - 53, - 54, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "house", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 12, + ], + "type": "ImportDefaultSpecifier", + }, ], - "type": "Punctuator", - "value": "}", + "type": "ImportDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/labels/label-continue.src 1`] = ` -Object { - "body": Array [ Object { "body": Object { - "body": Object { - "body": Array [ - Object { - "label": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "roof", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 13, - "line": 3, + "column": 1, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "console", + "range": Array [ + 44, + 51, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, }, + "name": "log", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", }, - "name": "loop1", "range": Array [ - 36, - 41, + 44, + 55, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "type": "MemberExpression", }, - "range": Array [ - 27, - 42, - ], - "type": "ContinueStatement", - }, - Object { - "label": null, "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 4, }, "start": Object { - "column": 4, + "column": 1, "line": 4, }, }, "range": Array [ - 47, - 56, + 44, + 61, ], - "type": "ContinueStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 5, + "type": "CallExpression", }, - "start": Object { - "column": 14, - "line": 2, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, }, + "range": Array [ + 44, + 62, + ], + "type": "ExpressionStatement", }, - "range": Array [ - 21, - 60, - ], - "type": "BlockStatement", - }, + ], "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 5, }, "start": Object { - "column": 2, - "line": 2, + "column": 13, + "line": 3, }, }, "range": Array [ - 9, - 60, + 41, + 64, ], - "test": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 15, - 19, - ], - "raw": "true", - "type": "Literal", - "value": true, + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, }, - "type": "WhileStatement", }, - "label": Object { + "object": Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 3, }, }, - "name": "loop1", + "name": "house", "range": Array [ - 0, - 5, + 34, + 39, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, "range": Array [ - 0, - 60, + 28, + 64, ], - "type": "LabeledStatement", + "type": "WithStatement", }, ], "loc": Object { @@ -103891,14 +106155,14 @@ Object { }, "range": Array [ 0, - 61, + 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { @@ -103908,169 +106172,79 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Identifier", - "value": "loop1", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, 6, ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 9, - 14, - ], "type": "Keyword", - "value": "while", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 15, - 19, - ], - "type": "Boolean", - "value": "true", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { "column": 12, - "line": 2, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 21, - 22, + 7, + 12, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "house", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 13, + "line": 1, }, }, "range": Array [ - 27, - 35, + 13, + 17, ], - "type": "Keyword", - "value": "continue", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 18, + "line": 1, }, }, "range": Array [ - 36, - 41, + 18, + 25, ], - "type": "Identifier", - "value": "loop1", + "type": "String", + "value": "\\"house\\"", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 1, }, }, "range": Array [ - 41, - 42, + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -104078,524 +106252,355 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 4, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 0, + "line": 3, }, }, "range": Array [ - 47, - 55, + 28, + 32, ], "type": "Keyword", - "value": "continue", + "value": "with", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 6, + "line": 3, }, "start": Object { - "column": 12, - "line": 4, + "column": 5, + "line": 3, }, }, "range": Array [ - 55, - 56, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 11, + "line": 3, }, "start": Object { - "column": 2, - "line": 5, + "column": 6, + "line": 3, }, }, "range": Array [ - 59, - 60, + 34, + 39, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "house", }, - ], - "type": "Program", -} -`; - -exports[`javascript fixtures/modules/error-delete.src 1`] = ` -Object { - "body": Array [ Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 0, - 18, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 17, - ], - "raw": "\\"x\\"", - "type": "Literal", - "value": "x", - }, - "specifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, - "range": Array [ - 7, - 8, - ], - "type": "ImportDefaultSpecifier", - }, + 39, + 40, ], - "type": "ImportDeclaration", + "type": "Punctuator", + "value": ")", }, Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "operator": "delete", - "prefix": true, - "range": Array [ - 19, - 27, - ], - "type": "UnaryExpression", - }, "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 13, + "line": 3, }, }, "range": Array [ - 19, - 28, + 41, + 42, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 1, + "line": 4, }, }, "range": Array [ - 0, - 6, + 44, + 51, ], - "type": "Keyword", - "value": "import", + "type": "Identifier", + "value": "console", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 9, + "line": 4, }, "start": Object { - "column": 7, - "line": 1, + "column": 8, + "line": 4, }, }, "range": Array [ - 7, - 8, + 51, + 52, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 12, + "line": 4, }, "start": Object { "column": 9, - "line": 1, + "line": 4, }, }, "range": Array [ - 9, - 13, + 52, + 55, ], "type": "Identifier", - "value": "from", + "value": "log", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 14, - "line": 1, + "column": 12, + "line": 4, }, }, "range": Array [ - 14, - 17, + 55, + 56, ], - "type": "String", - "value": "\\"x\\"", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 17, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 13, + "line": 4, }, }, "range": Array [ - 17, - 18, + 56, + 60, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "roof", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 18, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 17, + "line": 4, }, }, "range": Array [ - 19, - 25, + 60, + 61, ], - "type": "Keyword", - "value": "delete", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 19, + "line": 4, }, "start": Object { - "column": 7, - "line": 2, + "column": 18, + "line": 4, }, }, "range": Array [ - 26, - 27, + 61, + 62, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 1, + "line": 5, }, "start": Object { - "column": 8, - "line": 2, + "column": 0, + "line": 5, }, }, "range": Array [ - 27, - 28, + 63, + 64, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`javascript fixtures/modules/error-function.src 1`] = ` +exports[`javascript fixtures/modules/export-async-named-function.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "declaration": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "friends", - "range": Array [ - 31, - 38, - ], - "type": "Identifier", + "declaration": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, + "start": Object { + "column": 28, + "line": 1, }, - "range": Array [ - 16, - 39, - ], - "type": "ExportDefaultDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, }, - "start": Object { - "column": 13, - "line": 1, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", }, - "range": Array [ - 13, - 41, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 30, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, - "name": "x", + "params": Array [], "range": Array [ - 9, - 10, + 7, + 30, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 30, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 41, + 30, ], - "type": "FunctionDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 2, }, "start": Object { "column": 0, "line": 1, }, - }, - "range": Array [ - 0, - 43, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "x", - }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 11, + "column": 6, "line": 1, }, "start": Object { - "column": 10, + "column": 0, "line": 1, }, }, "range": Array [ - 10, - 11, + 0, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { @@ -104604,21 +106609,21 @@ Object { "line": 1, }, "start": Object { - "column": 11, + "column": 7, "line": 1, }, }, "range": Array [ - 11, + 7, 12, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "async", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 21, "line": 1, }, "start": Object { @@ -104628,97 +106633,97 @@ Object { }, "range": Array [ 13, - 14, + 21, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 16, 22, + 25, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 23, - 30, + 25, + 26, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 31, - 38, + 26, + 27, ], - "type": "Identifier", - "value": "friends", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 38, - 39, + 28, + 29, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 30, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 40, - 41, + 29, + 30, ], "type": "Punctuator", "value": "}", @@ -104728,249 +106733,107 @@ Object { } `; -exports[`javascript fixtures/modules/error-strict.src 1`] = ` +exports[`javascript fixtures/modules/export-const.src 1`] = ` Object { "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 25, - ], - "raw": "\\"house\\"", - "type": "Literal", - "value": "house", - }, - "specifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "house", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "range": Array [ - 7, - 12, - ], - "type": "ImportDefaultSpecifier", - }, - ], - "type": "ImportDeclaration", - }, - Object { - "body": Object { - "body": Array [ + "declaration": Object { + "declarations": Array [ Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "name": "roof", - "range": Array [ - 56, - 60, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "name": "console", - "range": Array [ - 44, - 51, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "log", - "range": Array [ - 52, - 55, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 44, - 55, - ], - "type": "MemberExpression", }, + "name": "foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 20, + "line": 1, }, "start": Object { - "column": 1, - "line": 4, + "column": 19, + "line": 1, }, }, "range": Array [ - 44, - 61, + 19, + 20, ], - "type": "CallExpression", + "raw": "2", + "type": "Literal", + "value": 2, }, "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 20, + "line": 1, }, "start": Object { - "column": 1, - "line": 4, + "column": 13, + "line": 1, }, }, "range": Array [ - 44, - 62, + 13, + 20, ], - "type": "ExpressionStatement", + "type": "VariableDeclarator", }, ], + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 21, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 41, - 64, + 7, + 21, ], - "type": "BlockStatement", + "type": "VariableDeclaration", }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 21, + "line": 1, }, "start": Object { "column": 0, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, + "line": 1, }, - "name": "house", - "range": Array [ - 34, - 39, - ], - "type": "Identifier", }, "range": Array [ - 28, - 64, + 0, + 21, ], - "type": "WithStatement", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -104979,7 +106842,7 @@ Object { }, "range": Array [ 0, - 65, + 22, ], "sourceType": "module", "tokens": Array [ @@ -104999,7 +106862,7 @@ Object { 6, ], "type": "Keyword", - "value": "import", + "value": "export", }, Object { "loc": Object { @@ -105016,13 +106879,13 @@ Object { 7, 12, ], - "type": "Identifier", - "value": "house", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { @@ -105032,295 +106895,267 @@ Object { }, "range": Array [ 13, - 17, + 16, ], "type": "Identifier", - "value": "from", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 1, }, "start": Object { - "column": 18, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 18, - 25, ], - "type": "String", - "value": "\\"house\\"", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 1, }, "start": Object { - "column": 25, + "column": 19, "line": 1, }, }, "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 28, - 32, - ], - "type": "Keyword", - "value": "with", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 34, - 39, - ], - "type": "Identifier", - "value": "house", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "range": Array [ - 44, - 51, + 19, + 20, ], - "type": "Identifier", - "value": "console", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 21, + "line": 1, }, "start": Object { - "column": 8, - "line": 4, + "column": 20, + "line": 1, }, }, "range": Array [ - 51, - 52, + 20, + 21, ], "type": "Punctuator", - "value": ".", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`javascript fixtures/modules/export-default-array.src 1`] = ` +Object { + "body": Array [ Object { + "declaration": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "ArrayExpression", + }, "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 52, - 55, + 0, + 18, ], - "type": "Identifier", - "value": "log", + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 6, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 55, - 56, + 0, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 14, + "line": 1, }, "start": Object { - "column": 13, - "line": 4, + "column": 7, + "line": 1, }, }, "range": Array [ - 56, - 60, + 7, + 14, ], - "type": "Identifier", - "value": "roof", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 15, + "line": 1, }, }, "range": Array [ - 60, - 61, + 15, + 16, ], "type": "Punctuator", - "value": ")", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 17, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 16, + "line": 1, }, }, "range": Array [ - 61, - 62, + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 18, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 17, + "line": 1, }, }, "range": Array [ - 63, - 64, + 17, + 18, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`javascript fixtures/modules/export-default-array.src 1`] = ` +exports[`javascript fixtures/modules/export-default-async-named-function.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "elements": Array [], + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 17, + "column": 38, "line": 1, }, "start": Object { @@ -105328,15 +107163,16 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 15, - 17, + 38, ], - "type": "ArrayExpression", + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 18, + "column": 38, "line": 1, }, "start": Object { @@ -105346,7 +107182,7 @@ Object { }, "range": Array [ 0, - 18, + 38, ], "type": "ExportDefaultDeclaration", }, @@ -105363,7 +107199,7 @@ Object { }, "range": Array [ 0, - 19, + 39, ], "sourceType": "module", "tokens": Array [ @@ -105406,56 +107242,128 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 29, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, "line": 1, }, "start": Object { - "column": 15, + "column": 34, "line": 1, }, }, "range": Array [ - 15, - 16, + 34, + 35, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 37, "line": 1, }, "start": Object { - "column": 16, + "column": 36, "line": 1, }, }, "range": Array [ - 16, - 17, + 36, + 37, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 38, "line": 1, }, "start": Object { - "column": 17, + "column": 37, "line": 1, }, }, "range": Array [ - 17, - 18, + 37, + 38, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", @@ -109178,6 +111086,232 @@ Object { } `; +exports[`javascript fixtures/modules/export-let.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 19, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`javascript fixtures/modules/export-named-as-default.src 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap index 4509f7441037..38e378d9f7e0 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap @@ -189,7 +189,87 @@ Object { } `; -exports[`parse() non string code should correctly convert code to string 1`] = ` +exports[`parse() non string code should correctly convert code to a string for parse() 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "12345", + "type": "Literal", + "value": 12345, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "12345", + }, + ], + "type": "Program", +} +`; + +exports[`parse() non string code should correctly convert code to a string for parseAndGenerateServices() 1`] = ` Object { "body": Array [ Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 768b79a8fd31..1db62d5b9140 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -739,6 +739,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/invalid-for-of-with-let-and-no-braces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/function/return-multiline-sequence.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/function/return-sequence.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/anonymous-generator.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/generators/async-generator-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -790,8 +794,14 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/error-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-async-named-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-const.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-array.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-async-named-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-default-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -824,6 +834,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-let.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-as-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/export-named-as-specifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1879,6 +1891,8 @@ Object { } `; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-optional-parameter.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 90ebe3e137e0..b807e63a8220 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -812,12 +812,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 68, ], "superClass": null, @@ -1259,12 +1259,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 86, ], "superClass": null, @@ -2561,12 +2561,12 @@ Object { "line": 3, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 78, ], "superClass": null, @@ -2948,12 +2948,12 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, + 7, 31, ], "type": "TSInterfaceDeclaration", @@ -3106,6 +3106,397 @@ Object { } `; +exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": false, + "body": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "k", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 9, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "k", + "optional": true, + "range": Array [ + 2, + 4, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 1, + 14, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "k", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "k", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` Object { "body": Array [ @@ -35398,7 +35789,7 @@ Object { "line": 4, }, "start": Object { - "column": 21, + "column": 7, "line": 1, }, }, @@ -35494,7 +35885,7 @@ Object { }, ], "range": Array [ - 21, + 7, 54, ], "type": "TSEnumDeclaration", @@ -35785,7 +36176,7 @@ Object { "line": 4, }, "start": Object { - "column": 15, + "column": 7, "line": 1, }, }, @@ -35881,7 +36272,7 @@ Object { }, ], "range": Array [ - 15, + 7, 48, ], "type": "TSEnumDeclaration", @@ -48344,7 +48735,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 12, }, "start": Object { @@ -48356,7 +48747,7 @@ Object { "optional": true, "range": Array [ 253, - 254, + 255, ], "type": "Identifier", }, @@ -48434,7 +48825,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 13, }, "start": Object { @@ -48446,7 +48837,7 @@ Object { "optional": true, "range": Array [ 281, - 282, + 283, ], "type": "Identifier", }, @@ -53414,7 +53805,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 32, "line": 4, }, "start": Object { @@ -53426,7 +53817,7 @@ Object { "optional": true, "range": Array [ 73, - 76, + 77, ], "type": "Identifier", }, @@ -88748,7 +89139,7 @@ Object { "line": 1, }, "start": Object { - "column": 63, + "column": 7, "line": 1, }, }, @@ -88875,7 +89266,7 @@ Object { }, ], "range": Array [ - 63, + 7, 72, ], "type": "TSEnumDeclaration", diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 74f02d03792c..fc7e8af99a10 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -57,9 +57,14 @@ describe('parse()', () => { }; it( - 'should correctly convert code to string', + 'should correctly convert code to a string for parse()', createSnapshotTestBlock(code, config) ); + + it( + 'should correctly convert code to a string for parseAndGenerateServices()', + createSnapshotTestBlock(code, config, true) + ); }); describe('loggerFn should be propagated to ast-converter', () => { diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index eb5af8677e97..e45cae843ed5 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -17,6 +17,7 @@ import { formatSnapshotName, parseCodeAndGenerateServices } from '../../tools/test-utils'; +import { parseAndGenerateServices } from '../../src/parser'; //------------------------------------------------------------------------------ // Setup @@ -59,6 +60,23 @@ describe('semanticInfo', () => { ); }); + it(`should handle "project": "./tsconfig.json" and "project": ["./tsconfig.json"] the same`, () => { + const filename = testFiles[0]; + const code = readFileSync(filename, 'utf8'); + const options = createOptions(filename); + const optionsProjectString = { + ...options, + project: './tsconfig.json' + }; + const optionsProjectArray = { + ...options, + project: ['./tsconfig.json'] + }; + expect(parseAndGenerateServices(code, optionsProjectString)).toEqual( + parseAndGenerateServices(code, optionsProjectArray) + ); + }); + // case-specific tests it('isolated-file tests', () => { const fileName = resolve(FIXTURES_DIR, 'isolated-file.src.ts'); diff --git a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts new file mode 100644 index 000000000000..d984007bf757 --- /dev/null +++ b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts @@ -0,0 +1,22 @@ +import semver from 'semver'; +import * as parser from '../../src/parser'; + +jest.mock('semver'); + +describe('Warn on unsupported TypeScript version', () => { + afterEach(() => { + jest.resetModules(); + jest.resetAllMocks(); + }); + + it('should warn the user if they are using an unsupported TypeScript version', () => { + (semver.satisfies as jest.Mock).mockReturnValue(false); + console.log = jest.fn(); + parser.parse(''); + expect(console.log).toHaveBeenCalledWith( + expect.stringContaining( + 'WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree' + ) + ); + }); +}); diff --git a/yarn.lock b/yarn.lock index e2d917cdc557..b6a6d614dfc0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -163,6 +163,20 @@ babel-runtime "6.26.0" execa "0.9.0" +"@iamstarkov/listr-update-renderer@0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@iamstarkov/listr-update-renderer/-/listr-update-renderer-0.4.1.tgz#d7c48092a2dcf90fd672b6c8b458649cb350c77e" + integrity sha512-IJyxQWsYDEkf8C8QthBn5N8tIUR9V9je6j3sMIpAkonaadjbvxmRC6RAhpa3RKxndhNnU2M6iNbtJwd7usQYIA== + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^2.3.0" + strip-ansi "^3.0.1" + "@lerna/add@3.10.5": version "3.10.5" resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.10.5.tgz#10dcd1069eee18a84432f826a38d6791af8a2fef" @@ -1618,6 +1632,11 @@ ci-info@^1.5.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" @@ -1919,6 +1938,15 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +cosmiconfig@5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" + integrity sha512-6DWfizHriCrFWURP1/qyhsiFvYdlJzbCzmtFWh744+KyWsJo5+kPzUZZaMRSSItoYc0pxFX7gEO7ZC1/gN/7AQ== + dependencies: + is-directory "^0.3.1" + js-yaml "^3.9.0" + parse-json "^4.0.0" + cosmiconfig@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" @@ -1929,7 +1957,7 @@ cosmiconfig@^4.0.0: parse-json "^4.0.0" require-from-string "^2.0.1" -cosmiconfig@^5.0.2: +cosmiconfig@^5.0.2, cosmiconfig@^5.0.7: version "5.0.7" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.7.tgz#39826b292ee0d78eda137dfa3173bd1c21a43b04" integrity sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA== @@ -2136,6 +2164,18 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" +del@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" + integrity sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU= + dependencies: + globby "^6.1.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + p-map "^1.1.1" + pify "^3.0.0" + rimraf "^2.2.8" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -2304,7 +2344,7 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.4, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -2497,7 +2537,7 @@ exec-sh@^0.2.0: dependencies: merge "^1.2.0" -execa@0.9.0, execa@^0.9.0: +execa@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01" integrity sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA== @@ -2895,6 +2935,15 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +g-status@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/g-status/-/g-status-2.0.2.tgz#270fd32119e8fc9496f066fe5fe88e0a6bc78b97" + integrity sha512-kQoE9qH+T1AHKgSSD0Hkv98bobE90ILQcXAF4wvGgsr7uFqNvwmh8j+Lq3l0RVt3E3HjSbv2B9biEGcEtpHLCA== + dependencies: + arrify "^1.0.1" + matcher "^1.0.0" + simple-git "^1.85.0" + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -2964,6 +3013,11 @@ get-stdin@^4.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -3102,6 +3156,17 @@ globals@^9.18.0: resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== +globby@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" + integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= + dependencies: + array-union "^1.0.1" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + globby@^8.0.1: version "8.0.2" resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" @@ -3271,14 +3336,21 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@0.14.3: - version "0.14.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" - integrity sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA== +husky@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-1.3.1.tgz#26823e399300388ca2afff11cfa8a86b0033fae0" + integrity sha512-86U6sVVVf4b5NYSZ0yvv88dRgBSSXXmHaiq5pP4KDj5JVzdwKgBjEtUPOm8hcoytezFwbU+7gotXNhpHdystlg== dependencies: - is-ci "^1.0.10" - normalize-path "^1.0.0" - strip-indent "^2.0.0" + cosmiconfig "^5.0.7" + execa "^1.0.0" + find-up "^3.0.0" + get-stdin "^6.0.0" + is-ci "^2.0.0" + pkg-dir "^3.0.0" + please-upgrade-node "^3.1.1" + read-pkg "^4.0.1" + run-node "^1.0.0" + slash "^2.0.0" iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" @@ -3471,6 +3543,13 @@ is-ci@^1.0.10: dependencies: ci-info "^1.5.0" +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -3623,6 +3702,25 @@ is-observable@^1.1.0: dependencies: symbol-observable "^1.1.0" +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + integrity sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0= + +is-path-in-cwd@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" + integrity sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ== + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" + integrity sha1-jvW33lBDej/cprToZe96pVy0gDY= + dependencies: + path-is-inside "^1.0.1" + is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" @@ -4417,22 +4515,25 @@ libnpmteam@^1.0.1: get-stream "^4.0.0" npm-registry-fetch "^3.8.0" -lint-staged@7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.3.0.tgz#90ff33e5ca61ed3dbac35b6f6502dbefdc0db58d" - integrity sha512-AXk40M9DAiPi7f4tdJggwuKIViUplYtVj1os1MVEteW7qOkU50EOehayCfO9TsoGK24o/EsWb41yrEgfJDDjCw== +lint-staged@8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.0.tgz#dbc3ae2565366d8f20efb9f9799d076da64863f2" + integrity sha512-yfSkyJy7EuVsaoxtUSEhrD81spdJOe/gMTGea3XaV7HyoRhTb9Gdlp6/JppRZERvKSEYXP9bjcmq6CA5oL2lYQ== dependencies: + "@iamstarkov/listr-update-renderer" "0.4.1" chalk "^2.3.1" commander "^2.14.1" - cosmiconfig "^5.0.2" + cosmiconfig "5.0.6" debug "^3.1.0" dedent "^0.7.0" - execa "^0.9.0" + del "^3.0.0" + execa "^1.0.0" find-parent-dir "^0.3.0" + g-status "^2.0.2" is-glob "^4.0.0" is-windows "^1.0.2" jest-validate "^23.5.0" - listr "^0.14.1" + listr "^0.14.2" lodash "^4.17.5" log-symbols "^2.2.0" micromatch "^3.1.8" @@ -4441,7 +4542,7 @@ lint-staged@7.3.0: path-is-inside "^1.0.2" pify "^3.0.0" please-upgrade-node "^3.0.2" - staged-git-files "1.1.1" + staged-git-files "1.1.2" string-argv "^0.0.2" stringify-object "^3.2.2" @@ -4474,7 +4575,7 @@ listr-verbose-renderer@^0.5.0: date-fns "^1.27.2" figures "^2.0.0" -listr@^0.14.1: +listr@^0.14.2: version "0.14.3" resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.3.tgz#2fea909604e434be464c50bddba0d496928fa586" integrity sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA== @@ -4712,6 +4813,13 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +matcher@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/matcher/-/matcher-1.1.1.tgz#51d8301e138f840982b338b116bb0c09af62c1c2" + integrity sha512-+BmqxWIubKTRKNWx/ahnCkk3mG8m7OturVlqq6HiojGJTd5hVYbgZm6WzcYPCoB+KBT4Vd6R7WSRG2OADNaCjg== + dependencies: + escape-string-regexp "^1.0.4" + math-random@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" @@ -5107,11 +5215,6 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" - integrity sha1-MtDkcvkf80VwHBWoMRAY07CpA3k= - normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -5633,7 +5736,14 @@ pkg-dir@^2.0.0: dependencies: find-up "^2.1.0" -please-upgrade-node@^3.0.2: +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" integrity sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ== @@ -5884,6 +5994,15 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" +read-pkg@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237" + integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc= + dependencies: + normalize-package-data "^2.3.2" + parse-json "^4.0.0" + pify "^3.0.0" + read@1, read@~1.0.1: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" @@ -6128,7 +6247,7 @@ right-pad@^1.0.1: resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" integrity sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA= -rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@~2.6.2: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@~2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -6147,6 +6266,11 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +run-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" @@ -6266,6 +6390,13 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= +simple-git@^1.85.0: + version "1.107.0" + resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.107.0.tgz#12cffaf261c14d6f450f7fdb86c21ccee968b383" + integrity sha512-t4OK1JRlp4ayKRfcW6owrWcRVLyHRUlhGd0uN6ZZTqfDq8a5XpcUdOKiGRNobHEuMtNqzp0vcJNvhYWwh5PsQA== + dependencies: + debug "^4.0.1" + sisteransi@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-0.1.1.tgz#5431447d5f7d1675aac667ccd0b865a4994cb3ce" @@ -6276,6 +6407,11 @@ slash@^1.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" @@ -6473,10 +6609,10 @@ stack-utils@^1.0.1: resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== -staged-git-files@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.1.tgz#37c2218ef0d6d26178b1310719309a16a59f8f7b" - integrity sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A== +staged-git-files@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.2.tgz#4326d33886dc9ecfa29a6193bf511ba90a46454b" + integrity sha512-0Eyrk6uXW6tg9PYkhi/V/J4zHp33aNyi2hOCmhFLqLTIhbgqWn5jlSzI+IU0VqrZq6+DbHcabQl/WP6P3BG0QA== static-extend@^0.1.1: version "0.1.2"