@galadrim/galadmin 0.1.38 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/front/build/asset-manifest.json +3 -3
- package/src/front/build/index.html +1 -1
- package/src/front/build/static/js/{main.4ce5340d.chunk.js → main.8a63b422.chunk.js} +2 -2
- package/src/front/build/static/js/main.8a63b422.chunk.js.map +1 -0
- package/src/front/node_modules/.cache/.eslintcache +1 -1
- package/src/front/node_modules/.cache/babel-loader/0046fa6def7297665aceff65675276fb.json +1 -0
- package/src/front/node_modules/.cache/babel-loader/6b6404ad16b4fb247c0dfe43c03f4a02.json +1 -0
- package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/ef/81/2c9ecc926af52757cb3670536bc07219d1ccfba4d898a451352553fa6634b48d69ec580dd7c756e5fbcdc72e870664ef6bd7dc1af98e94d9eb182ba93be9 +1 -0
- package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/{c2/e5/5451dd89bb0fd48f988bf27c7ee614c66eb91f7085c5b5c8cb33048d0c32 → 31/fe/6640db1983b9834e63d1a760fa17521e8cf616b567ef7114a0676aa6971a} +1 -1
- package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/6c/19/fe86ba5d7c4062f185480ad22dd3b9fae9b30149827224339f9a633a9a94 +1 -1
- package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/87/08/421190bfe6e50816e059da6c33526c9943732ef856ebd2752d0cbfb4a852 +1 -1
- package/src/front/node_modules/.package-lock.json +72 -72
- package/src/front/node_modules/@babel/code-frame/lib/index.js +5 -4
- package/src/front/node_modules/@babel/code-frame/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/code-frame/package.json +3 -2
- package/src/front/node_modules/@babel/core/lib/config/cache-contexts.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/caching.js +2 -2
- package/src/front/node_modules/@babel/core/lib/config/caching.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/config-chain.js +13 -13
- package/src/front/node_modules/@babel/core/lib/config/config-chain.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js +6 -6
- package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/configuration.js +44 -41
- package/src/front/node_modules/@babel/core/lib/config/files/configuration.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/import-meta-resolve.js +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/index-browser.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/index.js +3 -3
- package/src/front/node_modules/@babel/core/lib/config/files/index.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/module-types.js +27 -8
- package/src/front/node_modules/@babel/core/lib/config/files/module-types.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/package.js +2 -2
- package/src/front/node_modules/@babel/core/lib/config/files/package.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/plugins.js +3 -3
- package/src/front/node_modules/@babel/core/lib/config/files/plugins.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/types.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/files/utils.js +2 -2
- package/src/front/node_modules/@babel/core/lib/config/files/utils.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/full.js +13 -13
- package/src/front/node_modules/@babel/core/lib/config/full.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js +6 -6
- package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/index.js +60 -40
- package/src/front/node_modules/@babel/core/lib/config/index.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/item.js +1 -1
- package/src/front/node_modules/@babel/core/lib/config/item.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/partial.js +15 -23
- package/src/front/node_modules/@babel/core/lib/config/partial.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/plugin.js +1 -1
- package/src/front/node_modules/@babel/core/lib/config/plugin.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/printer.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/resolve-targets.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/util.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/validation/option-assertions.js +1 -1
- package/src/front/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/validation/options.js +3 -3
- package/src/front/node_modules/@babel/core/lib/config/validation/options.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/config/validation/plugins.js +1 -1
- package/src/front/node_modules/@babel/core/lib/config/validation/plugins.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/errors/config-error.js +1 -1
- package/src/front/node_modules/@babel/core/lib/errors/config-error.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/gensync-utils/functional.js +1 -1
- package/src/front/node_modules/@babel/core/lib/gensync-utils/functional.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/index.js +23 -23
- package/src/front/node_modules/@babel/core/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/parse.js +6 -6
- package/src/front/node_modules/@babel/core/lib/parse.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/parser/index.js +1 -1
- package/src/front/node_modules/@babel/core/lib/parser/index.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/tools/build-external-helpers.js +1 -1
- package/src/front/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transform-ast.js +5 -5
- package/src/front/node_modules/@babel/core/lib/transform-ast.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transform-file.js +5 -5
- package/src/front/node_modules/@babel/core/lib/transform-file.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transform.js +5 -5
- package/src/front/node_modules/@babel/core/lib/transform.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/file/file.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/file/generate.js +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/file/generate.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/index.js +6 -6
- package/src/front/node_modules/@babel/core/lib/transformation/index.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/normalize-file.js +4 -4
- package/src/front/node_modules/@babel/core/lib/transformation/normalize-file.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +1 -1
- package/src/front/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +1 -1
- package/src/front/node_modules/@babel/core/package.json +15 -15
- package/src/front/node_modules/@babel/core/src/config/files/index-browser.ts +2 -2
- package/src/front/node_modules/@babel/core/src/config/files/index.ts +4 -4
- package/src/front/node_modules/@babel/core/src/config/resolve-targets-browser.ts +1 -1
- package/src/front/node_modules/@babel/core/src/config/resolve-targets.ts +1 -1
- package/src/front/node_modules/@babel/core/src/transform-file.ts +5 -5
- package/src/front/node_modules/@babel/generator/lib/buffer.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/expressions.js +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/flow.js +2 -2
- package/src/front/node_modules/@babel/generator/lib/generators/flow.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/index.js +11 -11
- package/src/front/node_modules/@babel/generator/lib/generators/index.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/jsx.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/template-literals.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/index.js +2 -2
- package/src/front/node_modules/@babel/generator/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/node/index.js +2 -2
- package/src/front/node_modules/@babel/generator/lib/node/index.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/node/whitespace.js.map +1 -1
- package/src/front/node_modules/@babel/generator/lib/printer.js +3 -3
- package/src/front/node_modules/@babel/generator/lib/printer.js.map +1 -1
- package/src/front/node_modules/@babel/generator/package.json +4 -4
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js +2 -2
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js.map +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js.map +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/index.js +6 -6
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js.map +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js.map +1 -1
- package/src/front/node_modules/@babel/helper-compilation-targets/package.json +2 -2
- package/src/front/node_modules/@babel/helper-module-imports/README.md +1 -1
- package/src/front/node_modules/@babel/helper-module-imports/lib/import-injector.js +2 -2
- package/src/front/node_modules/@babel/helper-module-imports/lib/import-injector.js.map +1 -1
- package/src/front/node_modules/@babel/helper-module-imports/lib/index.js +2 -2
- package/src/front/node_modules/@babel/helper-module-imports/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/helper-module-imports/package.json +4 -4
- package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js +5 -5
- package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/helper-module-transforms/lib/rewrite-live-references.js.map +1 -1
- package/src/front/node_modules/@babel/helper-module-transforms/package.json +5 -5
- package/src/front/node_modules/@babel/helper-validator-identifier/README.md +1 -1
- package/src/front/node_modules/@babel/helper-validator-identifier/lib/index.js +2 -2
- package/src/front/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/helper-validator-identifier/package.json +1 -1
- package/src/front/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js +8 -6
- package/src/front/node_modules/@babel/helper-validator-option/README.md +1 -1
- package/src/front/node_modules/@babel/helper-validator-option/lib/index.js +2 -2
- package/src/front/node_modules/@babel/helper-validator-option/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/helper-validator-option/lib/validator.js +1 -1
- package/src/front/node_modules/@babel/helper-validator-option/lib/validator.js.map +1 -1
- package/src/front/node_modules/@babel/helper-validator-option/package.json +1 -1
- package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js +21 -21
- package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js.map +1 -1
- package/src/front/node_modules/@babel/helpers/lib/helpers.js +1 -1
- package/src/front/node_modules/@babel/helpers/lib/helpers.js.map +1 -1
- package/src/front/node_modules/@babel/helpers/lib/index.js +1 -1
- package/src/front/node_modules/@babel/helpers/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/helpers/package.json +7 -7
- package/src/front/node_modules/@babel/helpers/scripts/generate-helpers.js +1 -1
- package/src/front/node_modules/@babel/highlight/lib/index.js +6 -5
- package/src/front/node_modules/@babel/highlight/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/highlight/package.json +1 -1
- package/src/front/node_modules/@babel/parser/lib/index.js +52 -57
- package/src/front/node_modules/@babel/parser/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/parser/package.json +4 -4
- package/src/front/node_modules/@babel/template/README.md +1 -1
- package/src/front/node_modules/@babel/template/lib/builder.js +3 -3
- package/src/front/node_modules/@babel/template/lib/builder.js.map +1 -1
- package/src/front/node_modules/@babel/template/lib/index.js +2 -2
- package/src/front/node_modules/@babel/template/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/template/lib/literal.js +3 -3
- package/src/front/node_modules/@babel/template/lib/literal.js.map +1 -1
- package/src/front/node_modules/@babel/template/lib/parse.js.map +1 -1
- package/src/front/node_modules/@babel/template/lib/populate.js.map +1 -1
- package/src/front/node_modules/@babel/template/lib/string.js +3 -3
- package/src/front/node_modules/@babel/template/lib/string.js.map +1 -1
- package/src/front/node_modules/@babel/template/package.json +4 -4
- package/src/front/node_modules/@babel/traverse/lib/cache.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/context.js +2 -2
- package/src/front/node_modules/@babel/traverse/lib/context.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/hub.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/index.js +8 -8
- package/src/front/node_modules/@babel/traverse/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/ancestry.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/comments.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/context.js +2 -2
- package/src/front/node_modules/@babel/traverse/lib/path/context.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/conversion.js +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/family.js +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/family.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/index.js +17 -17
- package/src/front/node_modules/@babel/traverse/lib/path/index.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/inference/index.js +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/inference/index.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/inference/inferers.js +2 -2
- package/src/front/node_modules/@babel/traverse/lib/path/inference/inferers.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/introspection.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/modification.js +3 -3
- package/src/front/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/removal.js +3 -3
- package/src/front/node_modules/@babel/traverse/lib/path/removal.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/path/replacement.js +3 -3
- package/src/front/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/scope/binding.js +1 -3
- package/src/front/node_modules/@babel/traverse/lib/scope/binding.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/scope/index.js +5 -5
- package/src/front/node_modules/@babel/traverse/lib/scope/index.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/scope/lib/renamer.js +2 -2
- package/src/front/node_modules/@babel/traverse/lib/scope/lib/renamer.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/traverse-node.js +1 -1
- package/src/front/node_modules/@babel/traverse/lib/traverse-node.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/types.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/lib/visitors.js +1 -1
- package/src/front/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
- package/src/front/node_modules/@babel/traverse/package.json +6 -6
- package/src/front/node_modules/@babel/types/lib/asserts/assertNode.js +1 -1
- package/src/front/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/asserts/generated/index.js +2 -2
- package/src/front/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +3 -3
- package/src/front/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +9 -9
- package/src/front/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/generated/index.js +2 -2
- package/src/front/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/generated/uppercase.js +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/react/buildChildren.js +5 -5
- package/src/front/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +5 -5
- package/src/front/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/builders/validateNode.js +3 -3
- package/src/front/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/clone.js +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/clone.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/cloneDeep.js +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/cloneNode.js +6 -6
- package/src/front/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +1 -1
- package/src/front/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/addComment.js +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/addComment.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/addComments.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/inheritInnerComments.js +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/inheritsComments.js +3 -3
- package/src/front/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/comments/removeComments.js +2 -2
- package/src/front/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/constants/generated/index.js +50 -50
- package/src/front/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/ensureBlock.js +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +14 -14
- package/src/front/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toBlock.js +9 -9
- package/src/front/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toComputedKey.js +3 -3
- package/src/front/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toExpression.js +6 -6
- package/src/front/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toIdentifier.js +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toKeyAlias.js +5 -5
- package/src/front/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toSequenceExpression.js +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/toStatement.js +7 -7
- package/src/front/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/converters/valueToNode.js +17 -17
- package/src/front/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/core.js +9 -9
- package/src/front/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/experimental.js +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/flow.js +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/index.js +9 -9
- package/src/front/node_modules/@babel/types/lib/definitions/index.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/jsx.js +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/misc.js +2 -2
- package/src/front/node_modules/@babel/types/lib/definitions/misc.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/placeholders.js +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/typescript.js +4 -4
- package/src/front/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/definitions/utils.js +2 -2
- package/src/front/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/index-legacy.d.ts +10 -10
- package/src/front/node_modules/@babel/types/lib/index.d.ts +12 -12
- package/src/front/node_modules/@babel/types/lib/index.js +84 -84
- package/src/front/node_modules/@babel/types/lib/index.js.flow +10 -10
- package/src/front/node_modules/@babel/types/lib/index.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +2 -2
- package/src/front/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +6 -6
- package/src/front/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/modifications/inherits.js +4 -4
- package/src/front/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +4 -4
- package/src/front/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/modifications/removeProperties.js +2 -2
- package/src/front/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +2 -2
- package/src/front/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +6 -6
- package/src/front/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +6 -6
- package/src/front/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +1 -1
- package/src/front/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/traverse/traverse.js +2 -2
- package/src/front/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/traverse/traverseFast.js +2 -2
- package/src/front/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/utils/inherit.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +3 -3
- package/src/front/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/generated/index.js +2 -2
- package/src/front/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/is.js +5 -5
- package/src/front/node_modules/@babel/types/lib/validators/is.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isBinding.js +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isBlockScoped.js +3 -3
- package/src/front/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isImmutable.js +3 -3
- package/src/front/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isLet.js +3 -3
- package/src/front/node_modules/@babel/types/lib/validators/isLet.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isNode.js +2 -2
- package/src/front/node_modules/@babel/types/lib/validators/isNode.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +3 -3
- package/src/front/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isPlaceholderType.js +2 -2
- package/src/front/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isScope.js +4 -4
- package/src/front/node_modules/@babel/types/lib/validators/isScope.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +2 -2
- package/src/front/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isType.js +3 -3
- package/src/front/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/isVar.js +4 -4
- package/src/front/node_modules/@babel/types/lib/validators/isVar.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/matchesPattern.js +6 -6
- package/src/front/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/react/isReactComponent.js +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -1
- package/src/front/node_modules/@babel/types/lib/validators/validate.js +3 -3
- package/src/front/node_modules/@babel/types/lib/validators/validate.js.map +1 -1
- package/src/front/node_modules/@babel/types/package.json +4 -4
- package/src/front/node_modules/typescript/lib/lib.decorators.d.ts +17 -0
- package/src/front/node_modules/typescript/lib/lib.dom.d.ts +313 -90
- package/src/front/node_modules/typescript/lib/lib.es2015.collection.d.ts +9 -9
- package/src/front/node_modules/typescript/lib/lib.es2015.core.d.ts +2 -2
- package/src/front/node_modules/typescript/lib/lib.es2015.iterable.d.ts +4 -4
- package/src/front/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +2 -2
- package/src/front/node_modules/typescript/lib/lib.es2017.d.ts +1 -0
- package/src/front/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/src/front/node_modules/typescript/lib/lib.es2020.bigint.d.ts +4 -4
- package/src/front/node_modules/typescript/lib/lib.es2021.weakref.d.ts +19 -16
- package/src/front/node_modules/typescript/lib/lib.es2023.array.d.ts +618 -36
- package/src/front/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/src/front/node_modules/typescript/lib/lib.es2023.d.ts +1 -0
- package/src/front/node_modules/typescript/lib/lib.es5.d.ts +27 -18
- package/src/front/node_modules/typescript/lib/lib.esnext.d.ts +2 -0
- package/src/front/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/src/front/node_modules/typescript/lib/lib.esnext.disposable.d.ts +185 -0
- package/src/front/node_modules/typescript/lib/lib.webworker.d.ts +172 -33
- package/src/front/node_modules/typescript/lib/tsc.js +8311 -6557
- package/src/front/node_modules/typescript/lib/tsserver.js +11796 -9281
- package/src/front/node_modules/typescript/lib/tsserverlibrary.d.ts +287 -249
- package/src/front/node_modules/typescript/lib/tsserverlibrary.js +11801 -9288
- package/src/front/node_modules/typescript/lib/typescript.d.ts +274 -248
- package/src/front/node_modules/typescript/lib/typescript.js +11678 -9231
- package/src/front/node_modules/typescript/lib/typingsInstaller.js +1852 -1645
- package/src/front/node_modules/typescript/package.json +7 -7
- package/src/front/package-lock.json +144 -144
- package/src/front/src/components/inputs/FileInput.js +1 -0
- package/src/front/src/pages/Records.js +1 -0
- package/src/front/build/static/js/main.4ce5340d.chunk.js.map +0 -1
- package/src/front/node_modules/.cache/babel-loader/1dbf9b1b83cdf813e9dc5f561b9b97ac.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/d88f947a76ac5f78797e69c737b6267e.json +0 -1
- package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/c3/3e/f2b5b90044b7bdbb4cff67b2c09e24bb506274240d920de24bb4b678f3f00b80f7e9f0900cd1de883484031488d8603e97ea6b4e39a9c6ab5160353d3be9 +0 -1
- package/src/front/node_modules/@babel/parser/lib/options.js +0 -44
- package/src/front/node_modules/@babel/parser/lib/options.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parse-error/credentials.js +0 -28
- package/src/front/node_modules/@babel/parser/lib/parse-error/credentials.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parse-error/module-errors.js +0 -20
- package/src/front/node_modules/@babel/parser/lib/parse-error/module-errors.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parse-error/pipeline-operator-errors.js +0 -32
- package/src/front/node_modules/@babel/parser/lib/parse-error/pipeline-operator-errors.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parse-error/standard-errors.js +0 -220
- package/src/front/node_modules/@babel/parser/lib/parse-error/standard-errors.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parse-error/strict-mode-errors.js +0 -22
- package/src/front/node_modules/@babel/parser/lib/parse-error/strict-mode-errors.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parse-error/to-node-description.js +0 -39
- package/src/front/node_modules/@babel/parser/lib/parse-error/to-node-description.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parse-error.js +0 -106
- package/src/front/node_modules/@babel/parser/lib/parse-error.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/base.js +0 -36
- package/src/front/node_modules/@babel/parser/lib/parser/base.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/comments.js +0 -190
- package/src/front/node_modules/@babel/parser/lib/parser/comments.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/expression.js +0 -1824
- package/src/front/node_modules/@babel/parser/lib/parser/expression.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/index.js +0 -43
- package/src/front/node_modules/@babel/parser/lib/parser/index.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/lval.js +0 -421
- package/src/front/node_modules/@babel/parser/lib/parser/lval.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/node.js +0 -127
- package/src/front/node_modules/@babel/parser/lib/parser/node.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/statement.js +0 -2033
- package/src/front/node_modules/@babel/parser/lib/parser/statement.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/parser/util.js +0 -238
- package/src/front/node_modules/@babel/parser/lib/parser/util.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugin-utils.js +0 -136
- package/src/front/node_modules/@babel/parser/lib/plugin-utils.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/estree.js +0 -340
- package/src/front/node_modules/@babel/parser/lib/plugins/estree.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js +0 -2474
- package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js +0 -44
- package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/jsx/index.js +0 -444
- package/src/front/node_modules/@babel/parser/lib/plugins/jsx/index.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/jsx/xhtml.js +0 -266
- package/src/front/node_modules/@babel/parser/lib/plugins/jsx/xhtml.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js +0 -198
- package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js +0 -2656
- package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js +0 -121
- package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/plugins/v8intrinsic.js +0 -31
- package/src/front/node_modules/@babel/parser/lib/plugins/v8intrinsic.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/tokenizer/context.js +0 -27
- package/src/front/node_modules/@babel/parser/lib/tokenizer/context.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/tokenizer/index.js +0 -1119
- package/src/front/node_modules/@babel/parser/lib/tokenizer/index.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/tokenizer/state.js +0 -82
- package/src/front/node_modules/@babel/parser/lib/tokenizer/state.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/tokenizer/types.js +0 -586
- package/src/front/node_modules/@babel/parser/lib/tokenizer/types.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/class-scope.js +0 -92
- package/src/front/node_modules/@babel/parser/lib/util/class-scope.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js +0 -142
- package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/identifier.js +0 -62
- package/src/front/node_modules/@babel/parser/lib/util/identifier.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/location.js +0 -39
- package/src/front/node_modules/@babel/parser/lib/util/location.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/production-parameter.js +0 -49
- package/src/front/node_modules/@babel/parser/lib/util/production-parameter.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/scope.js +0 -161
- package/src/front/node_modules/@babel/parser/lib/util/scope.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js +0 -67
- package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js.map +0 -1
- package/src/front/node_modules/@babel/parser/lib/util/whitespace.js +0 -59
- package/src/front/node_modules/@babel/parser/lib/util/whitespace.js.map +0 -1
|
@@ -1,2033 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ParseStatementFlag = exports.ParseFunctionFlag = void 0;
|
|
7
|
-
var _types = require("../tokenizer/types");
|
|
8
|
-
var _expression = require("./expression");
|
|
9
|
-
var _parseError = require("../parse-error");
|
|
10
|
-
var _identifier = require("../util/identifier");
|
|
11
|
-
var _scopeflags = require("../util/scopeflags");
|
|
12
|
-
var _util = require("./util");
|
|
13
|
-
var _productionParameter = require("../util/production-parameter");
|
|
14
|
-
var _expressionScope = require("../util/expression-scope");
|
|
15
|
-
var _tokenizer = require("../tokenizer");
|
|
16
|
-
var _location = require("../util/location");
|
|
17
|
-
var _node = require("./node");
|
|
18
|
-
var _lval = require("./lval");
|
|
19
|
-
const loopLabel = {
|
|
20
|
-
kind: "loop"
|
|
21
|
-
},
|
|
22
|
-
switchLabel = {
|
|
23
|
-
kind: "switch"
|
|
24
|
-
};
|
|
25
|
-
var ParseFunctionFlag = {
|
|
26
|
-
Expression: 0,
|
|
27
|
-
Declaration: 1,
|
|
28
|
-
HangingDeclaration: 2,
|
|
29
|
-
NullableId: 4,
|
|
30
|
-
Async: 8
|
|
31
|
-
};
|
|
32
|
-
exports.ParseFunctionFlag = ParseFunctionFlag;
|
|
33
|
-
var ParseStatementFlag = {
|
|
34
|
-
StatementOnly: 0,
|
|
35
|
-
AllowImportExport: 1,
|
|
36
|
-
AllowDeclaration: 2,
|
|
37
|
-
AllowFunctionDeclaration: 4,
|
|
38
|
-
AllowLabeledFunction: 8
|
|
39
|
-
};
|
|
40
|
-
exports.ParseStatementFlag = ParseStatementFlag;
|
|
41
|
-
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
42
|
-
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
43
|
-
function babel7CompatTokens(tokens, input) {
|
|
44
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
45
|
-
const token = tokens[i];
|
|
46
|
-
const {
|
|
47
|
-
type
|
|
48
|
-
} = token;
|
|
49
|
-
if (typeof type === "number") {
|
|
50
|
-
{
|
|
51
|
-
if (type === 136) {
|
|
52
|
-
const {
|
|
53
|
-
loc,
|
|
54
|
-
start,
|
|
55
|
-
value,
|
|
56
|
-
end
|
|
57
|
-
} = token;
|
|
58
|
-
const hashEndPos = start + 1;
|
|
59
|
-
const hashEndLoc = (0, _location.createPositionWithColumnOffset)(loc.start, 1);
|
|
60
|
-
tokens.splice(i, 1, new _tokenizer.Token({
|
|
61
|
-
type: (0, _types.getExportedToken)(27),
|
|
62
|
-
value: "#",
|
|
63
|
-
start: start,
|
|
64
|
-
end: hashEndPos,
|
|
65
|
-
startLoc: loc.start,
|
|
66
|
-
endLoc: hashEndLoc
|
|
67
|
-
}), new _tokenizer.Token({
|
|
68
|
-
type: (0, _types.getExportedToken)(130),
|
|
69
|
-
value: value,
|
|
70
|
-
start: hashEndPos,
|
|
71
|
-
end: end,
|
|
72
|
-
startLoc: hashEndLoc,
|
|
73
|
-
endLoc: loc.end
|
|
74
|
-
}));
|
|
75
|
-
i++;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if ((0, _types.tokenIsTemplate)(type)) {
|
|
79
|
-
const {
|
|
80
|
-
loc,
|
|
81
|
-
start,
|
|
82
|
-
value,
|
|
83
|
-
end
|
|
84
|
-
} = token;
|
|
85
|
-
const backquoteEnd = start + 1;
|
|
86
|
-
const backquoteEndLoc = (0, _location.createPositionWithColumnOffset)(loc.start, 1);
|
|
87
|
-
let startToken;
|
|
88
|
-
if (input.charCodeAt(start) === 96) {
|
|
89
|
-
startToken = new _tokenizer.Token({
|
|
90
|
-
type: (0, _types.getExportedToken)(22),
|
|
91
|
-
value: "`",
|
|
92
|
-
start: start,
|
|
93
|
-
end: backquoteEnd,
|
|
94
|
-
startLoc: loc.start,
|
|
95
|
-
endLoc: backquoteEndLoc
|
|
96
|
-
});
|
|
97
|
-
} else {
|
|
98
|
-
startToken = new _tokenizer.Token({
|
|
99
|
-
type: (0, _types.getExportedToken)(8),
|
|
100
|
-
value: "}",
|
|
101
|
-
start: start,
|
|
102
|
-
end: backquoteEnd,
|
|
103
|
-
startLoc: loc.start,
|
|
104
|
-
endLoc: backquoteEndLoc
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
let templateValue, templateElementEnd, templateElementEndLoc, endToken;
|
|
108
|
-
if (type === 24) {
|
|
109
|
-
templateElementEnd = end - 1;
|
|
110
|
-
templateElementEndLoc = (0, _location.createPositionWithColumnOffset)(loc.end, -1);
|
|
111
|
-
templateValue = value === null ? null : value.slice(1, -1);
|
|
112
|
-
endToken = new _tokenizer.Token({
|
|
113
|
-
type: (0, _types.getExportedToken)(22),
|
|
114
|
-
value: "`",
|
|
115
|
-
start: templateElementEnd,
|
|
116
|
-
end: end,
|
|
117
|
-
startLoc: templateElementEndLoc,
|
|
118
|
-
endLoc: loc.end
|
|
119
|
-
});
|
|
120
|
-
} else {
|
|
121
|
-
templateElementEnd = end - 2;
|
|
122
|
-
templateElementEndLoc = (0, _location.createPositionWithColumnOffset)(loc.end, -2);
|
|
123
|
-
templateValue = value === null ? null : value.slice(1, -2);
|
|
124
|
-
endToken = new _tokenizer.Token({
|
|
125
|
-
type: (0, _types.getExportedToken)(23),
|
|
126
|
-
value: "${",
|
|
127
|
-
start: templateElementEnd,
|
|
128
|
-
end: end,
|
|
129
|
-
startLoc: templateElementEndLoc,
|
|
130
|
-
endLoc: loc.end
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
tokens.splice(i, 1, startToken, new _tokenizer.Token({
|
|
134
|
-
type: (0, _types.getExportedToken)(20),
|
|
135
|
-
value: templateValue,
|
|
136
|
-
start: backquoteEnd,
|
|
137
|
-
end: templateElementEnd,
|
|
138
|
-
startLoc: backquoteEndLoc,
|
|
139
|
-
endLoc: templateElementEndLoc
|
|
140
|
-
}), endToken);
|
|
141
|
-
i += 2;
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
token.type = (0, _types.getExportedToken)(type);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return tokens;
|
|
149
|
-
}
|
|
150
|
-
class StatementParser extends _expression.default {
|
|
151
|
-
parseTopLevel(file, program) {
|
|
152
|
-
file.program = this.parseProgram(program);
|
|
153
|
-
file.comments = this.state.comments;
|
|
154
|
-
if (this.options.tokens) {
|
|
155
|
-
file.tokens = babel7CompatTokens(this.tokens, this.input);
|
|
156
|
-
}
|
|
157
|
-
return this.finishNode(file, "File");
|
|
158
|
-
}
|
|
159
|
-
parseProgram(program, end = 137, sourceType = this.options.sourceType) {
|
|
160
|
-
program.sourceType = sourceType;
|
|
161
|
-
program.interpreter = this.parseInterpreterDirective();
|
|
162
|
-
this.parseBlockBody(program, true, true, end);
|
|
163
|
-
if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
|
|
164
|
-
for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
|
|
165
|
-
this.raise(_parseError.Errors.ModuleExportUndefined, {
|
|
166
|
-
at,
|
|
167
|
-
localName
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
let finishedProgram;
|
|
172
|
-
if (end === 137) {
|
|
173
|
-
finishedProgram = this.finishNode(program, "Program");
|
|
174
|
-
} else {
|
|
175
|
-
finishedProgram = this.finishNodeAt(program, "Program", (0, _location.createPositionWithColumnOffset)(this.state.startLoc, -1));
|
|
176
|
-
}
|
|
177
|
-
return finishedProgram;
|
|
178
|
-
}
|
|
179
|
-
stmtToDirective(stmt) {
|
|
180
|
-
const directive = stmt;
|
|
181
|
-
directive.type = "Directive";
|
|
182
|
-
directive.value = directive.expression;
|
|
183
|
-
delete directive.expression;
|
|
184
|
-
const directiveLiteral = directive.value;
|
|
185
|
-
const expressionValue = directiveLiteral.value;
|
|
186
|
-
const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
|
|
187
|
-
const val = directiveLiteral.value = raw.slice(1, -1);
|
|
188
|
-
this.addExtra(directiveLiteral, "raw", raw);
|
|
189
|
-
this.addExtra(directiveLiteral, "rawValue", val);
|
|
190
|
-
this.addExtra(directiveLiteral, "expressionValue", expressionValue);
|
|
191
|
-
directiveLiteral.type = "DirectiveLiteral";
|
|
192
|
-
return directive;
|
|
193
|
-
}
|
|
194
|
-
parseInterpreterDirective() {
|
|
195
|
-
if (!this.match(28)) {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
const node = this.startNode();
|
|
199
|
-
node.value = this.state.value;
|
|
200
|
-
this.next();
|
|
201
|
-
return this.finishNode(node, "InterpreterDirective");
|
|
202
|
-
}
|
|
203
|
-
isLet() {
|
|
204
|
-
if (!this.isContextual(99)) {
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
return this.hasFollowingBindingAtom();
|
|
208
|
-
}
|
|
209
|
-
chStartsBindingIdentifier(ch, pos) {
|
|
210
|
-
if ((0, _identifier.isIdentifierStart)(ch)) {
|
|
211
|
-
keywordRelationalOperator.lastIndex = pos;
|
|
212
|
-
if (keywordRelationalOperator.test(this.input)) {
|
|
213
|
-
const endCh = this.codePointAtPos(keywordRelationalOperator.lastIndex);
|
|
214
|
-
if (!(0, _identifier.isIdentifierChar)(endCh) && endCh !== 92) {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return true;
|
|
219
|
-
} else if (ch === 92) {
|
|
220
|
-
return true;
|
|
221
|
-
} else {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
chStartsBindingPattern(ch) {
|
|
226
|
-
return ch === 91 || ch === 123;
|
|
227
|
-
}
|
|
228
|
-
hasFollowingBindingAtom() {
|
|
229
|
-
const next = this.nextTokenStart();
|
|
230
|
-
const nextCh = this.codePointAtPos(next);
|
|
231
|
-
return this.chStartsBindingPattern(nextCh) || this.chStartsBindingIdentifier(nextCh, next);
|
|
232
|
-
}
|
|
233
|
-
hasInLineFollowingBindingIdentifier() {
|
|
234
|
-
const next = this.nextTokenInLineStart();
|
|
235
|
-
const nextCh = this.codePointAtPos(next);
|
|
236
|
-
return this.chStartsBindingIdentifier(nextCh, next);
|
|
237
|
-
}
|
|
238
|
-
startsUsingForOf() {
|
|
239
|
-
const {
|
|
240
|
-
type,
|
|
241
|
-
containsEsc
|
|
242
|
-
} = this.lookahead();
|
|
243
|
-
if (type === 101 && !containsEsc) {
|
|
244
|
-
return false;
|
|
245
|
-
} else if ((0, _types.tokenIsIdentifier)(type) && !this.hasFollowingLineBreak()) {
|
|
246
|
-
this.expectPlugin("explicitResourceManagement");
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
startsAwaitUsing() {
|
|
251
|
-
let next = this.nextTokenInLineStart();
|
|
252
|
-
if (this.isUnparsedContextual(next, "using")) {
|
|
253
|
-
next = this.nextTokenInLineStartSince(next + 5);
|
|
254
|
-
const nextCh = this.codePointAtPos(next);
|
|
255
|
-
if (this.chStartsBindingIdentifier(nextCh, next)) {
|
|
256
|
-
this.expectPlugin("explicitResourceManagement");
|
|
257
|
-
return true;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
parseModuleItem() {
|
|
263
|
-
return this.parseStatementLike(ParseStatementFlag.AllowImportExport | ParseStatementFlag.AllowDeclaration | ParseStatementFlag.AllowFunctionDeclaration | ParseStatementFlag.AllowLabeledFunction);
|
|
264
|
-
}
|
|
265
|
-
parseStatementListItem() {
|
|
266
|
-
return this.parseStatementLike(ParseStatementFlag.AllowDeclaration | ParseStatementFlag.AllowFunctionDeclaration | (!this.options.annexB || this.state.strict ? 0 : ParseStatementFlag.AllowLabeledFunction));
|
|
267
|
-
}
|
|
268
|
-
parseStatementOrSloppyAnnexBFunctionDeclaration(allowLabeledFunction = false) {
|
|
269
|
-
let flags = ParseStatementFlag.StatementOnly;
|
|
270
|
-
if (this.options.annexB && !this.state.strict) {
|
|
271
|
-
flags |= ParseStatementFlag.AllowFunctionDeclaration;
|
|
272
|
-
if (allowLabeledFunction) {
|
|
273
|
-
flags |= ParseStatementFlag.AllowLabeledFunction;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return this.parseStatementLike(flags);
|
|
277
|
-
}
|
|
278
|
-
parseStatement() {
|
|
279
|
-
return this.parseStatementLike(ParseStatementFlag.StatementOnly);
|
|
280
|
-
}
|
|
281
|
-
parseStatementLike(flags) {
|
|
282
|
-
let decorators = null;
|
|
283
|
-
if (this.match(26)) {
|
|
284
|
-
decorators = this.parseDecorators(true);
|
|
285
|
-
}
|
|
286
|
-
return this.parseStatementContent(flags, decorators);
|
|
287
|
-
}
|
|
288
|
-
parseStatementContent(flags, decorators) {
|
|
289
|
-
const starttype = this.state.type;
|
|
290
|
-
const node = this.startNode();
|
|
291
|
-
const allowDeclaration = !!(flags & ParseStatementFlag.AllowDeclaration);
|
|
292
|
-
const allowFunctionDeclaration = !!(flags & ParseStatementFlag.AllowFunctionDeclaration);
|
|
293
|
-
const topLevel = flags & ParseStatementFlag.AllowImportExport;
|
|
294
|
-
switch (starttype) {
|
|
295
|
-
case 60:
|
|
296
|
-
return this.parseBreakContinueStatement(node, true);
|
|
297
|
-
case 63:
|
|
298
|
-
return this.parseBreakContinueStatement(node, false);
|
|
299
|
-
case 64:
|
|
300
|
-
return this.parseDebuggerStatement(node);
|
|
301
|
-
case 90:
|
|
302
|
-
return this.parseDoWhileStatement(node);
|
|
303
|
-
case 91:
|
|
304
|
-
return this.parseForStatement(node);
|
|
305
|
-
case 68:
|
|
306
|
-
if (this.lookaheadCharCode() === 46) break;
|
|
307
|
-
if (!allowFunctionDeclaration) {
|
|
308
|
-
this.raise(this.state.strict ? _parseError.Errors.StrictFunction : this.options.annexB ? _parseError.Errors.SloppyFunctionAnnexB : _parseError.Errors.SloppyFunction, {
|
|
309
|
-
at: this.state.startLoc
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
|
|
313
|
-
case 80:
|
|
314
|
-
if (!allowDeclaration) this.unexpected();
|
|
315
|
-
return this.parseClass(this.maybeTakeDecorators(decorators, node), true);
|
|
316
|
-
case 69:
|
|
317
|
-
return this.parseIfStatement(node);
|
|
318
|
-
case 70:
|
|
319
|
-
return this.parseReturnStatement(node);
|
|
320
|
-
case 71:
|
|
321
|
-
return this.parseSwitchStatement(node);
|
|
322
|
-
case 72:
|
|
323
|
-
return this.parseThrowStatement(node);
|
|
324
|
-
case 73:
|
|
325
|
-
return this.parseTryStatement(node);
|
|
326
|
-
case 96:
|
|
327
|
-
if (!this.state.containsEsc && this.startsAwaitUsing()) {
|
|
328
|
-
if (!this.isAwaitAllowed()) {
|
|
329
|
-
this.raise(_parseError.Errors.AwaitUsingNotInAsyncContext, {
|
|
330
|
-
at: node
|
|
331
|
-
});
|
|
332
|
-
} else if (!allowDeclaration) {
|
|
333
|
-
this.raise(_parseError.Errors.UnexpectedLexicalDeclaration, {
|
|
334
|
-
at: node
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
this.next();
|
|
338
|
-
return this.parseVarStatement(node, "await using");
|
|
339
|
-
}
|
|
340
|
-
break;
|
|
341
|
-
case 105:
|
|
342
|
-
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifier()) {
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
this.expectPlugin("explicitResourceManagement");
|
|
346
|
-
if (!this.scope.inModule && this.scope.inTopLevel) {
|
|
347
|
-
this.raise(_parseError.Errors.UnexpectedUsingDeclaration, {
|
|
348
|
-
at: this.state.startLoc
|
|
349
|
-
});
|
|
350
|
-
} else if (!allowDeclaration) {
|
|
351
|
-
this.raise(_parseError.Errors.UnexpectedLexicalDeclaration, {
|
|
352
|
-
at: this.state.startLoc
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
return this.parseVarStatement(node, "using");
|
|
356
|
-
case 99:
|
|
357
|
-
{
|
|
358
|
-
if (this.state.containsEsc) {
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
const next = this.nextTokenStart();
|
|
362
|
-
const nextCh = this.codePointAtPos(next);
|
|
363
|
-
if (nextCh !== 91) {
|
|
364
|
-
if (!allowDeclaration && this.hasFollowingLineBreak()) break;
|
|
365
|
-
if (!this.chStartsBindingIdentifier(nextCh, next) && nextCh !== 123) {
|
|
366
|
-
break;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
case 75:
|
|
371
|
-
{
|
|
372
|
-
if (!allowDeclaration) {
|
|
373
|
-
this.raise(_parseError.Errors.UnexpectedLexicalDeclaration, {
|
|
374
|
-
at: this.state.startLoc
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
case 74:
|
|
379
|
-
{
|
|
380
|
-
const kind = this.state.value;
|
|
381
|
-
return this.parseVarStatement(node, kind);
|
|
382
|
-
}
|
|
383
|
-
case 92:
|
|
384
|
-
return this.parseWhileStatement(node);
|
|
385
|
-
case 76:
|
|
386
|
-
return this.parseWithStatement(node);
|
|
387
|
-
case 5:
|
|
388
|
-
return this.parseBlock();
|
|
389
|
-
case 13:
|
|
390
|
-
return this.parseEmptyStatement(node);
|
|
391
|
-
case 83:
|
|
392
|
-
{
|
|
393
|
-
const nextTokenCharCode = this.lookaheadCharCode();
|
|
394
|
-
if (nextTokenCharCode === 40 || nextTokenCharCode === 46) {
|
|
395
|
-
break;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
case 82:
|
|
399
|
-
{
|
|
400
|
-
if (!this.options.allowImportExportEverywhere && !topLevel) {
|
|
401
|
-
this.raise(_parseError.Errors.UnexpectedImportExport, {
|
|
402
|
-
at: this.state.startLoc
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
this.next();
|
|
406
|
-
let result;
|
|
407
|
-
if (starttype === 83) {
|
|
408
|
-
result = this.parseImport(node);
|
|
409
|
-
if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
|
|
410
|
-
this.sawUnambiguousESM = true;
|
|
411
|
-
}
|
|
412
|
-
} else {
|
|
413
|
-
result = this.parseExport(node, decorators);
|
|
414
|
-
if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") {
|
|
415
|
-
this.sawUnambiguousESM = true;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
this.assertModuleNodeAllowed(result);
|
|
419
|
-
return result;
|
|
420
|
-
}
|
|
421
|
-
default:
|
|
422
|
-
{
|
|
423
|
-
if (this.isAsyncFunction()) {
|
|
424
|
-
if (!allowDeclaration) {
|
|
425
|
-
this.raise(_parseError.Errors.AsyncFunctionInSingleStatementContext, {
|
|
426
|
-
at: this.state.startLoc
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
this.next();
|
|
430
|
-
return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
const maybeName = this.state.value;
|
|
435
|
-
const expr = this.parseExpression();
|
|
436
|
-
if ((0, _types.tokenIsIdentifier)(starttype) && expr.type === "Identifier" && this.eat(14)) {
|
|
437
|
-
return this.parseLabeledStatement(node, maybeName, expr, flags);
|
|
438
|
-
} else {
|
|
439
|
-
return this.parseExpressionStatement(node, expr, decorators);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
assertModuleNodeAllowed(node) {
|
|
443
|
-
if (!this.options.allowImportExportEverywhere && !this.inModule) {
|
|
444
|
-
this.raise(_parseError.Errors.ImportOutsideModule, {
|
|
445
|
-
at: node
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
decoratorsEnabledBeforeExport() {
|
|
450
|
-
if (this.hasPlugin("decorators-legacy")) return true;
|
|
451
|
-
return this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") !== false;
|
|
452
|
-
}
|
|
453
|
-
maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
|
|
454
|
-
if (maybeDecorators) {
|
|
455
|
-
if (classNode.decorators && classNode.decorators.length > 0) {
|
|
456
|
-
if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
|
|
457
|
-
this.raise(_parseError.Errors.DecoratorsBeforeAfterExport, {
|
|
458
|
-
at: classNode.decorators[0]
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
classNode.decorators.unshift(...maybeDecorators);
|
|
462
|
-
} else {
|
|
463
|
-
classNode.decorators = maybeDecorators;
|
|
464
|
-
}
|
|
465
|
-
this.resetStartLocationFromNode(classNode, maybeDecorators[0]);
|
|
466
|
-
if (exportNode) this.resetStartLocationFromNode(exportNode, classNode);
|
|
467
|
-
}
|
|
468
|
-
return classNode;
|
|
469
|
-
}
|
|
470
|
-
canHaveLeadingDecorator() {
|
|
471
|
-
return this.match(80);
|
|
472
|
-
}
|
|
473
|
-
parseDecorators(allowExport) {
|
|
474
|
-
const decorators = [];
|
|
475
|
-
do {
|
|
476
|
-
decorators.push(this.parseDecorator());
|
|
477
|
-
} while (this.match(26));
|
|
478
|
-
if (this.match(82)) {
|
|
479
|
-
if (!allowExport) {
|
|
480
|
-
this.unexpected();
|
|
481
|
-
}
|
|
482
|
-
if (!this.decoratorsEnabledBeforeExport()) {
|
|
483
|
-
this.raise(_parseError.Errors.DecoratorExportClass, {
|
|
484
|
-
at: this.state.startLoc
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
} else if (!this.canHaveLeadingDecorator()) {
|
|
488
|
-
throw this.raise(_parseError.Errors.UnexpectedLeadingDecorator, {
|
|
489
|
-
at: this.state.startLoc
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
return decorators;
|
|
493
|
-
}
|
|
494
|
-
parseDecorator() {
|
|
495
|
-
this.expectOnePlugin(["decorators", "decorators-legacy"]);
|
|
496
|
-
const node = this.startNode();
|
|
497
|
-
this.next();
|
|
498
|
-
if (this.hasPlugin("decorators")) {
|
|
499
|
-
const startLoc = this.state.startLoc;
|
|
500
|
-
let expr;
|
|
501
|
-
if (this.match(10)) {
|
|
502
|
-
const startLoc = this.state.startLoc;
|
|
503
|
-
this.next();
|
|
504
|
-
expr = this.parseExpression();
|
|
505
|
-
this.expect(11);
|
|
506
|
-
expr = this.wrapParenthesis(startLoc, expr);
|
|
507
|
-
const paramsStartLoc = this.state.startLoc;
|
|
508
|
-
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
509
|
-
if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
|
|
510
|
-
this.raise(_parseError.Errors.DecoratorArgumentsOutsideParentheses, {
|
|
511
|
-
at: paramsStartLoc
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
} else {
|
|
515
|
-
expr = this.parseIdentifier(false);
|
|
516
|
-
while (this.eat(16)) {
|
|
517
|
-
const node = this.startNodeAt(startLoc);
|
|
518
|
-
node.object = expr;
|
|
519
|
-
if (this.match(136)) {
|
|
520
|
-
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
521
|
-
node.property = this.parsePrivateName();
|
|
522
|
-
} else {
|
|
523
|
-
node.property = this.parseIdentifier(true);
|
|
524
|
-
}
|
|
525
|
-
node.computed = false;
|
|
526
|
-
expr = this.finishNode(node, "MemberExpression");
|
|
527
|
-
}
|
|
528
|
-
node.expression = this.parseMaybeDecoratorArguments(expr);
|
|
529
|
-
}
|
|
530
|
-
} else {
|
|
531
|
-
node.expression = this.parseExprSubscripts();
|
|
532
|
-
}
|
|
533
|
-
return this.finishNode(node, "Decorator");
|
|
534
|
-
}
|
|
535
|
-
parseMaybeDecoratorArguments(expr) {
|
|
536
|
-
if (this.eat(10)) {
|
|
537
|
-
const node = this.startNodeAtNode(expr);
|
|
538
|
-
node.callee = expr;
|
|
539
|
-
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
540
|
-
this.toReferencedList(node.arguments);
|
|
541
|
-
return this.finishNode(node, "CallExpression");
|
|
542
|
-
}
|
|
543
|
-
return expr;
|
|
544
|
-
}
|
|
545
|
-
parseBreakContinueStatement(node, isBreak) {
|
|
546
|
-
this.next();
|
|
547
|
-
if (this.isLineTerminator()) {
|
|
548
|
-
node.label = null;
|
|
549
|
-
} else {
|
|
550
|
-
node.label = this.parseIdentifier();
|
|
551
|
-
this.semicolon();
|
|
552
|
-
}
|
|
553
|
-
this.verifyBreakContinue(node, isBreak);
|
|
554
|
-
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
|
|
555
|
-
}
|
|
556
|
-
verifyBreakContinue(node, isBreak) {
|
|
557
|
-
let i;
|
|
558
|
-
for (i = 0; i < this.state.labels.length; ++i) {
|
|
559
|
-
const lab = this.state.labels[i];
|
|
560
|
-
if (node.label == null || lab.name === node.label.name) {
|
|
561
|
-
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
|
|
562
|
-
if (node.label && isBreak) break;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
if (i === this.state.labels.length) {
|
|
566
|
-
const type = isBreak ? "BreakStatement" : "ContinueStatement";
|
|
567
|
-
this.raise(_parseError.Errors.IllegalBreakContinue, {
|
|
568
|
-
at: node,
|
|
569
|
-
type
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
parseDebuggerStatement(node) {
|
|
574
|
-
this.next();
|
|
575
|
-
this.semicolon();
|
|
576
|
-
return this.finishNode(node, "DebuggerStatement");
|
|
577
|
-
}
|
|
578
|
-
parseHeaderExpression() {
|
|
579
|
-
this.expect(10);
|
|
580
|
-
const val = this.parseExpression();
|
|
581
|
-
this.expect(11);
|
|
582
|
-
return val;
|
|
583
|
-
}
|
|
584
|
-
parseDoWhileStatement(node) {
|
|
585
|
-
this.next();
|
|
586
|
-
this.state.labels.push(loopLabel);
|
|
587
|
-
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
588
|
-
this.state.labels.pop();
|
|
589
|
-
this.expect(92);
|
|
590
|
-
node.test = this.parseHeaderExpression();
|
|
591
|
-
this.eat(13);
|
|
592
|
-
return this.finishNode(node, "DoWhileStatement");
|
|
593
|
-
}
|
|
594
|
-
parseForStatement(node) {
|
|
595
|
-
this.next();
|
|
596
|
-
this.state.labels.push(loopLabel);
|
|
597
|
-
let awaitAt = null;
|
|
598
|
-
if (this.isAwaitAllowed() && this.eatContextual(96)) {
|
|
599
|
-
awaitAt = this.state.lastTokStartLoc;
|
|
600
|
-
}
|
|
601
|
-
this.scope.enter(_scopeflags.ScopeFlag.OTHER);
|
|
602
|
-
this.expect(10);
|
|
603
|
-
if (this.match(13)) {
|
|
604
|
-
if (awaitAt !== null) {
|
|
605
|
-
this.unexpected(awaitAt);
|
|
606
|
-
}
|
|
607
|
-
return this.parseFor(node, null);
|
|
608
|
-
}
|
|
609
|
-
const startsWithLet = this.isContextual(99);
|
|
610
|
-
{
|
|
611
|
-
const startsWithAwaitUsing = this.isContextual(96) && this.startsAwaitUsing();
|
|
612
|
-
const starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(105) && this.startsUsingForOf();
|
|
613
|
-
const isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
|
|
614
|
-
if (this.match(74) || this.match(75) || isLetOrUsing) {
|
|
615
|
-
const initNode = this.startNode();
|
|
616
|
-
let kind;
|
|
617
|
-
if (startsWithAwaitUsing) {
|
|
618
|
-
kind = "await using";
|
|
619
|
-
if (!this.isAwaitAllowed()) {
|
|
620
|
-
this.raise(_parseError.Errors.AwaitUsingNotInAsyncContext, {
|
|
621
|
-
at: this.state.startLoc
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
this.next();
|
|
625
|
-
} else {
|
|
626
|
-
kind = this.state.value;
|
|
627
|
-
}
|
|
628
|
-
this.next();
|
|
629
|
-
this.parseVar(initNode, true, kind);
|
|
630
|
-
const init = this.finishNode(initNode, "VariableDeclaration");
|
|
631
|
-
const isForIn = this.match(58);
|
|
632
|
-
if (isForIn && starsWithUsingDeclaration) {
|
|
633
|
-
this.raise(_parseError.Errors.ForInUsing, {
|
|
634
|
-
at: init
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
if ((isForIn || this.isContextual(101)) && init.declarations.length === 1) {
|
|
638
|
-
return this.parseForIn(node, init, awaitAt);
|
|
639
|
-
}
|
|
640
|
-
if (awaitAt !== null) {
|
|
641
|
-
this.unexpected(awaitAt);
|
|
642
|
-
}
|
|
643
|
-
return this.parseFor(node, init);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
const startsWithAsync = this.isContextual(95);
|
|
647
|
-
const refExpressionErrors = new _util.ExpressionErrors();
|
|
648
|
-
const init = this.parseExpression(true, refExpressionErrors);
|
|
649
|
-
const isForOf = this.isContextual(101);
|
|
650
|
-
if (isForOf) {
|
|
651
|
-
if (startsWithLet) {
|
|
652
|
-
this.raise(_parseError.Errors.ForOfLet, {
|
|
653
|
-
at: init
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
if (awaitAt === null && startsWithAsync && init.type === "Identifier") {
|
|
657
|
-
this.raise(_parseError.Errors.ForOfAsync, {
|
|
658
|
-
at: init
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
if (isForOf || this.match(58)) {
|
|
663
|
-
this.checkDestructuringPrivate(refExpressionErrors);
|
|
664
|
-
this.toAssignable(init, true);
|
|
665
|
-
const type = isForOf ? "ForOfStatement" : "ForInStatement";
|
|
666
|
-
this.checkLVal(init, {
|
|
667
|
-
in: {
|
|
668
|
-
type
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
return this.parseForIn(node, init, awaitAt);
|
|
672
|
-
} else {
|
|
673
|
-
this.checkExpressionErrors(refExpressionErrors, true);
|
|
674
|
-
}
|
|
675
|
-
if (awaitAt !== null) {
|
|
676
|
-
this.unexpected(awaitAt);
|
|
677
|
-
}
|
|
678
|
-
return this.parseFor(node, init);
|
|
679
|
-
}
|
|
680
|
-
parseFunctionStatement(node, isAsync, isHangingDeclaration) {
|
|
681
|
-
this.next();
|
|
682
|
-
return this.parseFunction(node, ParseFunctionFlag.Declaration | (isHangingDeclaration ? ParseFunctionFlag.HangingDeclaration : 0) | (isAsync ? ParseFunctionFlag.Async : 0));
|
|
683
|
-
}
|
|
684
|
-
parseIfStatement(node) {
|
|
685
|
-
this.next();
|
|
686
|
-
node.test = this.parseHeaderExpression();
|
|
687
|
-
node.consequent = this.parseStatementOrSloppyAnnexBFunctionDeclaration();
|
|
688
|
-
node.alternate = this.eat(66) ? this.parseStatementOrSloppyAnnexBFunctionDeclaration() : null;
|
|
689
|
-
return this.finishNode(node, "IfStatement");
|
|
690
|
-
}
|
|
691
|
-
parseReturnStatement(node) {
|
|
692
|
-
if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
|
|
693
|
-
this.raise(_parseError.Errors.IllegalReturn, {
|
|
694
|
-
at: this.state.startLoc
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
this.next();
|
|
698
|
-
if (this.isLineTerminator()) {
|
|
699
|
-
node.argument = null;
|
|
700
|
-
} else {
|
|
701
|
-
node.argument = this.parseExpression();
|
|
702
|
-
this.semicolon();
|
|
703
|
-
}
|
|
704
|
-
return this.finishNode(node, "ReturnStatement");
|
|
705
|
-
}
|
|
706
|
-
parseSwitchStatement(node) {
|
|
707
|
-
this.next();
|
|
708
|
-
node.discriminant = this.parseHeaderExpression();
|
|
709
|
-
const cases = node.cases = [];
|
|
710
|
-
this.expect(5);
|
|
711
|
-
this.state.labels.push(switchLabel);
|
|
712
|
-
this.scope.enter(_scopeflags.ScopeFlag.OTHER);
|
|
713
|
-
let cur;
|
|
714
|
-
for (let sawDefault; !this.match(8);) {
|
|
715
|
-
if (this.match(61) || this.match(65)) {
|
|
716
|
-
const isCase = this.match(61);
|
|
717
|
-
if (cur) this.finishNode(cur, "SwitchCase");
|
|
718
|
-
cases.push(cur = this.startNode());
|
|
719
|
-
cur.consequent = [];
|
|
720
|
-
this.next();
|
|
721
|
-
if (isCase) {
|
|
722
|
-
cur.test = this.parseExpression();
|
|
723
|
-
} else {
|
|
724
|
-
if (sawDefault) {
|
|
725
|
-
this.raise(_parseError.Errors.MultipleDefaultsInSwitch, {
|
|
726
|
-
at: this.state.lastTokStartLoc
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
sawDefault = true;
|
|
730
|
-
cur.test = null;
|
|
731
|
-
}
|
|
732
|
-
this.expect(14);
|
|
733
|
-
} else {
|
|
734
|
-
if (cur) {
|
|
735
|
-
cur.consequent.push(this.parseStatementListItem());
|
|
736
|
-
} else {
|
|
737
|
-
this.unexpected();
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
this.scope.exit();
|
|
742
|
-
if (cur) this.finishNode(cur, "SwitchCase");
|
|
743
|
-
this.next();
|
|
744
|
-
this.state.labels.pop();
|
|
745
|
-
return this.finishNode(node, "SwitchStatement");
|
|
746
|
-
}
|
|
747
|
-
parseThrowStatement(node) {
|
|
748
|
-
this.next();
|
|
749
|
-
if (this.hasPrecedingLineBreak()) {
|
|
750
|
-
this.raise(_parseError.Errors.NewlineAfterThrow, {
|
|
751
|
-
at: this.state.lastTokEndLoc
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
node.argument = this.parseExpression();
|
|
755
|
-
this.semicolon();
|
|
756
|
-
return this.finishNode(node, "ThrowStatement");
|
|
757
|
-
}
|
|
758
|
-
parseCatchClauseParam() {
|
|
759
|
-
const param = this.parseBindingAtom();
|
|
760
|
-
this.scope.enter(this.options.annexB && param.type === "Identifier" ? _scopeflags.ScopeFlag.SIMPLE_CATCH : 0);
|
|
761
|
-
this.checkLVal(param, {
|
|
762
|
-
in: {
|
|
763
|
-
type: "CatchClause"
|
|
764
|
-
},
|
|
765
|
-
binding: _scopeflags.BindingFlag.TYPE_CATCH_PARAM
|
|
766
|
-
});
|
|
767
|
-
return param;
|
|
768
|
-
}
|
|
769
|
-
parseTryStatement(node) {
|
|
770
|
-
this.next();
|
|
771
|
-
node.block = this.parseBlock();
|
|
772
|
-
node.handler = null;
|
|
773
|
-
if (this.match(62)) {
|
|
774
|
-
const clause = this.startNode();
|
|
775
|
-
this.next();
|
|
776
|
-
if (this.match(10)) {
|
|
777
|
-
this.expect(10);
|
|
778
|
-
clause.param = this.parseCatchClauseParam();
|
|
779
|
-
this.expect(11);
|
|
780
|
-
} else {
|
|
781
|
-
clause.param = null;
|
|
782
|
-
this.scope.enter(_scopeflags.ScopeFlag.OTHER);
|
|
783
|
-
}
|
|
784
|
-
clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false));
|
|
785
|
-
this.scope.exit();
|
|
786
|
-
node.handler = this.finishNode(clause, "CatchClause");
|
|
787
|
-
}
|
|
788
|
-
node.finalizer = this.eat(67) ? this.parseBlock() : null;
|
|
789
|
-
if (!node.handler && !node.finalizer) {
|
|
790
|
-
this.raise(_parseError.Errors.NoCatchOrFinally, {
|
|
791
|
-
at: node
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
return this.finishNode(node, "TryStatement");
|
|
795
|
-
}
|
|
796
|
-
parseVarStatement(node, kind, allowMissingInitializer = false) {
|
|
797
|
-
this.next();
|
|
798
|
-
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
799
|
-
this.semicolon();
|
|
800
|
-
return this.finishNode(node, "VariableDeclaration");
|
|
801
|
-
}
|
|
802
|
-
parseWhileStatement(node) {
|
|
803
|
-
this.next();
|
|
804
|
-
node.test = this.parseHeaderExpression();
|
|
805
|
-
this.state.labels.push(loopLabel);
|
|
806
|
-
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
807
|
-
this.state.labels.pop();
|
|
808
|
-
return this.finishNode(node, "WhileStatement");
|
|
809
|
-
}
|
|
810
|
-
parseWithStatement(node) {
|
|
811
|
-
if (this.state.strict) {
|
|
812
|
-
this.raise(_parseError.Errors.StrictWith, {
|
|
813
|
-
at: this.state.startLoc
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
this.next();
|
|
817
|
-
node.object = this.parseHeaderExpression();
|
|
818
|
-
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
819
|
-
return this.finishNode(node, "WithStatement");
|
|
820
|
-
}
|
|
821
|
-
parseEmptyStatement(node) {
|
|
822
|
-
this.next();
|
|
823
|
-
return this.finishNode(node, "EmptyStatement");
|
|
824
|
-
}
|
|
825
|
-
parseLabeledStatement(node, maybeName, expr, flags) {
|
|
826
|
-
for (const label of this.state.labels) {
|
|
827
|
-
if (label.name === maybeName) {
|
|
828
|
-
this.raise(_parseError.Errors.LabelRedeclaration, {
|
|
829
|
-
at: expr,
|
|
830
|
-
labelName: maybeName
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
const kind = (0, _types.tokenIsLoop)(this.state.type) ? "loop" : this.match(71) ? "switch" : null;
|
|
835
|
-
for (let i = this.state.labels.length - 1; i >= 0; i--) {
|
|
836
|
-
const label = this.state.labels[i];
|
|
837
|
-
if (label.statementStart === node.start) {
|
|
838
|
-
label.statementStart = this.state.start;
|
|
839
|
-
label.kind = kind;
|
|
840
|
-
} else {
|
|
841
|
-
break;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
this.state.labels.push({
|
|
845
|
-
name: maybeName,
|
|
846
|
-
kind: kind,
|
|
847
|
-
statementStart: this.state.start
|
|
848
|
-
});
|
|
849
|
-
node.body = flags & ParseStatementFlag.AllowLabeledFunction ? this.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : this.parseStatement();
|
|
850
|
-
this.state.labels.pop();
|
|
851
|
-
node.label = expr;
|
|
852
|
-
return this.finishNode(node, "LabeledStatement");
|
|
853
|
-
}
|
|
854
|
-
parseExpressionStatement(node, expr, decorators) {
|
|
855
|
-
node.expression = expr;
|
|
856
|
-
this.semicolon();
|
|
857
|
-
return this.finishNode(node, "ExpressionStatement");
|
|
858
|
-
}
|
|
859
|
-
parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) {
|
|
860
|
-
const node = this.startNode();
|
|
861
|
-
if (allowDirectives) {
|
|
862
|
-
this.state.strictErrors.clear();
|
|
863
|
-
}
|
|
864
|
-
this.expect(5);
|
|
865
|
-
if (createNewLexicalScope) {
|
|
866
|
-
this.scope.enter(_scopeflags.ScopeFlag.OTHER);
|
|
867
|
-
}
|
|
868
|
-
this.parseBlockBody(node, allowDirectives, false, 8, afterBlockParse);
|
|
869
|
-
if (createNewLexicalScope) {
|
|
870
|
-
this.scope.exit();
|
|
871
|
-
}
|
|
872
|
-
return this.finishNode(node, "BlockStatement");
|
|
873
|
-
}
|
|
874
|
-
isValidDirective(stmt) {
|
|
875
|
-
return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized;
|
|
876
|
-
}
|
|
877
|
-
parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
|
|
878
|
-
const body = node.body = [];
|
|
879
|
-
const directives = node.directives = [];
|
|
880
|
-
this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse);
|
|
881
|
-
}
|
|
882
|
-
parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) {
|
|
883
|
-
const oldStrict = this.state.strict;
|
|
884
|
-
let hasStrictModeDirective = false;
|
|
885
|
-
let parsedNonDirective = false;
|
|
886
|
-
while (!this.match(end)) {
|
|
887
|
-
const stmt = topLevel ? this.parseModuleItem() : this.parseStatementListItem();
|
|
888
|
-
if (directives && !parsedNonDirective) {
|
|
889
|
-
if (this.isValidDirective(stmt)) {
|
|
890
|
-
const directive = this.stmtToDirective(stmt);
|
|
891
|
-
directives.push(directive);
|
|
892
|
-
if (!hasStrictModeDirective && directive.value.value === "use strict") {
|
|
893
|
-
hasStrictModeDirective = true;
|
|
894
|
-
this.setStrict(true);
|
|
895
|
-
}
|
|
896
|
-
continue;
|
|
897
|
-
}
|
|
898
|
-
parsedNonDirective = true;
|
|
899
|
-
this.state.strictErrors.clear();
|
|
900
|
-
}
|
|
901
|
-
body.push(stmt);
|
|
902
|
-
}
|
|
903
|
-
afterBlockParse == null ? void 0 : afterBlockParse.call(this, hasStrictModeDirective);
|
|
904
|
-
if (!oldStrict) {
|
|
905
|
-
this.setStrict(false);
|
|
906
|
-
}
|
|
907
|
-
this.next();
|
|
908
|
-
}
|
|
909
|
-
parseFor(node, init) {
|
|
910
|
-
node.init = init;
|
|
911
|
-
this.semicolon(false);
|
|
912
|
-
node.test = this.match(13) ? null : this.parseExpression();
|
|
913
|
-
this.semicolon(false);
|
|
914
|
-
node.update = this.match(11) ? null : this.parseExpression();
|
|
915
|
-
this.expect(11);
|
|
916
|
-
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
917
|
-
this.scope.exit();
|
|
918
|
-
this.state.labels.pop();
|
|
919
|
-
return this.finishNode(node, "ForStatement");
|
|
920
|
-
}
|
|
921
|
-
parseForIn(node, init, awaitAt) {
|
|
922
|
-
const isForIn = this.match(58);
|
|
923
|
-
this.next();
|
|
924
|
-
if (isForIn) {
|
|
925
|
-
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
926
|
-
} else {
|
|
927
|
-
node.await = awaitAt !== null;
|
|
928
|
-
}
|
|
929
|
-
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
|
|
930
|
-
this.raise(_parseError.Errors.ForInOfLoopInitializer, {
|
|
931
|
-
at: init,
|
|
932
|
-
type: isForIn ? "ForInStatement" : "ForOfStatement"
|
|
933
|
-
});
|
|
934
|
-
}
|
|
935
|
-
if (init.type === "AssignmentPattern") {
|
|
936
|
-
this.raise(_parseError.Errors.InvalidLhs, {
|
|
937
|
-
at: init,
|
|
938
|
-
ancestor: {
|
|
939
|
-
type: "ForStatement"
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
node.left = init;
|
|
944
|
-
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn();
|
|
945
|
-
this.expect(11);
|
|
946
|
-
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement());
|
|
947
|
-
this.scope.exit();
|
|
948
|
-
this.state.labels.pop();
|
|
949
|
-
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
|
|
950
|
-
}
|
|
951
|
-
parseVar(node, isFor, kind, allowMissingInitializer = false) {
|
|
952
|
-
const declarations = node.declarations = [];
|
|
953
|
-
node.kind = kind;
|
|
954
|
-
for (;;) {
|
|
955
|
-
const decl = this.startNode();
|
|
956
|
-
this.parseVarId(decl, kind);
|
|
957
|
-
decl.init = !this.eat(29) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
958
|
-
if (decl.init === null && !allowMissingInitializer) {
|
|
959
|
-
if (decl.id.type !== "Identifier" && !(isFor && (this.match(58) || this.isContextual(101)))) {
|
|
960
|
-
this.raise(_parseError.Errors.DeclarationMissingInitializer, {
|
|
961
|
-
at: this.state.lastTokEndLoc,
|
|
962
|
-
kind: "destructuring"
|
|
963
|
-
});
|
|
964
|
-
} else if (kind === "const" && !(this.match(58) || this.isContextual(101))) {
|
|
965
|
-
this.raise(_parseError.Errors.DeclarationMissingInitializer, {
|
|
966
|
-
at: this.state.lastTokEndLoc,
|
|
967
|
-
kind: "const"
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
972
|
-
if (!this.eat(12)) break;
|
|
973
|
-
}
|
|
974
|
-
return node;
|
|
975
|
-
}
|
|
976
|
-
parseVarId(decl, kind) {
|
|
977
|
-
const id = this.parseBindingAtom();
|
|
978
|
-
this.checkLVal(id, {
|
|
979
|
-
in: {
|
|
980
|
-
type: "VariableDeclarator"
|
|
981
|
-
},
|
|
982
|
-
binding: kind === "var" ? _scopeflags.BindingFlag.TYPE_VAR : _scopeflags.BindingFlag.TYPE_LEXICAL
|
|
983
|
-
});
|
|
984
|
-
decl.id = id;
|
|
985
|
-
}
|
|
986
|
-
parseAsyncFunctionExpression(node) {
|
|
987
|
-
return this.parseFunction(node, ParseFunctionFlag.Async);
|
|
988
|
-
}
|
|
989
|
-
parseFunction(node, flags = ParseFunctionFlag.Expression) {
|
|
990
|
-
const hangingDeclaration = flags & ParseFunctionFlag.HangingDeclaration;
|
|
991
|
-
const isDeclaration = !!(flags & ParseFunctionFlag.Declaration);
|
|
992
|
-
const requireId = isDeclaration && !(flags & ParseFunctionFlag.NullableId);
|
|
993
|
-
const isAsync = !!(flags & ParseFunctionFlag.Async);
|
|
994
|
-
this.initFunction(node, isAsync);
|
|
995
|
-
if (this.match(55)) {
|
|
996
|
-
if (hangingDeclaration) {
|
|
997
|
-
this.raise(_parseError.Errors.GeneratorInSingleStatementContext, {
|
|
998
|
-
at: this.state.startLoc
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
this.next();
|
|
1002
|
-
node.generator = true;
|
|
1003
|
-
}
|
|
1004
|
-
if (isDeclaration) {
|
|
1005
|
-
node.id = this.parseFunctionId(requireId);
|
|
1006
|
-
}
|
|
1007
|
-
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
1008
|
-
this.state.maybeInArrowParameters = false;
|
|
1009
|
-
this.scope.enter(_scopeflags.ScopeFlag.FUNCTION);
|
|
1010
|
-
this.prodParam.enter((0, _productionParameter.functionFlags)(isAsync, node.generator));
|
|
1011
|
-
if (!isDeclaration) {
|
|
1012
|
-
node.id = this.parseFunctionId();
|
|
1013
|
-
}
|
|
1014
|
-
this.parseFunctionParams(node, false);
|
|
1015
|
-
this.withSmartMixTopicForbiddingContext(() => {
|
|
1016
|
-
this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
|
|
1017
|
-
});
|
|
1018
|
-
this.prodParam.exit();
|
|
1019
|
-
this.scope.exit();
|
|
1020
|
-
if (isDeclaration && !hangingDeclaration) {
|
|
1021
|
-
this.registerFunctionStatementId(node);
|
|
1022
|
-
}
|
|
1023
|
-
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
|
|
1024
|
-
return node;
|
|
1025
|
-
}
|
|
1026
|
-
parseFunctionId(requireId) {
|
|
1027
|
-
return requireId || (0, _types.tokenIsIdentifier)(this.state.type) ? this.parseIdentifier() : null;
|
|
1028
|
-
}
|
|
1029
|
-
parseFunctionParams(node, isConstructor) {
|
|
1030
|
-
this.expect(10);
|
|
1031
|
-
this.expressionScope.enter((0, _expressionScope.newParameterDeclarationScope)());
|
|
1032
|
-
node.params = this.parseBindingList(11, 41, _lval.ParseBindingListFlags.IS_FUNCTION_PARAMS | (isConstructor ? _lval.ParseBindingListFlags.IS_CONSTRUCTOR_PARAMS : 0));
|
|
1033
|
-
this.expressionScope.exit();
|
|
1034
|
-
}
|
|
1035
|
-
registerFunctionStatementId(node) {
|
|
1036
|
-
if (!node.id) return;
|
|
1037
|
-
this.scope.declareName(node.id.name, !this.options.annexB || this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? _scopeflags.BindingFlag.TYPE_VAR : _scopeflags.BindingFlag.TYPE_LEXICAL : _scopeflags.BindingFlag.TYPE_FUNCTION, node.id.loc.start);
|
|
1038
|
-
}
|
|
1039
|
-
parseClass(node, isStatement, optionalId) {
|
|
1040
|
-
this.next();
|
|
1041
|
-
const oldStrict = this.state.strict;
|
|
1042
|
-
this.state.strict = true;
|
|
1043
|
-
this.parseClassId(node, isStatement, optionalId);
|
|
1044
|
-
this.parseClassSuper(node);
|
|
1045
|
-
node.body = this.parseClassBody(!!node.superClass, oldStrict);
|
|
1046
|
-
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
|
|
1047
|
-
}
|
|
1048
|
-
isClassProperty() {
|
|
1049
|
-
return this.match(29) || this.match(13) || this.match(8);
|
|
1050
|
-
}
|
|
1051
|
-
isClassMethod() {
|
|
1052
|
-
return this.match(10);
|
|
1053
|
-
}
|
|
1054
|
-
isNonstaticConstructor(method) {
|
|
1055
|
-
return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
|
|
1056
|
-
}
|
|
1057
|
-
parseClassBody(hadSuperClass, oldStrict) {
|
|
1058
|
-
this.classScope.enter();
|
|
1059
|
-
const state = {
|
|
1060
|
-
hadConstructor: false,
|
|
1061
|
-
hadSuperClass
|
|
1062
|
-
};
|
|
1063
|
-
let decorators = [];
|
|
1064
|
-
const classBody = this.startNode();
|
|
1065
|
-
classBody.body = [];
|
|
1066
|
-
this.expect(5);
|
|
1067
|
-
this.withSmartMixTopicForbiddingContext(() => {
|
|
1068
|
-
while (!this.match(8)) {
|
|
1069
|
-
if (this.eat(13)) {
|
|
1070
|
-
if (decorators.length > 0) {
|
|
1071
|
-
throw this.raise(_parseError.Errors.DecoratorSemicolon, {
|
|
1072
|
-
at: this.state.lastTokEndLoc
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
continue;
|
|
1076
|
-
}
|
|
1077
|
-
if (this.match(26)) {
|
|
1078
|
-
decorators.push(this.parseDecorator());
|
|
1079
|
-
continue;
|
|
1080
|
-
}
|
|
1081
|
-
const member = this.startNode();
|
|
1082
|
-
if (decorators.length) {
|
|
1083
|
-
member.decorators = decorators;
|
|
1084
|
-
this.resetStartLocationFromNode(member, decorators[0]);
|
|
1085
|
-
decorators = [];
|
|
1086
|
-
}
|
|
1087
|
-
this.parseClassMember(classBody, member, state);
|
|
1088
|
-
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
|
|
1089
|
-
this.raise(_parseError.Errors.DecoratorConstructor, {
|
|
1090
|
-
at: member
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
});
|
|
1095
|
-
this.state.strict = oldStrict;
|
|
1096
|
-
this.next();
|
|
1097
|
-
if (decorators.length) {
|
|
1098
|
-
throw this.raise(_parseError.Errors.TrailingDecorator, {
|
|
1099
|
-
at: this.state.startLoc
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
this.classScope.exit();
|
|
1103
|
-
return this.finishNode(classBody, "ClassBody");
|
|
1104
|
-
}
|
|
1105
|
-
parseClassMemberFromModifier(classBody, member) {
|
|
1106
|
-
const key = this.parseIdentifier(true);
|
|
1107
|
-
if (this.isClassMethod()) {
|
|
1108
|
-
const method = member;
|
|
1109
|
-
method.kind = "method";
|
|
1110
|
-
method.computed = false;
|
|
1111
|
-
method.key = key;
|
|
1112
|
-
method.static = false;
|
|
1113
|
-
this.pushClassMethod(classBody, method, false, false, false, false);
|
|
1114
|
-
return true;
|
|
1115
|
-
} else if (this.isClassProperty()) {
|
|
1116
|
-
const prop = member;
|
|
1117
|
-
prop.computed = false;
|
|
1118
|
-
prop.key = key;
|
|
1119
|
-
prop.static = false;
|
|
1120
|
-
classBody.body.push(this.parseClassProperty(prop));
|
|
1121
|
-
return true;
|
|
1122
|
-
}
|
|
1123
|
-
this.resetPreviousNodeTrailingComments(key);
|
|
1124
|
-
return false;
|
|
1125
|
-
}
|
|
1126
|
-
parseClassMember(classBody, member, state) {
|
|
1127
|
-
const isStatic = this.isContextual(104);
|
|
1128
|
-
if (isStatic) {
|
|
1129
|
-
if (this.parseClassMemberFromModifier(classBody, member)) {
|
|
1130
|
-
return;
|
|
1131
|
-
}
|
|
1132
|
-
if (this.eat(5)) {
|
|
1133
|
-
this.parseClassStaticBlock(classBody, member);
|
|
1134
|
-
return;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
this.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
|
1138
|
-
}
|
|
1139
|
-
parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
|
|
1140
|
-
const publicMethod = member;
|
|
1141
|
-
const privateMethod = member;
|
|
1142
|
-
const publicProp = member;
|
|
1143
|
-
const privateProp = member;
|
|
1144
|
-
const accessorProp = member;
|
|
1145
|
-
const method = publicMethod;
|
|
1146
|
-
const publicMember = publicMethod;
|
|
1147
|
-
member.static = isStatic;
|
|
1148
|
-
this.parsePropertyNamePrefixOperator(member);
|
|
1149
|
-
if (this.eat(55)) {
|
|
1150
|
-
method.kind = "method";
|
|
1151
|
-
const isPrivateName = this.match(136);
|
|
1152
|
-
this.parseClassElementName(method);
|
|
1153
|
-
if (isPrivateName) {
|
|
1154
|
-
this.pushClassPrivateMethod(classBody, privateMethod, true, false);
|
|
1155
|
-
return;
|
|
1156
|
-
}
|
|
1157
|
-
if (this.isNonstaticConstructor(publicMethod)) {
|
|
1158
|
-
this.raise(_parseError.Errors.ConstructorIsGenerator, {
|
|
1159
|
-
at: publicMethod.key
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
|
-
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
1163
|
-
return;
|
|
1164
|
-
}
|
|
1165
|
-
const isContextual = (0, _types.tokenIsIdentifier)(this.state.type) && !this.state.containsEsc;
|
|
1166
|
-
const isPrivate = this.match(136);
|
|
1167
|
-
const key = this.parseClassElementName(member);
|
|
1168
|
-
const maybeQuestionTokenStartLoc = this.state.startLoc;
|
|
1169
|
-
this.parsePostMemberNameModifiers(publicMember);
|
|
1170
|
-
if (this.isClassMethod()) {
|
|
1171
|
-
method.kind = "method";
|
|
1172
|
-
if (isPrivate) {
|
|
1173
|
-
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
1174
|
-
return;
|
|
1175
|
-
}
|
|
1176
|
-
const isConstructor = this.isNonstaticConstructor(publicMethod);
|
|
1177
|
-
let allowsDirectSuper = false;
|
|
1178
|
-
if (isConstructor) {
|
|
1179
|
-
publicMethod.kind = "constructor";
|
|
1180
|
-
if (state.hadConstructor && !this.hasPlugin("typescript")) {
|
|
1181
|
-
this.raise(_parseError.Errors.DuplicateConstructor, {
|
|
1182
|
-
at: key
|
|
1183
|
-
});
|
|
1184
|
-
}
|
|
1185
|
-
if (isConstructor && this.hasPlugin("typescript") && member.override) {
|
|
1186
|
-
this.raise(_parseError.Errors.OverrideOnConstructor, {
|
|
1187
|
-
at: key
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
state.hadConstructor = true;
|
|
1191
|
-
allowsDirectSuper = state.hadSuperClass;
|
|
1192
|
-
}
|
|
1193
|
-
this.pushClassMethod(classBody, publicMethod, false, false, isConstructor, allowsDirectSuper);
|
|
1194
|
-
} else if (this.isClassProperty()) {
|
|
1195
|
-
if (isPrivate) {
|
|
1196
|
-
this.pushClassPrivateProperty(classBody, privateProp);
|
|
1197
|
-
} else {
|
|
1198
|
-
this.pushClassProperty(classBody, publicProp);
|
|
1199
|
-
}
|
|
1200
|
-
} else if (isContextual && key.name === "async" && !this.isLineTerminator()) {
|
|
1201
|
-
this.resetPreviousNodeTrailingComments(key);
|
|
1202
|
-
const isGenerator = this.eat(55);
|
|
1203
|
-
if (publicMember.optional) {
|
|
1204
|
-
this.unexpected(maybeQuestionTokenStartLoc);
|
|
1205
|
-
}
|
|
1206
|
-
method.kind = "method";
|
|
1207
|
-
const isPrivate = this.match(136);
|
|
1208
|
-
this.parseClassElementName(method);
|
|
1209
|
-
this.parsePostMemberNameModifiers(publicMember);
|
|
1210
|
-
if (isPrivate) {
|
|
1211
|
-
this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
1212
|
-
} else {
|
|
1213
|
-
if (this.isNonstaticConstructor(publicMethod)) {
|
|
1214
|
-
this.raise(_parseError.Errors.ConstructorIsAsync, {
|
|
1215
|
-
at: publicMethod.key
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
1219
|
-
}
|
|
1220
|
-
} else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(55) && this.isLineTerminator())) {
|
|
1221
|
-
this.resetPreviousNodeTrailingComments(key);
|
|
1222
|
-
method.kind = key.name;
|
|
1223
|
-
const isPrivate = this.match(136);
|
|
1224
|
-
this.parseClassElementName(publicMethod);
|
|
1225
|
-
if (isPrivate) {
|
|
1226
|
-
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
1227
|
-
} else {
|
|
1228
|
-
if (this.isNonstaticConstructor(publicMethod)) {
|
|
1229
|
-
this.raise(_parseError.Errors.ConstructorIsAccessor, {
|
|
1230
|
-
at: publicMethod.key
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
1234
|
-
}
|
|
1235
|
-
this.checkGetterSetterParams(publicMethod);
|
|
1236
|
-
} else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) {
|
|
1237
|
-
this.expectPlugin("decoratorAutoAccessors");
|
|
1238
|
-
this.resetPreviousNodeTrailingComments(key);
|
|
1239
|
-
const isPrivate = this.match(136);
|
|
1240
|
-
this.parseClassElementName(publicProp);
|
|
1241
|
-
this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
|
|
1242
|
-
} else if (this.isLineTerminator()) {
|
|
1243
|
-
if (isPrivate) {
|
|
1244
|
-
this.pushClassPrivateProperty(classBody, privateProp);
|
|
1245
|
-
} else {
|
|
1246
|
-
this.pushClassProperty(classBody, publicProp);
|
|
1247
|
-
}
|
|
1248
|
-
} else {
|
|
1249
|
-
this.unexpected();
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
parseClassElementName(member) {
|
|
1253
|
-
const {
|
|
1254
|
-
type,
|
|
1255
|
-
value
|
|
1256
|
-
} = this.state;
|
|
1257
|
-
if ((type === 130 || type === 131) && member.static && value === "prototype") {
|
|
1258
|
-
this.raise(_parseError.Errors.StaticPrototype, {
|
|
1259
|
-
at: this.state.startLoc
|
|
1260
|
-
});
|
|
1261
|
-
}
|
|
1262
|
-
if (type === 136) {
|
|
1263
|
-
if (value === "constructor") {
|
|
1264
|
-
this.raise(_parseError.Errors.ConstructorClassPrivateField, {
|
|
1265
|
-
at: this.state.startLoc
|
|
1266
|
-
});
|
|
1267
|
-
}
|
|
1268
|
-
const key = this.parsePrivateName();
|
|
1269
|
-
member.key = key;
|
|
1270
|
-
return key;
|
|
1271
|
-
}
|
|
1272
|
-
return this.parsePropertyName(member);
|
|
1273
|
-
}
|
|
1274
|
-
parseClassStaticBlock(classBody, member) {
|
|
1275
|
-
var _member$decorators;
|
|
1276
|
-
this.scope.enter(_scopeflags.ScopeFlag.CLASS | _scopeflags.ScopeFlag.STATIC_BLOCK | _scopeflags.ScopeFlag.SUPER);
|
|
1277
|
-
const oldLabels = this.state.labels;
|
|
1278
|
-
this.state.labels = [];
|
|
1279
|
-
this.prodParam.enter(_productionParameter.PARAM);
|
|
1280
|
-
const body = member.body = [];
|
|
1281
|
-
this.parseBlockOrModuleBlockBody(body, undefined, false, 8);
|
|
1282
|
-
this.prodParam.exit();
|
|
1283
|
-
this.scope.exit();
|
|
1284
|
-
this.state.labels = oldLabels;
|
|
1285
|
-
classBody.body.push(this.finishNode(member, "StaticBlock"));
|
|
1286
|
-
if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
|
|
1287
|
-
this.raise(_parseError.Errors.DecoratorStaticBlock, {
|
|
1288
|
-
at: member
|
|
1289
|
-
});
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
pushClassProperty(classBody, prop) {
|
|
1293
|
-
if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
|
|
1294
|
-
this.raise(_parseError.Errors.ConstructorClassField, {
|
|
1295
|
-
at: prop.key
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
classBody.body.push(this.parseClassProperty(prop));
|
|
1299
|
-
}
|
|
1300
|
-
pushClassPrivateProperty(classBody, prop) {
|
|
1301
|
-
const node = this.parseClassPrivateProperty(prop);
|
|
1302
|
-
classBody.body.push(node);
|
|
1303
|
-
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), _scopeflags.ClassElementType.OTHER, node.key.loc.start);
|
|
1304
|
-
}
|
|
1305
|
-
pushClassAccessorProperty(classBody, prop, isPrivate) {
|
|
1306
|
-
if (!isPrivate && !prop.computed) {
|
|
1307
|
-
const key = prop.key;
|
|
1308
|
-
if (key.name === "constructor" || key.value === "constructor") {
|
|
1309
|
-
this.raise(_parseError.Errors.ConstructorClassField, {
|
|
1310
|
-
at: key
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
const node = this.parseClassAccessorProperty(prop);
|
|
1315
|
-
classBody.body.push(node);
|
|
1316
|
-
if (isPrivate) {
|
|
1317
|
-
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), _scopeflags.ClassElementType.OTHER, node.key.loc.start);
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
1321
|
-
classBody.body.push(this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true));
|
|
1322
|
-
}
|
|
1323
|
-
pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
|
|
1324
|
-
const node = this.parseMethod(method, isGenerator, isAsync, false, false, "ClassPrivateMethod", true);
|
|
1325
|
-
classBody.body.push(node);
|
|
1326
|
-
const kind = node.kind === "get" ? node.static ? _scopeflags.ClassElementType.STATIC_GETTER : _scopeflags.ClassElementType.INSTANCE_GETTER : node.kind === "set" ? node.static ? _scopeflags.ClassElementType.STATIC_SETTER : _scopeflags.ClassElementType.INSTANCE_SETTER : _scopeflags.ClassElementType.OTHER;
|
|
1327
|
-
this.declareClassPrivateMethodInScope(node, kind);
|
|
1328
|
-
}
|
|
1329
|
-
declareClassPrivateMethodInScope(node, kind) {
|
|
1330
|
-
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.loc.start);
|
|
1331
|
-
}
|
|
1332
|
-
parsePostMemberNameModifiers(methodOrProp) {}
|
|
1333
|
-
parseClassPrivateProperty(node) {
|
|
1334
|
-
this.parseInitializer(node);
|
|
1335
|
-
this.semicolon();
|
|
1336
|
-
return this.finishNode(node, "ClassPrivateProperty");
|
|
1337
|
-
}
|
|
1338
|
-
parseClassProperty(node) {
|
|
1339
|
-
this.parseInitializer(node);
|
|
1340
|
-
this.semicolon();
|
|
1341
|
-
return this.finishNode(node, "ClassProperty");
|
|
1342
|
-
}
|
|
1343
|
-
parseClassAccessorProperty(node) {
|
|
1344
|
-
this.parseInitializer(node);
|
|
1345
|
-
this.semicolon();
|
|
1346
|
-
return this.finishNode(node, "ClassAccessorProperty");
|
|
1347
|
-
}
|
|
1348
|
-
parseInitializer(node) {
|
|
1349
|
-
this.scope.enter(_scopeflags.ScopeFlag.CLASS | _scopeflags.ScopeFlag.SUPER);
|
|
1350
|
-
this.expressionScope.enter((0, _expressionScope.newExpressionScope)());
|
|
1351
|
-
this.prodParam.enter(_productionParameter.PARAM);
|
|
1352
|
-
node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
|
|
1353
|
-
this.expressionScope.exit();
|
|
1354
|
-
this.prodParam.exit();
|
|
1355
|
-
this.scope.exit();
|
|
1356
|
-
}
|
|
1357
|
-
parseClassId(node, isStatement, optionalId, bindingType = _scopeflags.BindingFlag.TYPE_CLASS) {
|
|
1358
|
-
if ((0, _types.tokenIsIdentifier)(this.state.type)) {
|
|
1359
|
-
node.id = this.parseIdentifier();
|
|
1360
|
-
if (isStatement) {
|
|
1361
|
-
this.declareNameFromIdentifier(node.id, bindingType);
|
|
1362
|
-
}
|
|
1363
|
-
} else {
|
|
1364
|
-
if (optionalId || !isStatement) {
|
|
1365
|
-
node.id = null;
|
|
1366
|
-
} else {
|
|
1367
|
-
throw this.raise(_parseError.Errors.MissingClassName, {
|
|
1368
|
-
at: this.state.startLoc
|
|
1369
|
-
});
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
parseClassSuper(node) {
|
|
1374
|
-
node.superClass = this.eat(81) ? this.parseExprSubscripts() : null;
|
|
1375
|
-
}
|
|
1376
|
-
parseExport(node, decorators) {
|
|
1377
|
-
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, true);
|
|
1378
|
-
const hasDefault = this.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier);
|
|
1379
|
-
const parseAfterDefault = !hasDefault || this.eat(12);
|
|
1380
|
-
const hasStar = parseAfterDefault && this.eatExportStar(node);
|
|
1381
|
-
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
|
|
1382
|
-
const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(12));
|
|
1383
|
-
const isFromRequired = hasDefault || hasStar;
|
|
1384
|
-
if (hasStar && !hasNamespace) {
|
|
1385
|
-
if (hasDefault) this.unexpected();
|
|
1386
|
-
if (decorators) {
|
|
1387
|
-
throw this.raise(_parseError.Errors.UnsupportedDecoratorExport, {
|
|
1388
|
-
at: node
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
this.parseExportFrom(node, true);
|
|
1392
|
-
return this.finishNode(node, "ExportAllDeclaration");
|
|
1393
|
-
}
|
|
1394
|
-
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
|
1395
|
-
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) {
|
|
1396
|
-
this.unexpected(null, 5);
|
|
1397
|
-
}
|
|
1398
|
-
if (hasNamespace && parseAfterNamespace) {
|
|
1399
|
-
this.unexpected(null, 97);
|
|
1400
|
-
}
|
|
1401
|
-
let hasDeclaration;
|
|
1402
|
-
if (isFromRequired || hasSpecifiers) {
|
|
1403
|
-
hasDeclaration = false;
|
|
1404
|
-
if (decorators) {
|
|
1405
|
-
throw this.raise(_parseError.Errors.UnsupportedDecoratorExport, {
|
|
1406
|
-
at: node
|
|
1407
|
-
});
|
|
1408
|
-
}
|
|
1409
|
-
this.parseExportFrom(node, isFromRequired);
|
|
1410
|
-
} else {
|
|
1411
|
-
hasDeclaration = this.maybeParseExportDeclaration(node);
|
|
1412
|
-
}
|
|
1413
|
-
if (isFromRequired || hasSpecifiers || hasDeclaration) {
|
|
1414
|
-
var _node2$declaration;
|
|
1415
|
-
const node2 = node;
|
|
1416
|
-
this.checkExport(node2, true, false, !!node2.source);
|
|
1417
|
-
if (((_node2$declaration = node2.declaration) == null ? void 0 : _node2$declaration.type) === "ClassDeclaration") {
|
|
1418
|
-
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
1419
|
-
} else if (decorators) {
|
|
1420
|
-
throw this.raise(_parseError.Errors.UnsupportedDecoratorExport, {
|
|
1421
|
-
at: node
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
1425
|
-
}
|
|
1426
|
-
if (this.eat(65)) {
|
|
1427
|
-
const node2 = node;
|
|
1428
|
-
const decl = this.parseExportDefaultExpression();
|
|
1429
|
-
node2.declaration = decl;
|
|
1430
|
-
if (decl.type === "ClassDeclaration") {
|
|
1431
|
-
this.maybeTakeDecorators(decorators, decl, node2);
|
|
1432
|
-
} else if (decorators) {
|
|
1433
|
-
throw this.raise(_parseError.Errors.UnsupportedDecoratorExport, {
|
|
1434
|
-
at: node
|
|
1435
|
-
});
|
|
1436
|
-
}
|
|
1437
|
-
this.checkExport(node2, true, true);
|
|
1438
|
-
return this.finishNode(node2, "ExportDefaultDeclaration");
|
|
1439
|
-
}
|
|
1440
|
-
this.unexpected(null, 5);
|
|
1441
|
-
}
|
|
1442
|
-
eatExportStar(node) {
|
|
1443
|
-
return this.eat(55);
|
|
1444
|
-
}
|
|
1445
|
-
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
|
|
1446
|
-
if (maybeDefaultIdentifier || this.isExportDefaultSpecifier()) {
|
|
1447
|
-
this.expectPlugin("exportDefaultFrom", maybeDefaultIdentifier == null ? void 0 : maybeDefaultIdentifier.loc.start);
|
|
1448
|
-
const id = maybeDefaultIdentifier || this.parseIdentifier(true);
|
|
1449
|
-
const specifier = this.startNodeAtNode(id);
|
|
1450
|
-
specifier.exported = id;
|
|
1451
|
-
node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
|
|
1452
|
-
return true;
|
|
1453
|
-
}
|
|
1454
|
-
return false;
|
|
1455
|
-
}
|
|
1456
|
-
maybeParseExportNamespaceSpecifier(node) {
|
|
1457
|
-
if (this.isContextual(93)) {
|
|
1458
|
-
if (!node.specifiers) node.specifiers = [];
|
|
1459
|
-
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
1460
|
-
this.next();
|
|
1461
|
-
specifier.exported = this.parseModuleExportName();
|
|
1462
|
-
node.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier"));
|
|
1463
|
-
return true;
|
|
1464
|
-
}
|
|
1465
|
-
return false;
|
|
1466
|
-
}
|
|
1467
|
-
maybeParseExportNamedSpecifiers(node) {
|
|
1468
|
-
if (this.match(5)) {
|
|
1469
|
-
if (!node.specifiers) node.specifiers = [];
|
|
1470
|
-
const isTypeExport = node.exportKind === "type";
|
|
1471
|
-
node.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
|
|
1472
|
-
node.source = null;
|
|
1473
|
-
node.declaration = null;
|
|
1474
|
-
if (this.hasPlugin("importAssertions")) {
|
|
1475
|
-
node.assertions = [];
|
|
1476
|
-
}
|
|
1477
|
-
return true;
|
|
1478
|
-
}
|
|
1479
|
-
return false;
|
|
1480
|
-
}
|
|
1481
|
-
maybeParseExportDeclaration(node) {
|
|
1482
|
-
if (this.shouldParseExportDeclaration()) {
|
|
1483
|
-
node.specifiers = [];
|
|
1484
|
-
node.source = null;
|
|
1485
|
-
if (this.hasPlugin("importAssertions")) {
|
|
1486
|
-
node.assertions = [];
|
|
1487
|
-
}
|
|
1488
|
-
node.declaration = this.parseExportDeclaration(node);
|
|
1489
|
-
return true;
|
|
1490
|
-
}
|
|
1491
|
-
return false;
|
|
1492
|
-
}
|
|
1493
|
-
isAsyncFunction() {
|
|
1494
|
-
if (!this.isContextual(95)) return false;
|
|
1495
|
-
const next = this.nextTokenInLineStart();
|
|
1496
|
-
return this.isUnparsedContextual(next, "function");
|
|
1497
|
-
}
|
|
1498
|
-
parseExportDefaultExpression() {
|
|
1499
|
-
const expr = this.startNode();
|
|
1500
|
-
if (this.match(68)) {
|
|
1501
|
-
this.next();
|
|
1502
|
-
return this.parseFunction(expr, ParseFunctionFlag.Declaration | ParseFunctionFlag.NullableId);
|
|
1503
|
-
} else if (this.isAsyncFunction()) {
|
|
1504
|
-
this.next();
|
|
1505
|
-
this.next();
|
|
1506
|
-
return this.parseFunction(expr, ParseFunctionFlag.Declaration | ParseFunctionFlag.NullableId | ParseFunctionFlag.Async);
|
|
1507
|
-
}
|
|
1508
|
-
if (this.match(80)) {
|
|
1509
|
-
return this.parseClass(expr, true, true);
|
|
1510
|
-
}
|
|
1511
|
-
if (this.match(26)) {
|
|
1512
|
-
if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
1513
|
-
this.raise(_parseError.Errors.DecoratorBeforeExport, {
|
|
1514
|
-
at: this.state.startLoc
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
1518
|
-
}
|
|
1519
|
-
if (this.match(75) || this.match(74) || this.isLet()) {
|
|
1520
|
-
throw this.raise(_parseError.Errors.UnsupportedDefaultExport, {
|
|
1521
|
-
at: this.state.startLoc
|
|
1522
|
-
});
|
|
1523
|
-
}
|
|
1524
|
-
const res = this.parseMaybeAssignAllowIn();
|
|
1525
|
-
this.semicolon();
|
|
1526
|
-
return res;
|
|
1527
|
-
}
|
|
1528
|
-
parseExportDeclaration(node) {
|
|
1529
|
-
if (this.match(80)) {
|
|
1530
|
-
const node = this.parseClass(this.startNode(), true, false);
|
|
1531
|
-
return node;
|
|
1532
|
-
}
|
|
1533
|
-
return this.parseStatementListItem();
|
|
1534
|
-
}
|
|
1535
|
-
isExportDefaultSpecifier() {
|
|
1536
|
-
const {
|
|
1537
|
-
type
|
|
1538
|
-
} = this.state;
|
|
1539
|
-
if ((0, _types.tokenIsIdentifier)(type)) {
|
|
1540
|
-
if (type === 95 && !this.state.containsEsc || type === 99) {
|
|
1541
|
-
return false;
|
|
1542
|
-
}
|
|
1543
|
-
if ((type === 128 || type === 127) && !this.state.containsEsc) {
|
|
1544
|
-
const {
|
|
1545
|
-
type: nextType
|
|
1546
|
-
} = this.lookahead();
|
|
1547
|
-
if ((0, _types.tokenIsIdentifier)(nextType) && nextType !== 97 || nextType === 5) {
|
|
1548
|
-
this.expectOnePlugin(["flow", "typescript"]);
|
|
1549
|
-
return false;
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
} else if (!this.match(65)) {
|
|
1553
|
-
return false;
|
|
1554
|
-
}
|
|
1555
|
-
const next = this.nextTokenStart();
|
|
1556
|
-
const hasFrom = this.isUnparsedContextual(next, "from");
|
|
1557
|
-
if (this.input.charCodeAt(next) === 44 || (0, _types.tokenIsIdentifier)(this.state.type) && hasFrom) {
|
|
1558
|
-
return true;
|
|
1559
|
-
}
|
|
1560
|
-
if (this.match(65) && hasFrom) {
|
|
1561
|
-
const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
|
|
1562
|
-
return nextAfterFrom === 34 || nextAfterFrom === 39;
|
|
1563
|
-
}
|
|
1564
|
-
return false;
|
|
1565
|
-
}
|
|
1566
|
-
parseExportFrom(node, expect) {
|
|
1567
|
-
if (this.eatContextual(97)) {
|
|
1568
|
-
node.source = this.parseImportSource();
|
|
1569
|
-
this.checkExport(node);
|
|
1570
|
-
this.maybeParseImportAttributes(node);
|
|
1571
|
-
this.checkJSONModuleImport(node);
|
|
1572
|
-
} else if (expect) {
|
|
1573
|
-
this.unexpected();
|
|
1574
|
-
}
|
|
1575
|
-
this.semicolon();
|
|
1576
|
-
}
|
|
1577
|
-
shouldParseExportDeclaration() {
|
|
1578
|
-
const {
|
|
1579
|
-
type
|
|
1580
|
-
} = this.state;
|
|
1581
|
-
if (type === 26) {
|
|
1582
|
-
this.expectOnePlugin(["decorators", "decorators-legacy"]);
|
|
1583
|
-
if (this.hasPlugin("decorators")) {
|
|
1584
|
-
if (this.getPluginOption("decorators", "decoratorsBeforeExport") === true) {
|
|
1585
|
-
this.raise(_parseError.Errors.DecoratorBeforeExport, {
|
|
1586
|
-
at: this.state.startLoc
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
|
-
return true;
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
|
|
1593
|
-
}
|
|
1594
|
-
checkExport(node, checkNames, isDefault, isFrom) {
|
|
1595
|
-
if (checkNames) {
|
|
1596
|
-
var _node$specifiers;
|
|
1597
|
-
if (isDefault) {
|
|
1598
|
-
this.checkDuplicateExports(node, "default");
|
|
1599
|
-
if (this.hasPlugin("exportDefaultFrom")) {
|
|
1600
|
-
var _declaration$extra;
|
|
1601
|
-
const declaration = node.declaration;
|
|
1602
|
-
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) != null && _declaration$extra.parenthesized)) {
|
|
1603
|
-
this.raise(_parseError.Errors.ExportDefaultFromAsIdentifier, {
|
|
1604
|
-
at: declaration
|
|
1605
|
-
});
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
} else if ((_node$specifiers = node.specifiers) != null && _node$specifiers.length) {
|
|
1609
|
-
for (const specifier of node.specifiers) {
|
|
1610
|
-
const {
|
|
1611
|
-
exported
|
|
1612
|
-
} = specifier;
|
|
1613
|
-
const exportName = exported.type === "Identifier" ? exported.name : exported.value;
|
|
1614
|
-
this.checkDuplicateExports(specifier, exportName);
|
|
1615
|
-
if (!isFrom && specifier.local) {
|
|
1616
|
-
const {
|
|
1617
|
-
local
|
|
1618
|
-
} = specifier;
|
|
1619
|
-
if (local.type !== "Identifier") {
|
|
1620
|
-
this.raise(_parseError.Errors.ExportBindingIsString, {
|
|
1621
|
-
at: specifier,
|
|
1622
|
-
localName: local.value,
|
|
1623
|
-
exportName
|
|
1624
|
-
});
|
|
1625
|
-
} else {
|
|
1626
|
-
this.checkReservedWord(local.name, local.loc.start, true, false);
|
|
1627
|
-
this.scope.checkLocalExport(local);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
} else if (node.declaration) {
|
|
1632
|
-
if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
|
|
1633
|
-
const id = node.declaration.id;
|
|
1634
|
-
if (!id) throw new Error("Assertion failure");
|
|
1635
|
-
this.checkDuplicateExports(node, id.name);
|
|
1636
|
-
} else if (node.declaration.type === "VariableDeclaration") {
|
|
1637
|
-
for (const declaration of node.declaration.declarations) {
|
|
1638
|
-
this.checkDeclaration(declaration.id);
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
checkDeclaration(node) {
|
|
1645
|
-
if (node.type === "Identifier") {
|
|
1646
|
-
this.checkDuplicateExports(node, node.name);
|
|
1647
|
-
} else if (node.type === "ObjectPattern") {
|
|
1648
|
-
for (const prop of node.properties) {
|
|
1649
|
-
this.checkDeclaration(prop);
|
|
1650
|
-
}
|
|
1651
|
-
} else if (node.type === "ArrayPattern") {
|
|
1652
|
-
for (const elem of node.elements) {
|
|
1653
|
-
if (elem) {
|
|
1654
|
-
this.checkDeclaration(elem);
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
} else if (node.type === "ObjectProperty") {
|
|
1658
|
-
this.checkDeclaration(node.value);
|
|
1659
|
-
} else if (node.type === "RestElement") {
|
|
1660
|
-
this.checkDeclaration(node.argument);
|
|
1661
|
-
} else if (node.type === "AssignmentPattern") {
|
|
1662
|
-
this.checkDeclaration(node.left);
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
checkDuplicateExports(node, exportName) {
|
|
1666
|
-
if (this.exportedIdentifiers.has(exportName)) {
|
|
1667
|
-
if (exportName === "default") {
|
|
1668
|
-
this.raise(_parseError.Errors.DuplicateDefaultExport, {
|
|
1669
|
-
at: node
|
|
1670
|
-
});
|
|
1671
|
-
} else {
|
|
1672
|
-
this.raise(_parseError.Errors.DuplicateExport, {
|
|
1673
|
-
at: node,
|
|
1674
|
-
exportName
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
this.exportedIdentifiers.add(exportName);
|
|
1679
|
-
}
|
|
1680
|
-
parseExportSpecifiers(isInTypeExport) {
|
|
1681
|
-
const nodes = [];
|
|
1682
|
-
let first = true;
|
|
1683
|
-
this.expect(5);
|
|
1684
|
-
while (!this.eat(8)) {
|
|
1685
|
-
if (first) {
|
|
1686
|
-
first = false;
|
|
1687
|
-
} else {
|
|
1688
|
-
this.expect(12);
|
|
1689
|
-
if (this.eat(8)) break;
|
|
1690
|
-
}
|
|
1691
|
-
const isMaybeTypeOnly = this.isContextual(128);
|
|
1692
|
-
const isString = this.match(131);
|
|
1693
|
-
const node = this.startNode();
|
|
1694
|
-
node.local = this.parseModuleExportName();
|
|
1695
|
-
nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
|
|
1696
|
-
}
|
|
1697
|
-
return nodes;
|
|
1698
|
-
}
|
|
1699
|
-
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
1700
|
-
if (this.eatContextual(93)) {
|
|
1701
|
-
node.exported = this.parseModuleExportName();
|
|
1702
|
-
} else if (isString) {
|
|
1703
|
-
node.exported = (0, _node.cloneStringLiteral)(node.local);
|
|
1704
|
-
} else if (!node.exported) {
|
|
1705
|
-
node.exported = (0, _node.cloneIdentifier)(node.local);
|
|
1706
|
-
}
|
|
1707
|
-
return this.finishNode(node, "ExportSpecifier");
|
|
1708
|
-
}
|
|
1709
|
-
parseModuleExportName() {
|
|
1710
|
-
if (this.match(131)) {
|
|
1711
|
-
const result = this.parseStringLiteral(this.state.value);
|
|
1712
|
-
const surrogate = result.value.match(loneSurrogate);
|
|
1713
|
-
if (surrogate) {
|
|
1714
|
-
this.raise(_parseError.Errors.ModuleExportNameHasLoneSurrogate, {
|
|
1715
|
-
at: result,
|
|
1716
|
-
surrogateCharCode: surrogate[0].charCodeAt(0)
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
return result;
|
|
1720
|
-
}
|
|
1721
|
-
return this.parseIdentifier(true);
|
|
1722
|
-
}
|
|
1723
|
-
isJSONModuleImport(node) {
|
|
1724
|
-
if (node.assertions != null) {
|
|
1725
|
-
return node.assertions.some(({
|
|
1726
|
-
key,
|
|
1727
|
-
value
|
|
1728
|
-
}) => {
|
|
1729
|
-
return value.value === "json" && (key.type === "Identifier" ? key.name === "type" : key.value === "type");
|
|
1730
|
-
});
|
|
1731
|
-
}
|
|
1732
|
-
return false;
|
|
1733
|
-
}
|
|
1734
|
-
checkImportReflection(node) {
|
|
1735
|
-
if (node.module) {
|
|
1736
|
-
var _node$assertions;
|
|
1737
|
-
if (node.specifiers.length !== 1 || node.specifiers[0].type !== "ImportDefaultSpecifier") {
|
|
1738
|
-
this.raise(_parseError.Errors.ImportReflectionNotBinding, {
|
|
1739
|
-
at: node.specifiers[0].loc.start
|
|
1740
|
-
});
|
|
1741
|
-
}
|
|
1742
|
-
if (((_node$assertions = node.assertions) == null ? void 0 : _node$assertions.length) > 0) {
|
|
1743
|
-
this.raise(_parseError.Errors.ImportReflectionHasAssertion, {
|
|
1744
|
-
at: node.specifiers[0].loc.start
|
|
1745
|
-
});
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
checkJSONModuleImport(node) {
|
|
1750
|
-
if (this.isJSONModuleImport(node) && node.type !== "ExportAllDeclaration") {
|
|
1751
|
-
const {
|
|
1752
|
-
specifiers
|
|
1753
|
-
} = node;
|
|
1754
|
-
if (specifiers != null) {
|
|
1755
|
-
const nonDefaultNamedSpecifier = specifiers.find(specifier => {
|
|
1756
|
-
let imported;
|
|
1757
|
-
if (specifier.type === "ExportSpecifier") {
|
|
1758
|
-
imported = specifier.local;
|
|
1759
|
-
} else if (specifier.type === "ImportSpecifier") {
|
|
1760
|
-
imported = specifier.imported;
|
|
1761
|
-
}
|
|
1762
|
-
if (imported !== undefined) {
|
|
1763
|
-
return imported.type === "Identifier" ? imported.name !== "default" : imported.value !== "default";
|
|
1764
|
-
}
|
|
1765
|
-
});
|
|
1766
|
-
if (nonDefaultNamedSpecifier !== undefined) {
|
|
1767
|
-
this.raise(_parseError.Errors.ImportJSONBindingNotDefault, {
|
|
1768
|
-
at: nonDefaultNamedSpecifier.loc.start
|
|
1769
|
-
});
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
isPotentialImportPhase(isExport) {
|
|
1775
|
-
return !isExport && this.isContextual(125);
|
|
1776
|
-
}
|
|
1777
|
-
applyImportPhase(node, isExport, phase, loc) {
|
|
1778
|
-
if (isExport) {
|
|
1779
|
-
;
|
|
1780
|
-
return;
|
|
1781
|
-
}
|
|
1782
|
-
if (phase === "module") {
|
|
1783
|
-
this.expectPlugin("importReflection", loc);
|
|
1784
|
-
node.module = true;
|
|
1785
|
-
} else if (this.hasPlugin("importReflection")) {
|
|
1786
|
-
node.module = false;
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
parseMaybeImportPhase(node, isExport) {
|
|
1790
|
-
if (!this.isPotentialImportPhase(isExport)) {
|
|
1791
|
-
this.applyImportPhase(node, isExport, null);
|
|
1792
|
-
return null;
|
|
1793
|
-
}
|
|
1794
|
-
const phaseIdentifier = this.parseIdentifier(true);
|
|
1795
|
-
const {
|
|
1796
|
-
type
|
|
1797
|
-
} = this.state;
|
|
1798
|
-
const isImportPhase = (0, _types.tokenIsKeywordOrIdentifier)(type) ? type !== 97 || this.lookaheadCharCode() === 102 : type !== 12;
|
|
1799
|
-
if (isImportPhase) {
|
|
1800
|
-
this.resetPreviousIdentifierLeadingComments(phaseIdentifier);
|
|
1801
|
-
this.applyImportPhase(node, isExport, phaseIdentifier.name, phaseIdentifier.loc.start);
|
|
1802
|
-
return null;
|
|
1803
|
-
} else {
|
|
1804
|
-
this.applyImportPhase(node, isExport, null);
|
|
1805
|
-
return phaseIdentifier;
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
isPrecedingIdImportPhase(phase) {
|
|
1809
|
-
const {
|
|
1810
|
-
type
|
|
1811
|
-
} = this.state;
|
|
1812
|
-
return (0, _types.tokenIsIdentifier)(type) ? type !== 97 || this.lookaheadCharCode() === 102 : type !== 12;
|
|
1813
|
-
}
|
|
1814
|
-
parseImport(node) {
|
|
1815
|
-
if (this.match(131)) {
|
|
1816
|
-
return this.parseImportSourceAndAttributes(node);
|
|
1817
|
-
}
|
|
1818
|
-
return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
|
|
1819
|
-
}
|
|
1820
|
-
parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier) {
|
|
1821
|
-
node.specifiers = [];
|
|
1822
|
-
const hasDefault = this.maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier);
|
|
1823
|
-
const parseNext = !hasDefault || this.eat(12);
|
|
1824
|
-
const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
|
|
1825
|
-
if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
|
|
1826
|
-
this.expectContextual(97);
|
|
1827
|
-
return this.parseImportSourceAndAttributes(node);
|
|
1828
|
-
}
|
|
1829
|
-
parseImportSourceAndAttributes(node) {
|
|
1830
|
-
var _node$specifiers2;
|
|
1831
|
-
(_node$specifiers2 = node.specifiers) != null ? _node$specifiers2 : node.specifiers = [];
|
|
1832
|
-
node.source = this.parseImportSource();
|
|
1833
|
-
this.maybeParseImportAttributes(node);
|
|
1834
|
-
this.checkImportReflection(node);
|
|
1835
|
-
this.checkJSONModuleImport(node);
|
|
1836
|
-
this.semicolon();
|
|
1837
|
-
return this.finishNode(node, "ImportDeclaration");
|
|
1838
|
-
}
|
|
1839
|
-
parseImportSource() {
|
|
1840
|
-
if (!this.match(131)) this.unexpected();
|
|
1841
|
-
return this.parseExprAtom();
|
|
1842
|
-
}
|
|
1843
|
-
parseImportSpecifierLocal(node, specifier, type) {
|
|
1844
|
-
specifier.local = this.parseIdentifier();
|
|
1845
|
-
node.specifiers.push(this.finishImportSpecifier(specifier, type));
|
|
1846
|
-
}
|
|
1847
|
-
finishImportSpecifier(specifier, type, bindingType = _scopeflags.BindingFlag.TYPE_LEXICAL) {
|
|
1848
|
-
this.checkLVal(specifier.local, {
|
|
1849
|
-
in: {
|
|
1850
|
-
type
|
|
1851
|
-
},
|
|
1852
|
-
binding: bindingType
|
|
1853
|
-
});
|
|
1854
|
-
return this.finishNode(specifier, type);
|
|
1855
|
-
}
|
|
1856
|
-
parseImportAttributes() {
|
|
1857
|
-
this.expect(5);
|
|
1858
|
-
const attrs = [];
|
|
1859
|
-
const attrNames = new Set();
|
|
1860
|
-
do {
|
|
1861
|
-
if (this.match(8)) {
|
|
1862
|
-
break;
|
|
1863
|
-
}
|
|
1864
|
-
const node = this.startNode();
|
|
1865
|
-
const keyName = this.state.value;
|
|
1866
|
-
if (attrNames.has(keyName)) {
|
|
1867
|
-
this.raise(_parseError.Errors.ModuleAttributesWithDuplicateKeys, {
|
|
1868
|
-
at: this.state.startLoc,
|
|
1869
|
-
key: keyName
|
|
1870
|
-
});
|
|
1871
|
-
}
|
|
1872
|
-
attrNames.add(keyName);
|
|
1873
|
-
if (this.match(131)) {
|
|
1874
|
-
node.key = this.parseStringLiteral(keyName);
|
|
1875
|
-
} else {
|
|
1876
|
-
node.key = this.parseIdentifier(true);
|
|
1877
|
-
}
|
|
1878
|
-
this.expect(14);
|
|
1879
|
-
if (!this.match(131)) {
|
|
1880
|
-
throw this.raise(_parseError.Errors.ModuleAttributeInvalidValue, {
|
|
1881
|
-
at: this.state.startLoc
|
|
1882
|
-
});
|
|
1883
|
-
}
|
|
1884
|
-
node.value = this.parseStringLiteral(this.state.value);
|
|
1885
|
-
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
1886
|
-
} while (this.eat(12));
|
|
1887
|
-
this.expect(8);
|
|
1888
|
-
return attrs;
|
|
1889
|
-
}
|
|
1890
|
-
parseModuleAttributes() {
|
|
1891
|
-
const attrs = [];
|
|
1892
|
-
const attributes = new Set();
|
|
1893
|
-
do {
|
|
1894
|
-
const node = this.startNode();
|
|
1895
|
-
node.key = this.parseIdentifier(true);
|
|
1896
|
-
if (node.key.name !== "type") {
|
|
1897
|
-
this.raise(_parseError.Errors.ModuleAttributeDifferentFromType, {
|
|
1898
|
-
at: node.key
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1901
|
-
if (attributes.has(node.key.name)) {
|
|
1902
|
-
this.raise(_parseError.Errors.ModuleAttributesWithDuplicateKeys, {
|
|
1903
|
-
at: node.key,
|
|
1904
|
-
key: node.key.name
|
|
1905
|
-
});
|
|
1906
|
-
}
|
|
1907
|
-
attributes.add(node.key.name);
|
|
1908
|
-
this.expect(14);
|
|
1909
|
-
if (!this.match(131)) {
|
|
1910
|
-
throw this.raise(_parseError.Errors.ModuleAttributeInvalidValue, {
|
|
1911
|
-
at: this.state.startLoc
|
|
1912
|
-
});
|
|
1913
|
-
}
|
|
1914
|
-
node.value = this.parseStringLiteral(this.state.value);
|
|
1915
|
-
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
1916
|
-
} while (this.eat(12));
|
|
1917
|
-
return attrs;
|
|
1918
|
-
}
|
|
1919
|
-
maybeParseImportAttributes(node) {
|
|
1920
|
-
let attributes;
|
|
1921
|
-
let useWith = false;
|
|
1922
|
-
if (this.match(76)) {
|
|
1923
|
-
if (this.hasPrecedingLineBreak() && this.lookaheadCharCode() === 40) {
|
|
1924
|
-
return;
|
|
1925
|
-
}
|
|
1926
|
-
this.next();
|
|
1927
|
-
{
|
|
1928
|
-
if (this.hasPlugin("moduleAttributes")) {
|
|
1929
|
-
attributes = this.parseModuleAttributes();
|
|
1930
|
-
} else {
|
|
1931
|
-
this.expectImportAttributesPlugin();
|
|
1932
|
-
attributes = this.parseImportAttributes();
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
useWith = true;
|
|
1936
|
-
} else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
|
|
1937
|
-
if (this.hasPlugin("importAttributes")) {
|
|
1938
|
-
if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
|
|
1939
|
-
this.raise(_parseError.Errors.ImportAttributesUseAssert, {
|
|
1940
|
-
at: this.state.startLoc
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
|
-
this.addExtra(node, "deprecatedAssertSyntax", true);
|
|
1944
|
-
} else {
|
|
1945
|
-
this.expectOnePlugin(["importAttributes", "importAssertions"]);
|
|
1946
|
-
}
|
|
1947
|
-
this.next();
|
|
1948
|
-
attributes = this.parseImportAttributes();
|
|
1949
|
-
} else if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
|
|
1950
|
-
attributes = [];
|
|
1951
|
-
} else {
|
|
1952
|
-
if (this.hasPlugin("moduleAttributes")) {
|
|
1953
|
-
attributes = [];
|
|
1954
|
-
} else return;
|
|
1955
|
-
}
|
|
1956
|
-
if (!useWith && this.hasPlugin("importAssertions")) {
|
|
1957
|
-
node.assertions = attributes;
|
|
1958
|
-
} else {
|
|
1959
|
-
node.attributes = attributes;
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier) {
|
|
1963
|
-
if (maybeDefaultIdentifier) {
|
|
1964
|
-
const specifier = this.startNodeAtNode(maybeDefaultIdentifier);
|
|
1965
|
-
specifier.local = maybeDefaultIdentifier;
|
|
1966
|
-
node.specifiers.push(this.finishImportSpecifier(specifier, "ImportDefaultSpecifier"));
|
|
1967
|
-
return true;
|
|
1968
|
-
} else if ((0, _types.tokenIsKeywordOrIdentifier)(this.state.type)) {
|
|
1969
|
-
this.parseImportSpecifierLocal(node, this.startNode(), "ImportDefaultSpecifier");
|
|
1970
|
-
return true;
|
|
1971
|
-
}
|
|
1972
|
-
return false;
|
|
1973
|
-
}
|
|
1974
|
-
maybeParseStarImportSpecifier(node) {
|
|
1975
|
-
if (this.match(55)) {
|
|
1976
|
-
const specifier = this.startNode();
|
|
1977
|
-
this.next();
|
|
1978
|
-
this.expectContextual(93);
|
|
1979
|
-
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier");
|
|
1980
|
-
return true;
|
|
1981
|
-
}
|
|
1982
|
-
return false;
|
|
1983
|
-
}
|
|
1984
|
-
parseNamedImportSpecifiers(node) {
|
|
1985
|
-
let first = true;
|
|
1986
|
-
this.expect(5);
|
|
1987
|
-
while (!this.eat(8)) {
|
|
1988
|
-
if (first) {
|
|
1989
|
-
first = false;
|
|
1990
|
-
} else {
|
|
1991
|
-
if (this.eat(14)) {
|
|
1992
|
-
throw this.raise(_parseError.Errors.DestructureNamedImport, {
|
|
1993
|
-
at: this.state.startLoc
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
this.expect(12);
|
|
1997
|
-
if (this.eat(8)) break;
|
|
1998
|
-
}
|
|
1999
|
-
const specifier = this.startNode();
|
|
2000
|
-
const importedIsString = this.match(131);
|
|
2001
|
-
const isMaybeTypeOnly = this.isContextual(128);
|
|
2002
|
-
specifier.imported = this.parseModuleExportName();
|
|
2003
|
-
const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, undefined);
|
|
2004
|
-
node.specifiers.push(importSpecifier);
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
2008
|
-
if (this.eatContextual(93)) {
|
|
2009
|
-
specifier.local = this.parseIdentifier();
|
|
2010
|
-
} else {
|
|
2011
|
-
const {
|
|
2012
|
-
imported
|
|
2013
|
-
} = specifier;
|
|
2014
|
-
if (importedIsString) {
|
|
2015
|
-
throw this.raise(_parseError.Errors.ImportBindingIsString, {
|
|
2016
|
-
at: specifier,
|
|
2017
|
-
importName: imported.value
|
|
2018
|
-
});
|
|
2019
|
-
}
|
|
2020
|
-
this.checkReservedWord(imported.name, specifier.loc.start, true, true);
|
|
2021
|
-
if (!specifier.local) {
|
|
2022
|
-
specifier.local = (0, _node.cloneIdentifier)(imported);
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
return this.finishImportSpecifier(specifier, "ImportSpecifier", bindingType);
|
|
2026
|
-
}
|
|
2027
|
-
isThisParam(param) {
|
|
2028
|
-
return param.type === "Identifier" && param.name === "this";
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
exports.default = StatementParser;
|
|
2032
|
-
|
|
2033
|
-
//# sourceMappingURL=statement.js.map
|