chrome-devtools-frontend 1.0.944427 → 1.0.945677
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/config/gni/devtools_grd_files.gni +4 -0
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
- package/front_end/core/common/ParsedURL.ts +1 -1
- package/front_end/core/host/UserMetrics.ts +3 -1
- package/front_end/core/i18n/i18nImpl.ts +7 -4
- package/front_end/core/i18n/locales/en-US.json +3 -60
- package/front_end/core/i18n/locales/en-XL.json +15 -72
- package/front_end/core/protocol_client/NodeURL.ts +1 -0
- package/front_end/core/sdk/CSSMetadata.ts +0 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +2 -3
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +2 -3
- package/front_end/core/sdk/Cookie.ts +17 -0
- package/front_end/core/sdk/CookieModel.ts +1 -0
- package/front_end/core/sdk/DebuggerModel.ts +5 -4
- package/front_end/core/sdk/NetworkManager.ts +4 -1
- package/front_end/core/sdk/NetworkRequest.ts +2 -2
- package/front_end/core/sdk/Resource.ts +2 -2
- package/front_end/core/sdk/Script.ts +2 -3
- package/front_end/entrypoints/main/MainImpl.ts +6 -0
- package/front_end/generated/protocol.d.ts +0 -4
- package/front_end/models/bindings/BreakpointManager.ts +3 -4
- package/front_end/models/bindings/ResourceMapping.ts +1 -2
- package/front_end/models/bindings/StylesSourceMapping.ts +1 -2
- package/front_end/models/emulation/EmulatedDevices.ts +2 -4
- package/front_end/models/persistence/IsolatedFileSystem.ts +7 -6
- package/front_end/models/persistence/PersistenceActions.ts +4 -1
- package/front_end/models/persistence/PlatformFileSystem.ts +3 -4
- package/front_end/models/text_utils/ContentProvider.ts +1 -2
- package/front_end/models/text_utils/StaticContentProvider.ts +2 -3
- package/front_end/models/timeline_model/TimelineJSProfile.ts +16 -3
- package/front_end/models/timeline_model/TimelineModel.ts +1 -0
- package/front_end/models/workspace/UISourceCode.ts +2 -2
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -6
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/animation/animationTimeline.css +2 -0
- package/front_end/panels/application/BackForwardCacheStrings.ts +15 -75
- package/front_end/panels/application/BackForwardCacheView.ts +8 -1
- package/front_end/panels/application/ReportingApiView.ts +15 -1
- package/front_end/panels/application/components/EndpointsGrid.ts +63 -4
- package/front_end/panels/application/components/FrameDetailsView.ts +21 -34
- package/front_end/panels/changes/ChangesView.ts +8 -7
- package/front_end/panels/elements/StyleEditorWidget.ts +7 -7
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -15
- package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
- package/front_end/panels/emulation/DeviceModeView.ts +3 -0
- package/front_end/panels/help/ReleaseNoteText.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +7 -1
- package/front_end/panels/profiler/heapProfiler.css +2 -5
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
- package/front_end/panels/sources/NavigatorView.ts +1 -1
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
- package/front_end/panels/timeline/TimelineController.ts +3 -0
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -34
- package/front_end/panels/timeline/TimelineUIUtils.ts +51 -3
- package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
- package/front_end/services/window_bounds/WindowBoundsService.ts +27 -0
- package/front_end/services/window_bounds/window_bounds.ts +9 -0
- package/front_end/third_party/acorn/README.chromium +2 -2
- package/front_end/third_party/acorn/acorn.ts +1 -1
- package/front_end/third_party/acorn/package/CHANGELOG.md +31 -1
- package/front_end/third_party/acorn/package/README.md +1 -1
- package/front_end/third_party/acorn/package/dist/acorn.d.ts +3 -0
- package/front_end/third_party/acorn/package/dist/acorn.js +772 -708
- package/front_end/third_party/acorn/package/dist/acorn.mjs +767 -703
- package/front_end/third_party/acorn/package/dist/bin.js +47 -21
- package/front_end/third_party/acorn/package/package.json +1 -1
- package/front_end/third_party/acorn-loose/README.chromium +2 -2
- package/front_end/third_party/acorn-loose/package/CHANGELOG.md +12 -0
- package/front_end/third_party/acorn-loose/package/dist/acorn-loose.js +27 -7
- package/front_end/third_party/acorn-loose/package/dist/acorn-loose.mjs +28 -8
- package/front_end/third_party/acorn-loose/package/package.json +2 -2
- package/front_end/third_party/codemirror.next/bundle.ts +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +8 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +1 -1
- package/front_end/third_party/i18n/i18n-impl.ts +1 -1
- package/front_end/third_party/lit-html/README.chromium +2 -2
- package/front_end/third_party/lit-html/package/CHANGELOG.md +216 -28
- package/front_end/third_party/lit-html/package/LICENSE +9 -9
- package/front_end/third_party/lit-html/package/README.md +12 -162
- package/front_end/third_party/lit-html/package/async-directive.d.ts +23 -54
- package/front_end/third_party/lit-html/package/async-directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/async-directive.js +2 -7
- package/front_end/third_party/lit-html/package/async-directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/async-directive.d.ts +23 -54
- package/front_end/third_party/lit-html/package/development/async-directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/async-directive.js +44 -194
- package/front_end/third_party/lit-html/package/development/async-directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts +6 -5
- package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive-helpers.js +25 -9
- package/front_end/third_party/lit-html/package/development/directive-helpers.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive.d.ts +3 -16
- package/front_end/third_party/lit-html/package/development/directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive.js +6 -1
- package/front_end/third_party/lit-html/package/development/directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts +7 -14
- package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-append.js +17 -58
- package/front_end/third_party/lit-html/package/development/directives/async-append.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts +9 -14
- package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-replace.js +57 -37
- package/front_end/third_party/lit-html/package/development/directives/async-replace.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/cache.d.ts +2 -3
- package/front_end/third_party/lit-html/package/development/directives/cache.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/cache.js +4 -6
- package/front_end/third_party/lit-html/package/development/directives/cache.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts +2 -2
- package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/class-map.js +17 -7
- package/front_end/third_party/lit-html/package/development/directives/class-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/guard.d.ts +3 -2
- package/front_end/third_party/lit-html/package/development/directives/guard.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/guard.js +3 -2
- package/front_end/third_party/lit-html/package/development/directives/guard.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/live.d.ts +4 -3
- package/front_end/third_party/lit-html/package/development/directives/live.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/live.js +5 -7
- package/front_end/third_party/lit-html/package/development/directives/live.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts +58 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts.map +1 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js +85 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js.map +1 -0
- package/front_end/third_party/lit-html/package/development/directives/ref.d.ts +14 -11
- package/front_end/third_party/lit-html/package/development/directives/ref.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/ref.js +13 -11
- package/front_end/third_party/lit-html/package/development/directives/ref.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts +8 -4
- package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/repeat.js +23 -9
- package/front_end/third_party/lit-html/package/development/directives/repeat.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts +1 -2
- package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/style-map.js +1 -2
- package/front_end/third_party/lit-html/package/development/directives/style-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/template-content.d.ts +1 -2
- package/front_end/third_party/lit-html/package/development/directives/template-content.js +1 -2
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts +6 -4
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js +7 -5
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts +4 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js +3 -0
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/until.d.ts +12 -8
- package/front_end/third_party/lit-html/package/development/directives/until.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/until.js +63 -23
- package/front_end/third_party/lit-html/package/development/directives/until.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.js +9 -8
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/lit-html.d.ts +81 -136
- package/front_end/third_party/lit-html/package/development/lit-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/lit-html.js +249 -76
- package/front_end/third_party/lit-html/package/development/lit-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts +1 -41
- package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/polyfill-support.js +40 -21
- package/front_end/third_party/lit-html/package/development/polyfill-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts +12 -10
- package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/private-ssr-support.js +11 -3
- package/front_end/third_party/lit-html/package/development/private-ssr-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/static.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/static.js +6 -5
- package/front_end/third_party/lit-html/package/development/static.js.map +1 -1
- package/front_end/third_party/lit-html/package/directive-helpers.d.ts +6 -5
- package/front_end/third_party/lit-html/package/directive-helpers.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directive-helpers.js +2 -2
- package/front_end/third_party/lit-html/package/directive-helpers.js.map +1 -1
- package/front_end/third_party/lit-html/package/directive.d.ts +3 -16
- package/front_end/third_party/lit-html/package/directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directive.js +1 -1
- package/front_end/third_party/lit-html/package/directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-append.d.ts +7 -14
- package/front_end/third_party/lit-html/package/directives/async-append.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-append.js +2 -6
- package/front_end/third_party/lit-html/package/directives/async-append.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-replace.d.ts +9 -14
- package/front_end/third_party/lit-html/package/directives/async-replace.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-replace.js +2 -5
- package/front_end/third_party/lit-html/package/directives/async-replace.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/cache.d.ts +2 -3
- package/front_end/third_party/lit-html/package/directives/cache.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/cache.js +2 -5
- package/front_end/third_party/lit-html/package/directives/cache.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/class-map.d.ts +2 -2
- package/front_end/third_party/lit-html/package/directives/class-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/class-map.js +2 -4
- package/front_end/third_party/lit-html/package/directives/class-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/guard.d.ts +3 -2
- package/front_end/third_party/lit-html/package/directives/guard.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/guard.js +2 -4
- package/front_end/third_party/lit-html/package/directives/guard.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/live.d.ts +4 -3
- package/front_end/third_party/lit-html/package/directives/live.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/live.js +1 -4
- package/front_end/third_party/lit-html/package/directives/live.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts +58 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts.map +1 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.js +7 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.js.map +1 -0
- package/front_end/third_party/lit-html/package/directives/ref.d.ts +14 -11
- package/front_end/third_party/lit-html/package/directives/ref.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/ref.js +2 -5
- package/front_end/third_party/lit-html/package/directives/ref.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/repeat.d.ts +8 -4
- package/front_end/third_party/lit-html/package/directives/repeat.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/repeat.js +2 -5
- package/front_end/third_party/lit-html/package/directives/repeat.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/style-map.d.ts +1 -2
- package/front_end/third_party/lit-html/package/directives/style-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/style-map.js +2 -4
- package/front_end/third_party/lit-html/package/directives/style-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/template-content.d.ts +1 -2
- package/front_end/third_party/lit-html/package/directives/template-content.js +2 -4
- package/front_end/third_party/lit-html/package/directives/template-content.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts +6 -4
- package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-html.js +2 -4
- package/front_end/third_party/lit-html/package/directives/unsafe-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts +4 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/until.d.ts +12 -8
- package/front_end/third_party/lit-html/package/directives/until.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/until.js +2 -6
- package/front_end/third_party/lit-html/package/directives/until.js.map +1 -1
- package/front_end/third_party/lit-html/package/experimental-hydrate.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/experimental-hydrate.js +2 -5
- package/front_end/third_party/lit-html/package/experimental-hydrate.js.map +1 -1
- package/front_end/third_party/lit-html/package/lit-html.d.ts +81 -136
- package/front_end/third_party/lit-html/package/lit-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/lit-html.js +1 -1
- package/front_end/third_party/lit-html/package/lit-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/package.json +75 -24
- package/front_end/third_party/lit-html/package/polyfill-support.d.ts +1 -41
- package/front_end/third_party/lit-html/package/polyfill-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/polyfill-support.js +1 -1
- package/front_end/third_party/lit-html/package/polyfill-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/private-ssr-support.d.ts +12 -10
- package/front_end/third_party/lit-html/package/private-ssr-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/private-ssr-support.js +2 -2
- package/front_end/third_party/lit-html/package/private-ssr-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/static.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/static.js +1 -1
- package/front_end/third_party/lit-html/package/static.js.map +1 -1
- package/front_end/third_party/marked/README.chromium +2 -2
- package/front_end/third_party/marked/marked.ts +2 -2
- package/front_end/third_party/marked/package/README.md +7 -1
- package/front_end/third_party/marked/package/bin/marked.js +214 -0
- package/front_end/third_party/marked/package/lib/marked.cjs +2907 -0
- package/front_end/third_party/marked/package/lib/marked.esm.d.ts +1 -3
- package/front_end/third_party/marked/package/lib/marked.esm.js +627 -586
- package/front_end/third_party/marked/package/lib/marked.umd.js +2913 -0
- package/front_end/third_party/marked/package/man/marked.1 +5 -24
- package/front_end/third_party/marked/package/man/marked.1.txt +21 -31
- package/front_end/third_party/marked/package/marked.min.js +1 -1
- package/front_end/third_party/marked/package/package.json +41 -32
- package/front_end/third_party/marked/package/src/Lexer.js +109 -108
- package/front_end/third_party/marked/package/src/Parser.js +38 -15
- package/front_end/third_party/marked/package/src/Renderer.js +5 -5
- package/front_end/third_party/marked/package/src/Slugger.js +2 -2
- package/front_end/third_party/marked/package/src/TextRenderer.js +2 -2
- package/front_end/third_party/marked/package/src/Tokenizer.js +215 -190
- package/front_end/third_party/marked/package/src/defaults.js +6 -9
- package/front_end/third_party/marked/package/src/helpers.js +16 -27
- package/front_end/third_party/marked/package/src/marked.js +146 -63
- package/front_end/third_party/marked/package/src/rules.js +20 -45
- package/front_end/third_party/wasmparser/README.chromium +2 -2
- package/front_end/third_party/wasmparser/package/.github/workflows/main.yml +47 -0
- package/front_end/third_party/wasmparser/package/CHANGELOG.md +12 -0
- package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js +53 -53
- package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js.map +1 -1
- package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js +53 -53
- package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js.map +1 -1
- package/front_end/third_party/wasmparser/package/package.json +1 -1
- package/front_end/third_party/wasmparser/package/src/WasmParser.ts +53 -53
- package/front_end/ui/components/adorners/Adorner.ts +14 -14
- package/front_end/ui/components/buttons/Button.ts +133 -42
- package/front_end/ui/components/buttons/button.css +31 -0
- package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
- package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
- package/front_end/ui/components/diff_view/DiffView.ts +4 -4
- package/front_end/ui/components/docs/button/basic.html +3 -0
- package/front_end/ui/components/docs/button/basic.ts +58 -0
- package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
- package/front_end/ui/components/icon_button/Icon.ts +24 -21
- package/front_end/ui/components/icon_button/IconButton.ts +31 -31
- package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +25 -25
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
- package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
- package/front_end/ui/components/report_view/ReportView.ts +18 -18
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
- package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
- package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
- package/front_end/ui/components/text_editor/TextEditor.ts +68 -36
- package/front_end/ui/components/text_editor/config.ts +4 -2
- package/front_end/ui/components/text_editor/javascript.ts +6 -6
- package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
- package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
- package/front_end/ui/legacy/Infobar.ts +9 -0
- package/front_end/ui/legacy/InspectorView.ts +1 -1
- package/front_end/ui/legacy/ListWidget.ts +2 -2
- package/front_end/ui/legacy/ViewManager.ts +6 -0
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +20 -0
- package/front_end/ui/legacy/tabbedPane.css +1 -1
- package/inspector_overlay/main.ts +3 -0
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
- package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = global || self, factory(global.acorn = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.acorn = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// Reserved word lists for various dialects of the language
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
|
|
20
20
|
|
|
21
|
-
var keywords = {
|
|
21
|
+
var keywords$1 = {
|
|
22
22
|
5: ecma5AndLessKeywords,
|
|
23
23
|
"5module": ecma5AndLessKeywords + " export import",
|
|
24
24
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
@@ -137,17 +137,17 @@
|
|
|
137
137
|
|
|
138
138
|
// Map keyword names to token types.
|
|
139
139
|
|
|
140
|
-
var keywords
|
|
140
|
+
var keywords = {};
|
|
141
141
|
|
|
142
142
|
// Succinct definitions of keyword token types
|
|
143
143
|
function kw(name, options) {
|
|
144
144
|
if ( options === void 0 ) options = {};
|
|
145
145
|
|
|
146
146
|
options.keyword = name;
|
|
147
|
-
return keywords
|
|
147
|
+
return keywords[name] = new TokenType(name, options)
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
var types = {
|
|
150
|
+
var types$1 = {
|
|
151
151
|
num: new TokenType("num", startsExpr),
|
|
152
152
|
regexp: new TokenType("regexp", startsExpr),
|
|
153
153
|
string: new TokenType("string", startsExpr),
|
|
@@ -252,8 +252,8 @@
|
|
|
252
252
|
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
|
|
253
253
|
var lineBreakG = new RegExp(lineBreak.source, "g");
|
|
254
254
|
|
|
255
|
-
function isNewLine(code
|
|
256
|
-
return code === 10 || code === 13 ||
|
|
255
|
+
function isNewLine(code) {
|
|
256
|
+
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
|
|
@@ -464,13 +464,14 @@
|
|
|
464
464
|
var
|
|
465
465
|
SCOPE_TOP = 1,
|
|
466
466
|
SCOPE_FUNCTION = 2,
|
|
467
|
-
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,
|
|
468
467
|
SCOPE_ASYNC = 4,
|
|
469
468
|
SCOPE_GENERATOR = 8,
|
|
470
469
|
SCOPE_ARROW = 16,
|
|
471
470
|
SCOPE_SIMPLE_CATCH = 32,
|
|
472
471
|
SCOPE_SUPER = 64,
|
|
473
|
-
SCOPE_DIRECT_SUPER = 128
|
|
472
|
+
SCOPE_DIRECT_SUPER = 128,
|
|
473
|
+
SCOPE_CLASS_STATIC_BLOCK = 256,
|
|
474
|
+
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
474
475
|
|
|
475
476
|
function functionFlags(async, generator) {
|
|
476
477
|
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)
|
|
@@ -488,7 +489,7 @@
|
|
|
488
489
|
var Parser = function Parser(options, input, startPos) {
|
|
489
490
|
this.options = options = getOptions(options);
|
|
490
491
|
this.sourceFile = options.sourceFile;
|
|
491
|
-
this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
492
|
+
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
492
493
|
var reserved = "";
|
|
493
494
|
if (options.allowReserved !== true) {
|
|
494
495
|
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
|
|
@@ -519,7 +520,7 @@
|
|
|
519
520
|
|
|
520
521
|
// Properties of the current token:
|
|
521
522
|
// Its type
|
|
522
|
-
this.type = types.eof;
|
|
523
|
+
this.type = types$1.eof;
|
|
523
524
|
// For tokens that include more information than their type, the value
|
|
524
525
|
this.value = null;
|
|
525
526
|
// Its start and end offset
|
|
@@ -570,7 +571,7 @@
|
|
|
570
571
|
this.privateNameStack = [];
|
|
571
572
|
};
|
|
572
573
|
|
|
573
|
-
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },
|
|
574
|
+
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };
|
|
574
575
|
|
|
575
576
|
Parser.prototype.parse = function parse () {
|
|
576
577
|
var node = this.options.program || this.startNode();
|
|
@@ -579,29 +580,40 @@
|
|
|
579
580
|
};
|
|
580
581
|
|
|
581
582
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
583
|
+
|
|
582
584
|
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
585
|
+
|
|
583
586
|
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
587
|
+
|
|
584
588
|
prototypeAccessors.canAwait.get = function () {
|
|
585
589
|
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
586
590
|
var scope = this.scopeStack[i];
|
|
587
|
-
if (scope.inClassFieldInit) { return false }
|
|
591
|
+
if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false }
|
|
588
592
|
if (scope.flags & SCOPE_FUNCTION) { return (scope.flags & SCOPE_ASYNC) > 0 }
|
|
589
593
|
}
|
|
590
594
|
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
|
|
591
595
|
};
|
|
596
|
+
|
|
592
597
|
prototypeAccessors.allowSuper.get = function () {
|
|
593
598
|
var ref = this.currentThisScope();
|
|
594
599
|
var flags = ref.flags;
|
|
595
600
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
596
601
|
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
597
602
|
};
|
|
603
|
+
|
|
598
604
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
605
|
+
|
|
599
606
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
600
|
-
|
|
607
|
+
|
|
608
|
+
prototypeAccessors.allowNewDotTarget.get = function () {
|
|
601
609
|
var ref = this.currentThisScope();
|
|
602
610
|
var flags = ref.flags;
|
|
603
611
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
604
|
-
return (flags & SCOPE_FUNCTION) > 0 || inClassFieldInit
|
|
612
|
+
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
prototypeAccessors.inClassStaticBlock.get = function () {
|
|
616
|
+
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
|
|
605
617
|
};
|
|
606
618
|
|
|
607
619
|
Parser.extend = function extend () {
|
|
@@ -629,12 +641,12 @@
|
|
|
629
641
|
|
|
630
642
|
Object.defineProperties( Parser.prototype, prototypeAccessors );
|
|
631
643
|
|
|
632
|
-
var pp = Parser.prototype;
|
|
644
|
+
var pp$9 = Parser.prototype;
|
|
633
645
|
|
|
634
646
|
// ## Parser utilities
|
|
635
647
|
|
|
636
648
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
637
|
-
pp.strictDirective = function(start) {
|
|
649
|
+
pp$9.strictDirective = function(start) {
|
|
638
650
|
for (;;) {
|
|
639
651
|
// Try to find string literal.
|
|
640
652
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -662,7 +674,7 @@
|
|
|
662
674
|
// Predicate that tests whether the next token is of the given
|
|
663
675
|
// type, and if yes, consumes it as a side effect.
|
|
664
676
|
|
|
665
|
-
pp.eat = function(type) {
|
|
677
|
+
pp$9.eat = function(type) {
|
|
666
678
|
if (this.type === type) {
|
|
667
679
|
this.next();
|
|
668
680
|
return true
|
|
@@ -673,13 +685,13 @@
|
|
|
673
685
|
|
|
674
686
|
// Tests whether parsed token is a contextual keyword.
|
|
675
687
|
|
|
676
|
-
pp.isContextual = function(name) {
|
|
677
|
-
return this.type === types.name && this.value === name && !this.containsEsc
|
|
688
|
+
pp$9.isContextual = function(name) {
|
|
689
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc
|
|
678
690
|
};
|
|
679
691
|
|
|
680
692
|
// Consumes contextual keyword if possible.
|
|
681
693
|
|
|
682
|
-
pp.eatContextual = function(name) {
|
|
694
|
+
pp$9.eatContextual = function(name) {
|
|
683
695
|
if (!this.isContextual(name)) { return false }
|
|
684
696
|
this.next();
|
|
685
697
|
return true
|
|
@@ -687,19 +699,19 @@
|
|
|
687
699
|
|
|
688
700
|
// Asserts that following token is given contextual keyword.
|
|
689
701
|
|
|
690
|
-
pp.expectContextual = function(name) {
|
|
702
|
+
pp$9.expectContextual = function(name) {
|
|
691
703
|
if (!this.eatContextual(name)) { this.unexpected(); }
|
|
692
704
|
};
|
|
693
705
|
|
|
694
706
|
// Test whether a semicolon can be inserted at the current position.
|
|
695
707
|
|
|
696
|
-
pp.canInsertSemicolon = function() {
|
|
697
|
-
return this.type === types.eof ||
|
|
698
|
-
this.type === types.braceR ||
|
|
708
|
+
pp$9.canInsertSemicolon = function() {
|
|
709
|
+
return this.type === types$1.eof ||
|
|
710
|
+
this.type === types$1.braceR ||
|
|
699
711
|
lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
700
712
|
};
|
|
701
713
|
|
|
702
|
-
pp.insertSemicolon = function() {
|
|
714
|
+
pp$9.insertSemicolon = function() {
|
|
703
715
|
if (this.canInsertSemicolon()) {
|
|
704
716
|
if (this.options.onInsertedSemicolon)
|
|
705
717
|
{ this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
|
|
@@ -710,11 +722,11 @@
|
|
|
710
722
|
// Consume a semicolon, or, failing that, see if we are allowed to
|
|
711
723
|
// pretend that there is a semicolon at this position.
|
|
712
724
|
|
|
713
|
-
pp.semicolon = function() {
|
|
714
|
-
if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
725
|
+
pp$9.semicolon = function() {
|
|
726
|
+
if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
|
|
715
727
|
};
|
|
716
728
|
|
|
717
|
-
pp.afterTrailingComma = function(tokType, notNext) {
|
|
729
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
718
730
|
if (this.type === tokType) {
|
|
719
731
|
if (this.options.onTrailingComma)
|
|
720
732
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
|
@@ -727,13 +739,13 @@
|
|
|
727
739
|
// Expect a token of a given type. If found, consume it, otherwise,
|
|
728
740
|
// raise an unexpected token error.
|
|
729
741
|
|
|
730
|
-
pp.expect = function(type) {
|
|
742
|
+
pp$9.expect = function(type) {
|
|
731
743
|
this.eat(type) || this.unexpected();
|
|
732
744
|
};
|
|
733
745
|
|
|
734
746
|
// Raise an unexpected token error.
|
|
735
747
|
|
|
736
|
-
pp.unexpected = function(pos) {
|
|
748
|
+
pp$9.unexpected = function(pos) {
|
|
737
749
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
738
750
|
};
|
|
739
751
|
|
|
@@ -746,7 +758,7 @@
|
|
|
746
758
|
-1;
|
|
747
759
|
}
|
|
748
760
|
|
|
749
|
-
pp.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
761
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
750
762
|
if (!refDestructuringErrors) { return }
|
|
751
763
|
if (refDestructuringErrors.trailingComma > -1)
|
|
752
764
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
@@ -754,7 +766,7 @@
|
|
|
754
766
|
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
755
767
|
};
|
|
756
768
|
|
|
757
|
-
pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
769
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
758
770
|
if (!refDestructuringErrors) { return false }
|
|
759
771
|
var shorthandAssign = refDestructuringErrors.shorthandAssign;
|
|
760
772
|
var doubleProto = refDestructuringErrors.doubleProto;
|
|
@@ -765,20 +777,20 @@
|
|
|
765
777
|
{ this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
|
|
766
778
|
};
|
|
767
779
|
|
|
768
|
-
pp.checkYieldAwaitInDefaultParams = function() {
|
|
780
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
769
781
|
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
|
|
770
782
|
{ this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
|
|
771
783
|
if (this.awaitPos)
|
|
772
784
|
{ this.raise(this.awaitPos, "Await expression cannot be a default value"); }
|
|
773
785
|
};
|
|
774
786
|
|
|
775
|
-
pp.isSimpleAssignTarget = function(expr) {
|
|
787
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
776
788
|
if (expr.type === "ParenthesizedExpression")
|
|
777
789
|
{ return this.isSimpleAssignTarget(expr.expression) }
|
|
778
790
|
return expr.type === "Identifier" || expr.type === "MemberExpression"
|
|
779
791
|
};
|
|
780
792
|
|
|
781
|
-
var pp$
|
|
793
|
+
var pp$8 = Parser.prototype;
|
|
782
794
|
|
|
783
795
|
// ### Statement parsing
|
|
784
796
|
|
|
@@ -787,10 +799,10 @@
|
|
|
787
799
|
// `program` argument. If present, the statements will be appended
|
|
788
800
|
// to its body instead of creating a new node.
|
|
789
801
|
|
|
790
|
-
pp$
|
|
802
|
+
pp$8.parseTopLevel = function(node) {
|
|
791
803
|
var exports = Object.create(null);
|
|
792
804
|
if (!node.body) { node.body = []; }
|
|
793
|
-
while (this.type !== types.eof) {
|
|
805
|
+
while (this.type !== types$1.eof) {
|
|
794
806
|
var stmt = this.parseStatement(null, true, exports);
|
|
795
807
|
node.body.push(stmt);
|
|
796
808
|
}
|
|
@@ -809,7 +821,7 @@
|
|
|
809
821
|
|
|
810
822
|
var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
|
|
811
823
|
|
|
812
|
-
pp$
|
|
824
|
+
pp$8.isLet = function(context) {
|
|
813
825
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
|
|
814
826
|
skipWhiteSpace.lastIndex = this.pos;
|
|
815
827
|
var skip = skipWhiteSpace.exec(this.input);
|
|
@@ -835,7 +847,7 @@
|
|
|
835
847
|
// check 'async [no LineTerminator here] function'
|
|
836
848
|
// - 'async /*foo*/ function' is OK.
|
|
837
849
|
// - 'async /*\n*/ function' is invalid.
|
|
838
|
-
pp$
|
|
850
|
+
pp$8.isAsyncFunction = function() {
|
|
839
851
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
840
852
|
{ return false }
|
|
841
853
|
|
|
@@ -855,11 +867,11 @@
|
|
|
855
867
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
856
868
|
// does not help.
|
|
857
869
|
|
|
858
|
-
pp$
|
|
870
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
859
871
|
var starttype = this.type, node = this.startNode(), kind;
|
|
860
872
|
|
|
861
873
|
if (this.isLet(context)) {
|
|
862
|
-
starttype = types._var;
|
|
874
|
+
starttype = types$1._var;
|
|
863
875
|
kind = "let";
|
|
864
876
|
}
|
|
865
877
|
|
|
@@ -868,35 +880,35 @@
|
|
|
868
880
|
// complexity.
|
|
869
881
|
|
|
870
882
|
switch (starttype) {
|
|
871
|
-
case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
872
|
-
case types._debugger: return this.parseDebuggerStatement(node)
|
|
873
|
-
case types._do: return this.parseDoStatement(node)
|
|
874
|
-
case types._for: return this.parseForStatement(node)
|
|
875
|
-
case types._function:
|
|
883
|
+
case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
|
|
884
|
+
case types$1._debugger: return this.parseDebuggerStatement(node)
|
|
885
|
+
case types$1._do: return this.parseDoStatement(node)
|
|
886
|
+
case types$1._for: return this.parseForStatement(node)
|
|
887
|
+
case types$1._function:
|
|
876
888
|
// Function as sole body of either an if statement or a labeled statement
|
|
877
889
|
// works, but not when it is part of a labeled statement that is the sole
|
|
878
890
|
// body of an if statement.
|
|
879
891
|
if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
|
|
880
892
|
return this.parseFunctionStatement(node, false, !context)
|
|
881
|
-
case types._class:
|
|
893
|
+
case types$1._class:
|
|
882
894
|
if (context) { this.unexpected(); }
|
|
883
895
|
return this.parseClass(node, true)
|
|
884
|
-
case types._if: return this.parseIfStatement(node)
|
|
885
|
-
case types._return: return this.parseReturnStatement(node)
|
|
886
|
-
case types._switch: return this.parseSwitchStatement(node)
|
|
887
|
-
case types._throw: return this.parseThrowStatement(node)
|
|
888
|
-
case types._try: return this.parseTryStatement(node)
|
|
889
|
-
case types._const: case types._var:
|
|
896
|
+
case types$1._if: return this.parseIfStatement(node)
|
|
897
|
+
case types$1._return: return this.parseReturnStatement(node)
|
|
898
|
+
case types$1._switch: return this.parseSwitchStatement(node)
|
|
899
|
+
case types$1._throw: return this.parseThrowStatement(node)
|
|
900
|
+
case types$1._try: return this.parseTryStatement(node)
|
|
901
|
+
case types$1._const: case types$1._var:
|
|
890
902
|
kind = kind || this.value;
|
|
891
903
|
if (context && kind !== "var") { this.unexpected(); }
|
|
892
904
|
return this.parseVarStatement(node, kind)
|
|
893
|
-
case types._while: return this.parseWhileStatement(node)
|
|
894
|
-
case types._with: return this.parseWithStatement(node)
|
|
895
|
-
case types.braceL: return this.parseBlock(true, node)
|
|
896
|
-
case types.semi: return this.parseEmptyStatement(node)
|
|
897
|
-
case types._export:
|
|
898
|
-
case types._import:
|
|
899
|
-
if (this.options.ecmaVersion > 10 && starttype === types._import) {
|
|
905
|
+
case types$1._while: return this.parseWhileStatement(node)
|
|
906
|
+
case types$1._with: return this.parseWithStatement(node)
|
|
907
|
+
case types$1.braceL: return this.parseBlock(true, node)
|
|
908
|
+
case types$1.semi: return this.parseEmptyStatement(node)
|
|
909
|
+
case types$1._export:
|
|
910
|
+
case types$1._import:
|
|
911
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
900
912
|
skipWhiteSpace.lastIndex = this.pos;
|
|
901
913
|
var skip = skipWhiteSpace.exec(this.input);
|
|
902
914
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
@@ -910,7 +922,7 @@
|
|
|
910
922
|
if (!this.inModule)
|
|
911
923
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
912
924
|
}
|
|
913
|
-
return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
925
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
914
926
|
|
|
915
927
|
// If the statement does not start with a statement keyword or a
|
|
916
928
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -925,17 +937,17 @@
|
|
|
925
937
|
}
|
|
926
938
|
|
|
927
939
|
var maybeName = this.value, expr = this.parseExpression();
|
|
928
|
-
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon))
|
|
940
|
+
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
|
|
929
941
|
{ return this.parseLabeledStatement(node, maybeName, expr, context) }
|
|
930
942
|
else { return this.parseExpressionStatement(node, expr) }
|
|
931
943
|
}
|
|
932
944
|
};
|
|
933
945
|
|
|
934
|
-
pp$
|
|
946
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
935
947
|
var isBreak = keyword === "break";
|
|
936
948
|
this.next();
|
|
937
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
|
938
|
-
else if (this.type !== types.name) { this.unexpected(); }
|
|
949
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
|
|
950
|
+
else if (this.type !== types$1.name) { this.unexpected(); }
|
|
939
951
|
else {
|
|
940
952
|
node.label = this.parseIdent();
|
|
941
953
|
this.semicolon();
|
|
@@ -955,21 +967,21 @@
|
|
|
955
967
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
|
|
956
968
|
};
|
|
957
969
|
|
|
958
|
-
pp$
|
|
970
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
959
971
|
this.next();
|
|
960
972
|
this.semicolon();
|
|
961
973
|
return this.finishNode(node, "DebuggerStatement")
|
|
962
974
|
};
|
|
963
975
|
|
|
964
|
-
pp$
|
|
976
|
+
pp$8.parseDoStatement = function(node) {
|
|
965
977
|
this.next();
|
|
966
978
|
this.labels.push(loopLabel);
|
|
967
979
|
node.body = this.parseStatement("do");
|
|
968
980
|
this.labels.pop();
|
|
969
|
-
this.expect(types._while);
|
|
981
|
+
this.expect(types$1._while);
|
|
970
982
|
node.test = this.parseParenExpression();
|
|
971
983
|
if (this.options.ecmaVersion >= 6)
|
|
972
|
-
{ this.eat(types.semi); }
|
|
984
|
+
{ this.eat(types$1.semi); }
|
|
973
985
|
else
|
|
974
986
|
{ this.semicolon(); }
|
|
975
987
|
return this.finishNode(node, "DoWhileStatement")
|
|
@@ -983,25 +995,25 @@
|
|
|
983
995
|
// part (semicolon immediately after the opening parenthesis), it
|
|
984
996
|
// is a regular `for` loop.
|
|
985
997
|
|
|
986
|
-
pp$
|
|
998
|
+
pp$8.parseForStatement = function(node) {
|
|
987
999
|
this.next();
|
|
988
1000
|
var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
|
|
989
1001
|
this.labels.push(loopLabel);
|
|
990
1002
|
this.enterScope(0);
|
|
991
|
-
this.expect(types.parenL);
|
|
992
|
-
if (this.type === types.semi) {
|
|
1003
|
+
this.expect(types$1.parenL);
|
|
1004
|
+
if (this.type === types$1.semi) {
|
|
993
1005
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
994
1006
|
return this.parseFor(node, null)
|
|
995
1007
|
}
|
|
996
1008
|
var isLet = this.isLet();
|
|
997
|
-
if (this.type === types._var || this.type === types._const || isLet) {
|
|
1009
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
998
1010
|
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
999
1011
|
this.next();
|
|
1000
1012
|
this.parseVar(init$1, true, kind);
|
|
1001
1013
|
this.finishNode(init$1, "VariableDeclaration");
|
|
1002
|
-
if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
1014
|
+
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
|
|
1003
1015
|
if (this.options.ecmaVersion >= 9) {
|
|
1004
|
-
if (this.type === types._in) {
|
|
1016
|
+
if (this.type === types$1._in) {
|
|
1005
1017
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
1006
1018
|
} else { node.await = awaitAt > -1; }
|
|
1007
1019
|
}
|
|
@@ -1010,14 +1022,16 @@
|
|
|
1010
1022
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
1011
1023
|
return this.parseFor(node, init$1)
|
|
1012
1024
|
}
|
|
1025
|
+
var startsWithLet = this.isContextual("let"), isForOf = false;
|
|
1013
1026
|
var refDestructuringErrors = new DestructuringErrors;
|
|
1014
1027
|
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
1015
|
-
if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
1028
|
+
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
1016
1029
|
if (this.options.ecmaVersion >= 9) {
|
|
1017
|
-
if (this.type === types._in) {
|
|
1030
|
+
if (this.type === types$1._in) {
|
|
1018
1031
|
if (awaitAt > -1) { this.unexpected(awaitAt); }
|
|
1019
1032
|
} else { node.await = awaitAt > -1; }
|
|
1020
1033
|
}
|
|
1034
|
+
if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); }
|
|
1021
1035
|
this.toAssignable(init, false, refDestructuringErrors);
|
|
1022
1036
|
this.checkLValPattern(init);
|
|
1023
1037
|
return this.parseForIn(node, init)
|
|
@@ -1028,21 +1042,21 @@
|
|
|
1028
1042
|
return this.parseFor(node, init)
|
|
1029
1043
|
};
|
|
1030
1044
|
|
|
1031
|
-
pp$
|
|
1045
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
1032
1046
|
this.next();
|
|
1033
1047
|
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
|
|
1034
1048
|
};
|
|
1035
1049
|
|
|
1036
|
-
pp$
|
|
1050
|
+
pp$8.parseIfStatement = function(node) {
|
|
1037
1051
|
this.next();
|
|
1038
1052
|
node.test = this.parseParenExpression();
|
|
1039
1053
|
// allow function declarations in branches, but only in non-strict mode
|
|
1040
1054
|
node.consequent = this.parseStatement("if");
|
|
1041
|
-
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
|
|
1055
|
+
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
|
|
1042
1056
|
return this.finishNode(node, "IfStatement")
|
|
1043
1057
|
};
|
|
1044
1058
|
|
|
1045
|
-
pp$
|
|
1059
|
+
pp$8.parseReturnStatement = function(node) {
|
|
1046
1060
|
if (!this.inFunction && !this.options.allowReturnOutsideFunction)
|
|
1047
1061
|
{ this.raise(this.start, "'return' outside of function"); }
|
|
1048
1062
|
this.next();
|
|
@@ -1051,16 +1065,16 @@
|
|
|
1051
1065
|
// optional arguments, we eagerly look for a semicolon or the
|
|
1052
1066
|
// possibility to insert one.
|
|
1053
1067
|
|
|
1054
|
-
if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
1068
|
+
if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
|
|
1055
1069
|
else { node.argument = this.parseExpression(); this.semicolon(); }
|
|
1056
1070
|
return this.finishNode(node, "ReturnStatement")
|
|
1057
1071
|
};
|
|
1058
1072
|
|
|
1059
|
-
pp$
|
|
1073
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
1060
1074
|
this.next();
|
|
1061
1075
|
node.discriminant = this.parseParenExpression();
|
|
1062
1076
|
node.cases = [];
|
|
1063
|
-
this.expect(types.braceL);
|
|
1077
|
+
this.expect(types$1.braceL);
|
|
1064
1078
|
this.labels.push(switchLabel);
|
|
1065
1079
|
this.enterScope(0);
|
|
1066
1080
|
|
|
@@ -1069,9 +1083,9 @@
|
|
|
1069
1083
|
// adding statements to.
|
|
1070
1084
|
|
|
1071
1085
|
var cur;
|
|
1072
|
-
for (var sawDefault = false; this.type !== types.braceR;) {
|
|
1073
|
-
if (this.type === types._case || this.type === types._default) {
|
|
1074
|
-
var isCase = this.type === types._case;
|
|
1086
|
+
for (var sawDefault = false; this.type !== types$1.braceR;) {
|
|
1087
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
1088
|
+
var isCase = this.type === types$1._case;
|
|
1075
1089
|
if (cur) { this.finishNode(cur, "SwitchCase"); }
|
|
1076
1090
|
node.cases.push(cur = this.startNode());
|
|
1077
1091
|
cur.consequent = [];
|
|
@@ -1083,7 +1097,7 @@
|
|
|
1083
1097
|
sawDefault = true;
|
|
1084
1098
|
cur.test = null;
|
|
1085
1099
|
}
|
|
1086
|
-
this.expect(types.colon);
|
|
1100
|
+
this.expect(types$1.colon);
|
|
1087
1101
|
} else {
|
|
1088
1102
|
if (!cur) { this.unexpected(); }
|
|
1089
1103
|
cur.consequent.push(this.parseStatement(null));
|
|
@@ -1096,7 +1110,7 @@
|
|
|
1096
1110
|
return this.finishNode(node, "SwitchStatement")
|
|
1097
1111
|
};
|
|
1098
1112
|
|
|
1099
|
-
pp$
|
|
1113
|
+
pp$8.parseThrowStatement = function(node) {
|
|
1100
1114
|
this.next();
|
|
1101
1115
|
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
|
|
1102
1116
|
{ this.raise(this.lastTokEnd, "Illegal newline after throw"); }
|
|
@@ -1107,21 +1121,21 @@
|
|
|
1107
1121
|
|
|
1108
1122
|
// Reused empty array added for node fields that are always empty.
|
|
1109
1123
|
|
|
1110
|
-
var empty = [];
|
|
1124
|
+
var empty$1 = [];
|
|
1111
1125
|
|
|
1112
|
-
pp$
|
|
1126
|
+
pp$8.parseTryStatement = function(node) {
|
|
1113
1127
|
this.next();
|
|
1114
1128
|
node.block = this.parseBlock();
|
|
1115
1129
|
node.handler = null;
|
|
1116
|
-
if (this.type === types._catch) {
|
|
1130
|
+
if (this.type === types$1._catch) {
|
|
1117
1131
|
var clause = this.startNode();
|
|
1118
1132
|
this.next();
|
|
1119
|
-
if (this.eat(types.parenL)) {
|
|
1133
|
+
if (this.eat(types$1.parenL)) {
|
|
1120
1134
|
clause.param = this.parseBindingAtom();
|
|
1121
1135
|
var simple = clause.param.type === "Identifier";
|
|
1122
1136
|
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
1123
1137
|
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
1124
|
-
this.expect(types.parenR);
|
|
1138
|
+
this.expect(types$1.parenR);
|
|
1125
1139
|
} else {
|
|
1126
1140
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
1127
1141
|
clause.param = null;
|
|
@@ -1131,20 +1145,20 @@
|
|
|
1131
1145
|
this.exitScope();
|
|
1132
1146
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
1133
1147
|
}
|
|
1134
|
-
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
|
|
1148
|
+
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
|
|
1135
1149
|
if (!node.handler && !node.finalizer)
|
|
1136
1150
|
{ this.raise(node.start, "Missing catch or finally clause"); }
|
|
1137
1151
|
return this.finishNode(node, "TryStatement")
|
|
1138
1152
|
};
|
|
1139
1153
|
|
|
1140
|
-
pp$
|
|
1154
|
+
pp$8.parseVarStatement = function(node, kind) {
|
|
1141
1155
|
this.next();
|
|
1142
1156
|
this.parseVar(node, false, kind);
|
|
1143
1157
|
this.semicolon();
|
|
1144
1158
|
return this.finishNode(node, "VariableDeclaration")
|
|
1145
1159
|
};
|
|
1146
1160
|
|
|
1147
|
-
pp$
|
|
1161
|
+
pp$8.parseWhileStatement = function(node) {
|
|
1148
1162
|
this.next();
|
|
1149
1163
|
node.test = this.parseParenExpression();
|
|
1150
1164
|
this.labels.push(loopLabel);
|
|
@@ -1153,7 +1167,7 @@
|
|
|
1153
1167
|
return this.finishNode(node, "WhileStatement")
|
|
1154
1168
|
};
|
|
1155
1169
|
|
|
1156
|
-
pp$
|
|
1170
|
+
pp$8.parseWithStatement = function(node) {
|
|
1157
1171
|
if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
|
|
1158
1172
|
this.next();
|
|
1159
1173
|
node.object = this.parseParenExpression();
|
|
@@ -1161,12 +1175,12 @@
|
|
|
1161
1175
|
return this.finishNode(node, "WithStatement")
|
|
1162
1176
|
};
|
|
1163
1177
|
|
|
1164
|
-
pp$
|
|
1178
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
1165
1179
|
this.next();
|
|
1166
1180
|
return this.finishNode(node, "EmptyStatement")
|
|
1167
1181
|
};
|
|
1168
1182
|
|
|
1169
|
-
pp$
|
|
1183
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
1170
1184
|
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
|
|
1171
1185
|
{
|
|
1172
1186
|
var label = list[i$1];
|
|
@@ -1174,7 +1188,7 @@
|
|
|
1174
1188
|
if (label.name === maybeName)
|
|
1175
1189
|
{ this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
1176
1190
|
} }
|
|
1177
|
-
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
|
1191
|
+
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
1178
1192
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
1179
1193
|
var label$1 = this.labels[i];
|
|
1180
1194
|
if (label$1.statementStart === node.start) {
|
|
@@ -1190,7 +1204,7 @@
|
|
|
1190
1204
|
return this.finishNode(node, "LabeledStatement")
|
|
1191
1205
|
};
|
|
1192
1206
|
|
|
1193
|
-
pp$
|
|
1207
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
1194
1208
|
node.expression = expr;
|
|
1195
1209
|
this.semicolon();
|
|
1196
1210
|
return this.finishNode(node, "ExpressionStatement")
|
|
@@ -1200,14 +1214,14 @@
|
|
|
1200
1214
|
// strict"` declarations when `allowStrict` is true (used for
|
|
1201
1215
|
// function bodies).
|
|
1202
1216
|
|
|
1203
|
-
pp$
|
|
1217
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
1204
1218
|
if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
|
|
1205
1219
|
if ( node === void 0 ) node = this.startNode();
|
|
1206
1220
|
|
|
1207
1221
|
node.body = [];
|
|
1208
|
-
this.expect(types.braceL);
|
|
1222
|
+
this.expect(types$1.braceL);
|
|
1209
1223
|
if (createNewLexicalScope) { this.enterScope(0); }
|
|
1210
|
-
while (this.type !== types.braceR) {
|
|
1224
|
+
while (this.type !== types$1.braceR) {
|
|
1211
1225
|
var stmt = this.parseStatement(null);
|
|
1212
1226
|
node.body.push(stmt);
|
|
1213
1227
|
}
|
|
@@ -1221,13 +1235,13 @@
|
|
|
1221
1235
|
// `parseStatement` will already have parsed the init statement or
|
|
1222
1236
|
// expression.
|
|
1223
1237
|
|
|
1224
|
-
pp$
|
|
1238
|
+
pp$8.parseFor = function(node, init) {
|
|
1225
1239
|
node.init = init;
|
|
1226
|
-
this.expect(types.semi);
|
|
1227
|
-
node.test = this.type === types.semi ? null : this.parseExpression();
|
|
1228
|
-
this.expect(types.semi);
|
|
1229
|
-
node.update = this.type === types.parenR ? null : this.parseExpression();
|
|
1230
|
-
this.expect(types.parenR);
|
|
1240
|
+
this.expect(types$1.semi);
|
|
1241
|
+
node.test = this.type === types$1.semi ? null : this.parseExpression();
|
|
1242
|
+
this.expect(types$1.semi);
|
|
1243
|
+
node.update = this.type === types$1.parenR ? null : this.parseExpression();
|
|
1244
|
+
this.expect(types$1.parenR);
|
|
1231
1245
|
node.body = this.parseStatement("for");
|
|
1232
1246
|
this.exitScope();
|
|
1233
1247
|
this.labels.pop();
|
|
@@ -1237,8 +1251,8 @@
|
|
|
1237
1251
|
// Parse a `for`/`in` and `for`/`of` loop, which are almost
|
|
1238
1252
|
// same from parser's perspective.
|
|
1239
1253
|
|
|
1240
|
-
pp$
|
|
1241
|
-
var isForIn = this.type === types._in;
|
|
1254
|
+
pp$8.parseForIn = function(node, init) {
|
|
1255
|
+
var isForIn = this.type === types$1._in;
|
|
1242
1256
|
this.next();
|
|
1243
1257
|
|
|
1244
1258
|
if (
|
|
@@ -1259,7 +1273,7 @@
|
|
|
1259
1273
|
}
|
|
1260
1274
|
node.left = init;
|
|
1261
1275
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
|
|
1262
|
-
this.expect(types.parenR);
|
|
1276
|
+
this.expect(types$1.parenR);
|
|
1263
1277
|
node.body = this.parseStatement("for");
|
|
1264
1278
|
this.exitScope();
|
|
1265
1279
|
this.labels.pop();
|
|
@@ -1268,28 +1282,28 @@
|
|
|
1268
1282
|
|
|
1269
1283
|
// Parse a list of variable declarations.
|
|
1270
1284
|
|
|
1271
|
-
pp$
|
|
1285
|
+
pp$8.parseVar = function(node, isFor, kind) {
|
|
1272
1286
|
node.declarations = [];
|
|
1273
1287
|
node.kind = kind;
|
|
1274
1288
|
for (;;) {
|
|
1275
1289
|
var decl = this.startNode();
|
|
1276
1290
|
this.parseVarId(decl, kind);
|
|
1277
|
-
if (this.eat(types.eq)) {
|
|
1291
|
+
if (this.eat(types$1.eq)) {
|
|
1278
1292
|
decl.init = this.parseMaybeAssign(isFor);
|
|
1279
|
-
} else if (kind === "const" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
1293
|
+
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
1280
1294
|
this.unexpected();
|
|
1281
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) {
|
|
1295
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
1282
1296
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
1283
1297
|
} else {
|
|
1284
1298
|
decl.init = null;
|
|
1285
1299
|
}
|
|
1286
1300
|
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
1287
|
-
if (!this.eat(types.comma)) { break }
|
|
1301
|
+
if (!this.eat(types$1.comma)) { break }
|
|
1288
1302
|
}
|
|
1289
1303
|
return node
|
|
1290
1304
|
};
|
|
1291
1305
|
|
|
1292
|
-
pp$
|
|
1306
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
1293
1307
|
decl.id = this.parseBindingAtom();
|
|
1294
1308
|
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
|
|
1295
1309
|
};
|
|
@@ -1300,18 +1314,18 @@
|
|
|
1300
1314
|
// `statement & FUNC_STATEMENT`).
|
|
1301
1315
|
|
|
1302
1316
|
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
|
|
1303
|
-
pp$
|
|
1317
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
1304
1318
|
this.initFunction(node);
|
|
1305
1319
|
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
|
|
1306
|
-
if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))
|
|
1320
|
+
if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
|
|
1307
1321
|
{ this.unexpected(); }
|
|
1308
|
-
node.generator = this.eat(types.star);
|
|
1322
|
+
node.generator = this.eat(types$1.star);
|
|
1309
1323
|
}
|
|
1310
1324
|
if (this.options.ecmaVersion >= 8)
|
|
1311
1325
|
{ node.async = !!isAsync; }
|
|
1312
1326
|
|
|
1313
1327
|
if (statement & FUNC_STATEMENT) {
|
|
1314
|
-
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();
|
|
1328
|
+
node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
|
|
1315
1329
|
if (node.id && !(statement & FUNC_HANGING_STATEMENT))
|
|
1316
1330
|
// If it is a regular function declaration in sloppy mode, then it is
|
|
1317
1331
|
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
|
|
@@ -1327,10 +1341,10 @@
|
|
|
1327
1341
|
this.enterScope(functionFlags(node.async, node.generator));
|
|
1328
1342
|
|
|
1329
1343
|
if (!(statement & FUNC_STATEMENT))
|
|
1330
|
-
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
|
1344
|
+
{ node.id = this.type === types$1.name ? this.parseIdent() : null; }
|
|
1331
1345
|
|
|
1332
1346
|
this.parseFunctionParams(node);
|
|
1333
|
-
this.parseFunctionBody(node, allowExpressionBody, false);
|
|
1347
|
+
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
|
|
1334
1348
|
|
|
1335
1349
|
this.yieldPos = oldYieldPos;
|
|
1336
1350
|
this.awaitPos = oldAwaitPos;
|
|
@@ -1338,16 +1352,16 @@
|
|
|
1338
1352
|
return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
|
|
1339
1353
|
};
|
|
1340
1354
|
|
|
1341
|
-
pp$
|
|
1342
|
-
this.expect(types.parenL);
|
|
1343
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
1355
|
+
pp$8.parseFunctionParams = function(node) {
|
|
1356
|
+
this.expect(types$1.parenL);
|
|
1357
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
1344
1358
|
this.checkYieldAwaitInDefaultParams();
|
|
1345
1359
|
};
|
|
1346
1360
|
|
|
1347
1361
|
// Parse a class declaration or literal (depending on the
|
|
1348
1362
|
// `isStatement` parameter).
|
|
1349
1363
|
|
|
1350
|
-
pp$
|
|
1364
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
1351
1365
|
this.next();
|
|
1352
1366
|
|
|
1353
1367
|
// ecma-262 14.6 Class Definitions
|
|
@@ -1361,15 +1375,15 @@
|
|
|
1361
1375
|
var classBody = this.startNode();
|
|
1362
1376
|
var hadConstructor = false;
|
|
1363
1377
|
classBody.body = [];
|
|
1364
|
-
this.expect(types.braceL);
|
|
1365
|
-
while (this.type !== types.braceR) {
|
|
1378
|
+
this.expect(types$1.braceL);
|
|
1379
|
+
while (this.type !== types$1.braceR) {
|
|
1366
1380
|
var element = this.parseClassElement(node.superClass !== null);
|
|
1367
1381
|
if (element) {
|
|
1368
1382
|
classBody.body.push(element);
|
|
1369
1383
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
1370
1384
|
if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
|
|
1371
1385
|
hadConstructor = true;
|
|
1372
|
-
} else if (element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
1386
|
+
} else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
1373
1387
|
this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
|
|
1374
1388
|
}
|
|
1375
1389
|
}
|
|
@@ -1381,8 +1395,8 @@
|
|
|
1381
1395
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
1382
1396
|
};
|
|
1383
1397
|
|
|
1384
|
-
pp$
|
|
1385
|
-
if (this.eat(types.semi)) { return null }
|
|
1398
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
1399
|
+
if (this.eat(types$1.semi)) { return null }
|
|
1386
1400
|
|
|
1387
1401
|
var ecmaVersion = this.options.ecmaVersion;
|
|
1388
1402
|
var node = this.startNode();
|
|
@@ -1390,24 +1404,29 @@
|
|
|
1390
1404
|
var isGenerator = false;
|
|
1391
1405
|
var isAsync = false;
|
|
1392
1406
|
var kind = "method";
|
|
1407
|
+
var isStatic = false;
|
|
1393
1408
|
|
|
1394
|
-
// Parse modifiers
|
|
1395
|
-
node.static = false;
|
|
1396
1409
|
if (this.eatContextual("static")) {
|
|
1397
|
-
|
|
1398
|
-
|
|
1410
|
+
// Parse static init block
|
|
1411
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
1412
|
+
this.parseClassStaticBlock(node);
|
|
1413
|
+
return node
|
|
1414
|
+
}
|
|
1415
|
+
if (this.isClassElementNameStart() || this.type === types$1.star) {
|
|
1416
|
+
isStatic = true;
|
|
1399
1417
|
} else {
|
|
1400
1418
|
keyName = "static";
|
|
1401
1419
|
}
|
|
1402
1420
|
}
|
|
1421
|
+
node.static = isStatic;
|
|
1403
1422
|
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
1404
|
-
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
1423
|
+
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
|
|
1405
1424
|
isAsync = true;
|
|
1406
1425
|
} else {
|
|
1407
1426
|
keyName = "async";
|
|
1408
1427
|
}
|
|
1409
1428
|
}
|
|
1410
|
-
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
1429
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
|
|
1411
1430
|
isGenerator = true;
|
|
1412
1431
|
}
|
|
1413
1432
|
if (!keyName && !isAsync && !isGenerator) {
|
|
@@ -1434,7 +1453,7 @@
|
|
|
1434
1453
|
}
|
|
1435
1454
|
|
|
1436
1455
|
// Parse element value
|
|
1437
|
-
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
1456
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
1438
1457
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
1439
1458
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
1440
1459
|
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
@@ -1448,19 +1467,19 @@
|
|
|
1448
1467
|
return node
|
|
1449
1468
|
};
|
|
1450
1469
|
|
|
1451
|
-
pp$
|
|
1470
|
+
pp$8.isClassElementNameStart = function() {
|
|
1452
1471
|
return (
|
|
1453
|
-
this.type === types.name ||
|
|
1454
|
-
this.type === types.privateId ||
|
|
1455
|
-
this.type === types.num ||
|
|
1456
|
-
this.type === types.string ||
|
|
1457
|
-
this.type === types.bracketL ||
|
|
1472
|
+
this.type === types$1.name ||
|
|
1473
|
+
this.type === types$1.privateId ||
|
|
1474
|
+
this.type === types$1.num ||
|
|
1475
|
+
this.type === types$1.string ||
|
|
1476
|
+
this.type === types$1.bracketL ||
|
|
1458
1477
|
this.type.keyword
|
|
1459
1478
|
)
|
|
1460
1479
|
};
|
|
1461
1480
|
|
|
1462
|
-
pp$
|
|
1463
|
-
if (this.type === types.privateId) {
|
|
1481
|
+
pp$8.parseClassElementName = function(element) {
|
|
1482
|
+
if (this.type === types$1.privateId) {
|
|
1464
1483
|
if (this.value === "constructor") {
|
|
1465
1484
|
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
1466
1485
|
}
|
|
@@ -1471,7 +1490,7 @@
|
|
|
1471
1490
|
}
|
|
1472
1491
|
};
|
|
1473
1492
|
|
|
1474
|
-
pp$
|
|
1493
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
1475
1494
|
// Check key and flags
|
|
1476
1495
|
var key = method.key;
|
|
1477
1496
|
if (method.kind === "constructor") {
|
|
@@ -1495,14 +1514,14 @@
|
|
|
1495
1514
|
return this.finishNode(method, "MethodDefinition")
|
|
1496
1515
|
};
|
|
1497
1516
|
|
|
1498
|
-
pp$
|
|
1517
|
+
pp$8.parseClassField = function(field) {
|
|
1499
1518
|
if (checkKeyName(field, "constructor")) {
|
|
1500
1519
|
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
1501
1520
|
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
1502
1521
|
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
1503
1522
|
}
|
|
1504
1523
|
|
|
1505
|
-
if (this.eat(types.eq)) {
|
|
1524
|
+
if (this.eat(types$1.eq)) {
|
|
1506
1525
|
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
1507
1526
|
var scope = this.currentThisScope();
|
|
1508
1527
|
var inClassFieldInit = scope.inClassFieldInit;
|
|
@@ -1517,8 +1536,25 @@
|
|
|
1517
1536
|
return this.finishNode(field, "PropertyDefinition")
|
|
1518
1537
|
};
|
|
1519
1538
|
|
|
1520
|
-
pp$
|
|
1521
|
-
|
|
1539
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
1540
|
+
node.body = [];
|
|
1541
|
+
|
|
1542
|
+
var oldLabels = this.labels;
|
|
1543
|
+
this.labels = [];
|
|
1544
|
+
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
|
|
1545
|
+
while (this.type !== types$1.braceR) {
|
|
1546
|
+
var stmt = this.parseStatement(null);
|
|
1547
|
+
node.body.push(stmt);
|
|
1548
|
+
}
|
|
1549
|
+
this.next();
|
|
1550
|
+
this.exitScope();
|
|
1551
|
+
this.labels = oldLabels;
|
|
1552
|
+
|
|
1553
|
+
return this.finishNode(node, "StaticBlock")
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
1557
|
+
if (this.type === types$1.name) {
|
|
1522
1558
|
node.id = this.parseIdent();
|
|
1523
1559
|
if (isStatement)
|
|
1524
1560
|
{ this.checkLValSimple(node.id, BIND_LEXICAL, false); }
|
|
@@ -1529,17 +1565,17 @@
|
|
|
1529
1565
|
}
|
|
1530
1566
|
};
|
|
1531
1567
|
|
|
1532
|
-
pp$
|
|
1533
|
-
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
|
|
1568
|
+
pp$8.parseClassSuper = function(node) {
|
|
1569
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null;
|
|
1534
1570
|
};
|
|
1535
1571
|
|
|
1536
|
-
pp$
|
|
1572
|
+
pp$8.enterClassBody = function() {
|
|
1537
1573
|
var element = {declared: Object.create(null), used: []};
|
|
1538
1574
|
this.privateNameStack.push(element);
|
|
1539
1575
|
return element.declared
|
|
1540
1576
|
};
|
|
1541
1577
|
|
|
1542
|
-
pp$
|
|
1578
|
+
pp$8.exitClassBody = function() {
|
|
1543
1579
|
var ref = this.privateNameStack.pop();
|
|
1544
1580
|
var declared = ref.declared;
|
|
1545
1581
|
var used = ref.used;
|
|
@@ -1594,10 +1630,10 @@
|
|
|
1594
1630
|
|
|
1595
1631
|
// Parses module export declaration.
|
|
1596
1632
|
|
|
1597
|
-
pp$
|
|
1633
|
+
pp$8.parseExport = function(node, exports) {
|
|
1598
1634
|
this.next();
|
|
1599
1635
|
// export * from '...'
|
|
1600
|
-
if (this.eat(types.star)) {
|
|
1636
|
+
if (this.eat(types$1.star)) {
|
|
1601
1637
|
if (this.options.ecmaVersion >= 11) {
|
|
1602
1638
|
if (this.eatContextual("as")) {
|
|
1603
1639
|
node.exported = this.parseIdent(true);
|
|
@@ -1607,20 +1643,20 @@
|
|
|
1607
1643
|
}
|
|
1608
1644
|
}
|
|
1609
1645
|
this.expectContextual("from");
|
|
1610
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
1646
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
1611
1647
|
node.source = this.parseExprAtom();
|
|
1612
1648
|
this.semicolon();
|
|
1613
1649
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
1614
1650
|
}
|
|
1615
|
-
if (this.eat(types._default)) { // export default ...
|
|
1651
|
+
if (this.eat(types$1._default)) { // export default ...
|
|
1616
1652
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
1617
1653
|
var isAsync;
|
|
1618
|
-
if (this.type === types._function || (isAsync = this.isAsyncFunction())) {
|
|
1654
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
1619
1655
|
var fNode = this.startNode();
|
|
1620
1656
|
this.next();
|
|
1621
1657
|
if (isAsync) { this.next(); }
|
|
1622
1658
|
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
|
|
1623
|
-
} else if (this.type === types._class) {
|
|
1659
|
+
} else if (this.type === types$1._class) {
|
|
1624
1660
|
var cNode = this.startNode();
|
|
1625
1661
|
node.declaration = this.parseClass(cNode, "nullableID");
|
|
1626
1662
|
} else {
|
|
@@ -1642,7 +1678,7 @@
|
|
|
1642
1678
|
node.declaration = null;
|
|
1643
1679
|
node.specifiers = this.parseExportSpecifiers(exports);
|
|
1644
1680
|
if (this.eatContextual("from")) {
|
|
1645
|
-
if (this.type !== types.string) { this.unexpected(); }
|
|
1681
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
1646
1682
|
node.source = this.parseExprAtom();
|
|
1647
1683
|
} else {
|
|
1648
1684
|
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
@@ -1661,14 +1697,14 @@
|
|
|
1661
1697
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
1662
1698
|
};
|
|
1663
1699
|
|
|
1664
|
-
pp$
|
|
1700
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
1665
1701
|
if (!exports) { return }
|
|
1666
1702
|
if (has(exports, name))
|
|
1667
1703
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
1668
1704
|
exports[name] = true;
|
|
1669
1705
|
};
|
|
1670
1706
|
|
|
1671
|
-
pp$
|
|
1707
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
1672
1708
|
var type = pat.type;
|
|
1673
1709
|
if (type === "Identifier")
|
|
1674
1710
|
{ this.checkExport(exports, pat.name, pat.start); }
|
|
@@ -1695,7 +1731,7 @@
|
|
|
1695
1731
|
{ this.checkPatternExport(exports, pat.expression); }
|
|
1696
1732
|
};
|
|
1697
1733
|
|
|
1698
|
-
pp$
|
|
1734
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
1699
1735
|
if (!exports) { return }
|
|
1700
1736
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
1701
1737
|
{
|
|
@@ -1705,7 +1741,7 @@
|
|
|
1705
1741
|
}
|
|
1706
1742
|
};
|
|
1707
1743
|
|
|
1708
|
-
pp$
|
|
1744
|
+
pp$8.shouldParseExportStatement = function() {
|
|
1709
1745
|
return this.type.keyword === "var" ||
|
|
1710
1746
|
this.type.keyword === "const" ||
|
|
1711
1747
|
this.type.keyword === "class" ||
|
|
@@ -1716,14 +1752,14 @@
|
|
|
1716
1752
|
|
|
1717
1753
|
// Parses a comma-separated list of module exports.
|
|
1718
1754
|
|
|
1719
|
-
pp$
|
|
1755
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
1720
1756
|
var nodes = [], first = true;
|
|
1721
1757
|
// export { x, y as z } [from '...']
|
|
1722
|
-
this.expect(types.braceL);
|
|
1723
|
-
while (!this.eat(types.braceR)) {
|
|
1758
|
+
this.expect(types$1.braceL);
|
|
1759
|
+
while (!this.eat(types$1.braceR)) {
|
|
1724
1760
|
if (!first) {
|
|
1725
|
-
this.expect(types.comma);
|
|
1726
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
1761
|
+
this.expect(types$1.comma);
|
|
1762
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
1727
1763
|
} else { first = false; }
|
|
1728
1764
|
|
|
1729
1765
|
var node = this.startNode();
|
|
@@ -1737,16 +1773,16 @@
|
|
|
1737
1773
|
|
|
1738
1774
|
// Parses import declaration.
|
|
1739
1775
|
|
|
1740
|
-
pp$
|
|
1776
|
+
pp$8.parseImport = function(node) {
|
|
1741
1777
|
this.next();
|
|
1742
1778
|
// import '...'
|
|
1743
|
-
if (this.type === types.string) {
|
|
1744
|
-
node.specifiers = empty;
|
|
1779
|
+
if (this.type === types$1.string) {
|
|
1780
|
+
node.specifiers = empty$1;
|
|
1745
1781
|
node.source = this.parseExprAtom();
|
|
1746
1782
|
} else {
|
|
1747
1783
|
node.specifiers = this.parseImportSpecifiers();
|
|
1748
1784
|
this.expectContextual("from");
|
|
1749
|
-
node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();
|
|
1785
|
+
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
|
|
1750
1786
|
}
|
|
1751
1787
|
this.semicolon();
|
|
1752
1788
|
return this.finishNode(node, "ImportDeclaration")
|
|
@@ -1754,17 +1790,17 @@
|
|
|
1754
1790
|
|
|
1755
1791
|
// Parses a comma-separated list of module imports.
|
|
1756
1792
|
|
|
1757
|
-
pp$
|
|
1793
|
+
pp$8.parseImportSpecifiers = function() {
|
|
1758
1794
|
var nodes = [], first = true;
|
|
1759
|
-
if (this.type === types.name) {
|
|
1795
|
+
if (this.type === types$1.name) {
|
|
1760
1796
|
// import defaultObj, { x, y as z } from '...'
|
|
1761
1797
|
var node = this.startNode();
|
|
1762
1798
|
node.local = this.parseIdent();
|
|
1763
1799
|
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
1764
1800
|
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
1765
|
-
if (!this.eat(types.comma)) { return nodes }
|
|
1801
|
+
if (!this.eat(types$1.comma)) { return nodes }
|
|
1766
1802
|
}
|
|
1767
|
-
if (this.type === types.star) {
|
|
1803
|
+
if (this.type === types$1.star) {
|
|
1768
1804
|
var node$1 = this.startNode();
|
|
1769
1805
|
this.next();
|
|
1770
1806
|
this.expectContextual("as");
|
|
@@ -1773,11 +1809,11 @@
|
|
|
1773
1809
|
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
1774
1810
|
return nodes
|
|
1775
1811
|
}
|
|
1776
|
-
this.expect(types.braceL);
|
|
1777
|
-
while (!this.eat(types.braceR)) {
|
|
1812
|
+
this.expect(types$1.braceL);
|
|
1813
|
+
while (!this.eat(types$1.braceR)) {
|
|
1778
1814
|
if (!first) {
|
|
1779
|
-
this.expect(types.comma);
|
|
1780
|
-
if (this.afterTrailingComma(types.braceR)) { break }
|
|
1815
|
+
this.expect(types$1.comma);
|
|
1816
|
+
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
1781
1817
|
} else { first = false; }
|
|
1782
1818
|
|
|
1783
1819
|
var node$2 = this.startNode();
|
|
@@ -1795,12 +1831,12 @@
|
|
|
1795
1831
|
};
|
|
1796
1832
|
|
|
1797
1833
|
// Set `ExpressionStatement#directive` property for directive prologues.
|
|
1798
|
-
pp$
|
|
1834
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
1799
1835
|
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
|
|
1800
1836
|
statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
1801
1837
|
}
|
|
1802
1838
|
};
|
|
1803
|
-
pp$
|
|
1839
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
1804
1840
|
return (
|
|
1805
1841
|
statement.type === "ExpressionStatement" &&
|
|
1806
1842
|
statement.expression.type === "Literal" &&
|
|
@@ -1810,12 +1846,12 @@
|
|
|
1810
1846
|
)
|
|
1811
1847
|
};
|
|
1812
1848
|
|
|
1813
|
-
var pp$
|
|
1849
|
+
var pp$7 = Parser.prototype;
|
|
1814
1850
|
|
|
1815
1851
|
// Convert existing expression atom to assignable pattern
|
|
1816
1852
|
// if possible.
|
|
1817
1853
|
|
|
1818
|
-
pp$
|
|
1854
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
1819
1855
|
if (this.options.ecmaVersion >= 6 && node) {
|
|
1820
1856
|
switch (node.type) {
|
|
1821
1857
|
case "Identifier":
|
|
@@ -1896,7 +1932,7 @@
|
|
|
1896
1932
|
|
|
1897
1933
|
// Convert list of expression atoms to binding list.
|
|
1898
1934
|
|
|
1899
|
-
pp$
|
|
1935
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
1900
1936
|
var end = exprList.length;
|
|
1901
1937
|
for (var i = 0; i < end; i++) {
|
|
1902
1938
|
var elt = exprList[i];
|
|
@@ -1912,19 +1948,19 @@
|
|
|
1912
1948
|
|
|
1913
1949
|
// Parses spread element.
|
|
1914
1950
|
|
|
1915
|
-
pp$
|
|
1951
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
1916
1952
|
var node = this.startNode();
|
|
1917
1953
|
this.next();
|
|
1918
1954
|
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
1919
1955
|
return this.finishNode(node, "SpreadElement")
|
|
1920
1956
|
};
|
|
1921
1957
|
|
|
1922
|
-
pp$
|
|
1958
|
+
pp$7.parseRestBinding = function() {
|
|
1923
1959
|
var node = this.startNode();
|
|
1924
1960
|
this.next();
|
|
1925
1961
|
|
|
1926
1962
|
// RestElement inside of a function parameter must be an identifier
|
|
1927
|
-
if (this.options.ecmaVersion === 6 && this.type !== types.name)
|
|
1963
|
+
if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
|
|
1928
1964
|
{ this.unexpected(); }
|
|
1929
1965
|
|
|
1930
1966
|
node.argument = this.parseBindingAtom();
|
|
@@ -1934,36 +1970,36 @@
|
|
|
1934
1970
|
|
|
1935
1971
|
// Parses lvalue (assignable) atom.
|
|
1936
1972
|
|
|
1937
|
-
pp$
|
|
1973
|
+
pp$7.parseBindingAtom = function() {
|
|
1938
1974
|
if (this.options.ecmaVersion >= 6) {
|
|
1939
1975
|
switch (this.type) {
|
|
1940
|
-
case types.bracketL:
|
|
1976
|
+
case types$1.bracketL:
|
|
1941
1977
|
var node = this.startNode();
|
|
1942
1978
|
this.next();
|
|
1943
|
-
node.elements = this.parseBindingList(types.bracketR, true, true);
|
|
1979
|
+
node.elements = this.parseBindingList(types$1.bracketR, true, true);
|
|
1944
1980
|
return this.finishNode(node, "ArrayPattern")
|
|
1945
1981
|
|
|
1946
|
-
case types.braceL:
|
|
1982
|
+
case types$1.braceL:
|
|
1947
1983
|
return this.parseObj(true)
|
|
1948
1984
|
}
|
|
1949
1985
|
}
|
|
1950
1986
|
return this.parseIdent()
|
|
1951
1987
|
};
|
|
1952
1988
|
|
|
1953
|
-
pp$
|
|
1989
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
1954
1990
|
var elts = [], first = true;
|
|
1955
1991
|
while (!this.eat(close)) {
|
|
1956
1992
|
if (first) { first = false; }
|
|
1957
|
-
else { this.expect(types.comma); }
|
|
1958
|
-
if (allowEmpty && this.type === types.comma) {
|
|
1993
|
+
else { this.expect(types$1.comma); }
|
|
1994
|
+
if (allowEmpty && this.type === types$1.comma) {
|
|
1959
1995
|
elts.push(null);
|
|
1960
1996
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
1961
1997
|
break
|
|
1962
|
-
} else if (this.type === types.ellipsis) {
|
|
1998
|
+
} else if (this.type === types$1.ellipsis) {
|
|
1963
1999
|
var rest = this.parseRestBinding();
|
|
1964
2000
|
this.parseBindingListItem(rest);
|
|
1965
2001
|
elts.push(rest);
|
|
1966
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
2002
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
1967
2003
|
this.expect(close);
|
|
1968
2004
|
break
|
|
1969
2005
|
} else {
|
|
@@ -1975,15 +2011,15 @@
|
|
|
1975
2011
|
return elts
|
|
1976
2012
|
};
|
|
1977
2013
|
|
|
1978
|
-
pp$
|
|
2014
|
+
pp$7.parseBindingListItem = function(param) {
|
|
1979
2015
|
return param
|
|
1980
2016
|
};
|
|
1981
2017
|
|
|
1982
2018
|
// Parses assignment pattern around given atom if possible.
|
|
1983
2019
|
|
|
1984
|
-
pp$
|
|
2020
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
1985
2021
|
left = left || this.parseBindingAtom();
|
|
1986
|
-
if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }
|
|
2022
|
+
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
|
|
1987
2023
|
var node = this.startNodeAt(startPos, startLoc);
|
|
1988
2024
|
node.left = left;
|
|
1989
2025
|
node.right = this.parseMaybeAssign();
|
|
@@ -2054,7 +2090,7 @@
|
|
|
2054
2090
|
// duplicate argument names. checkClashes is ignored if the provided construct
|
|
2055
2091
|
// is an assignment (i.e., bindingType is BIND_NONE).
|
|
2056
2092
|
|
|
2057
|
-
pp$
|
|
2093
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
2058
2094
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
2059
2095
|
|
|
2060
2096
|
var isBind = bindingType !== BIND_NONE;
|
|
@@ -2092,7 +2128,7 @@
|
|
|
2092
2128
|
}
|
|
2093
2129
|
};
|
|
2094
2130
|
|
|
2095
|
-
pp$
|
|
2131
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
2096
2132
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
2097
2133
|
|
|
2098
2134
|
switch (expr.type) {
|
|
@@ -2117,7 +2153,7 @@
|
|
|
2117
2153
|
}
|
|
2118
2154
|
};
|
|
2119
2155
|
|
|
2120
|
-
pp$
|
|
2156
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
2121
2157
|
if ( bindingType === void 0 ) bindingType = BIND_NONE;
|
|
2122
2158
|
|
|
2123
2159
|
switch (expr.type) {
|
|
@@ -2139,16 +2175,170 @@
|
|
|
2139
2175
|
}
|
|
2140
2176
|
};
|
|
2141
2177
|
|
|
2178
|
+
// The algorithm used to determine whether a regexp can appear at a
|
|
2179
|
+
|
|
2180
|
+
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
2181
|
+
this.token = token;
|
|
2182
|
+
this.isExpr = !!isExpr;
|
|
2183
|
+
this.preserveSpace = !!preserveSpace;
|
|
2184
|
+
this.override = override;
|
|
2185
|
+
this.generator = !!generator;
|
|
2186
|
+
};
|
|
2187
|
+
|
|
2188
|
+
var types = {
|
|
2189
|
+
b_stat: new TokContext("{", false),
|
|
2190
|
+
b_expr: new TokContext("{", true),
|
|
2191
|
+
b_tmpl: new TokContext("${", false),
|
|
2192
|
+
p_stat: new TokContext("(", false),
|
|
2193
|
+
p_expr: new TokContext("(", true),
|
|
2194
|
+
q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
|
|
2195
|
+
f_stat: new TokContext("function", false),
|
|
2196
|
+
f_expr: new TokContext("function", true),
|
|
2197
|
+
f_expr_gen: new TokContext("function", true, false, null, true),
|
|
2198
|
+
f_gen: new TokContext("function", false, false, null, true)
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
var pp$6 = Parser.prototype;
|
|
2202
|
+
|
|
2203
|
+
pp$6.initialContext = function() {
|
|
2204
|
+
return [types.b_stat]
|
|
2205
|
+
};
|
|
2206
|
+
|
|
2207
|
+
pp$6.curContext = function() {
|
|
2208
|
+
return this.context[this.context.length - 1]
|
|
2209
|
+
};
|
|
2210
|
+
|
|
2211
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
2212
|
+
var parent = this.curContext();
|
|
2213
|
+
if (parent === types.f_expr || parent === types.f_stat)
|
|
2214
|
+
{ return true }
|
|
2215
|
+
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))
|
|
2216
|
+
{ return !parent.isExpr }
|
|
2217
|
+
|
|
2218
|
+
// The check for `tt.name && exprAllowed` detects whether we are
|
|
2219
|
+
// after a `yield` or `of` construct. See the `updateContext` for
|
|
2220
|
+
// `tt.name`.
|
|
2221
|
+
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
|
|
2222
|
+
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
2223
|
+
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
|
|
2224
|
+
{ return true }
|
|
2225
|
+
if (prevType === types$1.braceL)
|
|
2226
|
+
{ return parent === types.b_stat }
|
|
2227
|
+
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
|
|
2228
|
+
{ return false }
|
|
2229
|
+
return !this.exprAllowed
|
|
2230
|
+
};
|
|
2231
|
+
|
|
2232
|
+
pp$6.inGeneratorContext = function() {
|
|
2233
|
+
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
2234
|
+
var context = this.context[i];
|
|
2235
|
+
if (context.token === "function")
|
|
2236
|
+
{ return context.generator }
|
|
2237
|
+
}
|
|
2238
|
+
return false
|
|
2239
|
+
};
|
|
2240
|
+
|
|
2241
|
+
pp$6.updateContext = function(prevType) {
|
|
2242
|
+
var update, type = this.type;
|
|
2243
|
+
if (type.keyword && prevType === types$1.dot)
|
|
2244
|
+
{ this.exprAllowed = false; }
|
|
2245
|
+
else if (update = type.updateContext)
|
|
2246
|
+
{ update.call(this, prevType); }
|
|
2247
|
+
else
|
|
2248
|
+
{ this.exprAllowed = type.beforeExpr; }
|
|
2249
|
+
};
|
|
2250
|
+
|
|
2251
|
+
// Used to handle egde case when token context could not be inferred correctly in tokenize phase
|
|
2252
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
2253
|
+
if (this.curContext() !== tokenCtx) {
|
|
2254
|
+
this.context[this.context.length - 1] = tokenCtx;
|
|
2255
|
+
}
|
|
2256
|
+
};
|
|
2257
|
+
|
|
2258
|
+
// Token-specific context update code
|
|
2259
|
+
|
|
2260
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
2261
|
+
if (this.context.length === 1) {
|
|
2262
|
+
this.exprAllowed = true;
|
|
2263
|
+
return
|
|
2264
|
+
}
|
|
2265
|
+
var out = this.context.pop();
|
|
2266
|
+
if (out === types.b_stat && this.curContext().token === "function") {
|
|
2267
|
+
out = this.context.pop();
|
|
2268
|
+
}
|
|
2269
|
+
this.exprAllowed = !out.isExpr;
|
|
2270
|
+
};
|
|
2271
|
+
|
|
2272
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
2273
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
|
|
2274
|
+
this.exprAllowed = true;
|
|
2275
|
+
};
|
|
2276
|
+
|
|
2277
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
2278
|
+
this.context.push(types.b_tmpl);
|
|
2279
|
+
this.exprAllowed = true;
|
|
2280
|
+
};
|
|
2281
|
+
|
|
2282
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
2283
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
2284
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr);
|
|
2285
|
+
this.exprAllowed = true;
|
|
2286
|
+
};
|
|
2287
|
+
|
|
2288
|
+
types$1.incDec.updateContext = function() {
|
|
2289
|
+
// tokExprAllowed stays unchanged
|
|
2290
|
+
};
|
|
2291
|
+
|
|
2292
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
2293
|
+
if (prevType.beforeExpr && prevType !== types$1._else &&
|
|
2294
|
+
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
|
|
2295
|
+
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
2296
|
+
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
|
|
2297
|
+
{ this.context.push(types.f_expr); }
|
|
2298
|
+
else
|
|
2299
|
+
{ this.context.push(types.f_stat); }
|
|
2300
|
+
this.exprAllowed = false;
|
|
2301
|
+
};
|
|
2302
|
+
|
|
2303
|
+
types$1.backQuote.updateContext = function() {
|
|
2304
|
+
if (this.curContext() === types.q_tmpl)
|
|
2305
|
+
{ this.context.pop(); }
|
|
2306
|
+
else
|
|
2307
|
+
{ this.context.push(types.q_tmpl); }
|
|
2308
|
+
this.exprAllowed = false;
|
|
2309
|
+
};
|
|
2310
|
+
|
|
2311
|
+
types$1.star.updateContext = function(prevType) {
|
|
2312
|
+
if (prevType === types$1._function) {
|
|
2313
|
+
var index = this.context.length - 1;
|
|
2314
|
+
if (this.context[index] === types.f_expr)
|
|
2315
|
+
{ this.context[index] = types.f_expr_gen; }
|
|
2316
|
+
else
|
|
2317
|
+
{ this.context[index] = types.f_gen; }
|
|
2318
|
+
}
|
|
2319
|
+
this.exprAllowed = true;
|
|
2320
|
+
};
|
|
2321
|
+
|
|
2322
|
+
types$1.name.updateContext = function(prevType) {
|
|
2323
|
+
var allowed = false;
|
|
2324
|
+
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
|
|
2325
|
+
if (this.value === "of" && !this.exprAllowed ||
|
|
2326
|
+
this.value === "yield" && this.inGeneratorContext())
|
|
2327
|
+
{ allowed = true; }
|
|
2328
|
+
}
|
|
2329
|
+
this.exprAllowed = allowed;
|
|
2330
|
+
};
|
|
2331
|
+
|
|
2142
2332
|
// A recursive descent parser operates by defining functions for all
|
|
2143
2333
|
|
|
2144
|
-
var pp$
|
|
2334
|
+
var pp$5 = Parser.prototype;
|
|
2145
2335
|
|
|
2146
2336
|
// Check if property name clashes with already added.
|
|
2147
2337
|
// Object/class getters and setters are not allowed to clash —
|
|
2148
2338
|
// either with each other or with an init property — and in
|
|
2149
2339
|
// strict mode, init properties are also not allowed to be repeated.
|
|
2150
2340
|
|
|
2151
|
-
pp$
|
|
2341
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
2152
2342
|
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
|
|
2153
2343
|
{ return }
|
|
2154
2344
|
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
|
|
@@ -2165,10 +2355,12 @@
|
|
|
2165
2355
|
if (name === "__proto__" && kind === "init") {
|
|
2166
2356
|
if (propHash.proto) {
|
|
2167
2357
|
if (refDestructuringErrors) {
|
|
2168
|
-
if (refDestructuringErrors.doubleProto < 0)
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
} else {
|
|
2358
|
+
if (refDestructuringErrors.doubleProto < 0) {
|
|
2359
|
+
refDestructuringErrors.doubleProto = key.start;
|
|
2360
|
+
}
|
|
2361
|
+
} else {
|
|
2362
|
+
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
|
|
2363
|
+
}
|
|
2172
2364
|
}
|
|
2173
2365
|
propHash.proto = true;
|
|
2174
2366
|
}
|
|
@@ -2210,13 +2402,13 @@
|
|
|
2210
2402
|
// and object pattern might appear (so it's possible to raise
|
|
2211
2403
|
// delayed syntax error at correct position).
|
|
2212
2404
|
|
|
2213
|
-
pp$
|
|
2405
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
2214
2406
|
var startPos = this.start, startLoc = this.startLoc;
|
|
2215
2407
|
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
2216
|
-
if (this.type === types.comma) {
|
|
2408
|
+
if (this.type === types$1.comma) {
|
|
2217
2409
|
var node = this.startNodeAt(startPos, startLoc);
|
|
2218
2410
|
node.expressions = [expr];
|
|
2219
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
2411
|
+
while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
2220
2412
|
return this.finishNode(node, "SequenceExpression")
|
|
2221
2413
|
}
|
|
2222
2414
|
return expr
|
|
@@ -2225,7 +2417,7 @@
|
|
|
2225
2417
|
// Parse an assignment expression. This includes applications of
|
|
2226
2418
|
// operators like `+=`.
|
|
2227
2419
|
|
|
2228
|
-
pp$
|
|
2420
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
2229
2421
|
if (this.isContextual("yield")) {
|
|
2230
2422
|
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
2231
2423
|
// The tokenizer will assume an expression is allowed after
|
|
@@ -2233,10 +2425,11 @@
|
|
|
2233
2425
|
else { this.exprAllowed = false; }
|
|
2234
2426
|
}
|
|
2235
2427
|
|
|
2236
|
-
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1;
|
|
2428
|
+
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
2237
2429
|
if (refDestructuringErrors) {
|
|
2238
2430
|
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
|
|
2239
2431
|
oldTrailingComma = refDestructuringErrors.trailingComma;
|
|
2432
|
+
oldDoubleProto = refDestructuringErrors.doubleProto;
|
|
2240
2433
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
|
|
2241
2434
|
} else {
|
|
2242
2435
|
refDestructuringErrors = new DestructuringErrors;
|
|
@@ -2244,7 +2437,7 @@
|
|
|
2244
2437
|
}
|
|
2245
2438
|
|
|
2246
2439
|
var startPos = this.start, startLoc = this.startLoc;
|
|
2247
|
-
if (this.type === types.parenL || this.type === types.name) {
|
|
2440
|
+
if (this.type === types$1.parenL || this.type === types$1.name) {
|
|
2248
2441
|
this.potentialArrowAt = this.start;
|
|
2249
2442
|
this.potentialArrowInForAwait = forInit === "await";
|
|
2250
2443
|
}
|
|
@@ -2253,20 +2446,21 @@
|
|
|
2253
2446
|
if (this.type.isAssign) {
|
|
2254
2447
|
var node = this.startNodeAt(startPos, startLoc);
|
|
2255
2448
|
node.operator = this.value;
|
|
2256
|
-
if (this.type === types.eq)
|
|
2449
|
+
if (this.type === types$1.eq)
|
|
2257
2450
|
{ left = this.toAssignable(left, false, refDestructuringErrors); }
|
|
2258
2451
|
if (!ownDestructuringErrors) {
|
|
2259
2452
|
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
|
|
2260
2453
|
}
|
|
2261
2454
|
if (refDestructuringErrors.shorthandAssign >= left.start)
|
|
2262
2455
|
{ refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
|
|
2263
|
-
if (this.type === types.eq)
|
|
2456
|
+
if (this.type === types$1.eq)
|
|
2264
2457
|
{ this.checkLValPattern(left); }
|
|
2265
2458
|
else
|
|
2266
2459
|
{ this.checkLValSimple(left); }
|
|
2267
2460
|
node.left = left;
|
|
2268
2461
|
this.next();
|
|
2269
2462
|
node.right = this.parseMaybeAssign(forInit);
|
|
2463
|
+
if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
|
|
2270
2464
|
return this.finishNode(node, "AssignmentExpression")
|
|
2271
2465
|
} else {
|
|
2272
2466
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -2278,15 +2472,15 @@
|
|
|
2278
2472
|
|
|
2279
2473
|
// Parse a ternary conditional (`?:`) operator.
|
|
2280
2474
|
|
|
2281
|
-
pp$
|
|
2475
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
2282
2476
|
var startPos = this.start, startLoc = this.startLoc;
|
|
2283
2477
|
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
2284
2478
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
2285
|
-
if (this.eat(types.question)) {
|
|
2479
|
+
if (this.eat(types$1.question)) {
|
|
2286
2480
|
var node = this.startNodeAt(startPos, startLoc);
|
|
2287
2481
|
node.test = expr;
|
|
2288
2482
|
node.consequent = this.parseMaybeAssign();
|
|
2289
|
-
this.expect(types.colon);
|
|
2483
|
+
this.expect(types$1.colon);
|
|
2290
2484
|
node.alternate = this.parseMaybeAssign(forInit);
|
|
2291
2485
|
return this.finishNode(node, "ConditionalExpression")
|
|
2292
2486
|
}
|
|
@@ -2295,9 +2489,9 @@
|
|
|
2295
2489
|
|
|
2296
2490
|
// Start the precedence parser.
|
|
2297
2491
|
|
|
2298
|
-
pp$
|
|
2492
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
2299
2493
|
var startPos = this.start, startLoc = this.startLoc;
|
|
2300
|
-
var expr = this.parseMaybeUnary(refDestructuringErrors, false);
|
|
2494
|
+
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
|
|
2301
2495
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
2302
2496
|
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
|
|
2303
2497
|
};
|
|
@@ -2308,23 +2502,23 @@
|
|
|
2308
2502
|
// defer further parser to one of its callers when it encounters an
|
|
2309
2503
|
// operator that has a lower precedence than the set it is parsing.
|
|
2310
2504
|
|
|
2311
|
-
pp$
|
|
2505
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
2312
2506
|
var prec = this.type.binop;
|
|
2313
|
-
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
2507
|
+
if (prec != null && (!forInit || this.type !== types$1._in)) {
|
|
2314
2508
|
if (prec > minPrec) {
|
|
2315
|
-
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
2316
|
-
var coalesce = this.type === types.coalesce;
|
|
2509
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
|
|
2510
|
+
var coalesce = this.type === types$1.coalesce;
|
|
2317
2511
|
if (coalesce) {
|
|
2318
2512
|
// Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
|
|
2319
2513
|
// In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
|
|
2320
|
-
prec = types.logicalAND.binop;
|
|
2514
|
+
prec = types$1.logicalAND.binop;
|
|
2321
2515
|
}
|
|
2322
2516
|
var op = this.value;
|
|
2323
2517
|
this.next();
|
|
2324
2518
|
var startPos = this.start, startLoc = this.startLoc;
|
|
2325
|
-
var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, forInit);
|
|
2519
|
+
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
|
|
2326
2520
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
2327
|
-
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
2521
|
+
if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
|
|
2328
2522
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
2329
2523
|
}
|
|
2330
2524
|
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
@@ -2333,7 +2527,8 @@
|
|
|
2333
2527
|
return left
|
|
2334
2528
|
};
|
|
2335
2529
|
|
|
2336
|
-
pp$
|
|
2530
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
2531
|
+
if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
|
|
2337
2532
|
var node = this.startNodeAt(startPos, startLoc);
|
|
2338
2533
|
node.left = left;
|
|
2339
2534
|
node.operator = op;
|
|
@@ -2343,17 +2538,17 @@
|
|
|
2343
2538
|
|
|
2344
2539
|
// Parse unary operators, both prefix and postfix.
|
|
2345
2540
|
|
|
2346
|
-
pp$
|
|
2541
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
2347
2542
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
2348
2543
|
if (this.isContextual("await") && this.canAwait) {
|
|
2349
|
-
expr = this.parseAwait();
|
|
2544
|
+
expr = this.parseAwait(forInit);
|
|
2350
2545
|
sawUnary = true;
|
|
2351
2546
|
} else if (this.type.prefix) {
|
|
2352
|
-
var node = this.startNode(), update = this.type === types.incDec;
|
|
2547
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
2353
2548
|
node.operator = this.value;
|
|
2354
2549
|
node.prefix = true;
|
|
2355
2550
|
this.next();
|
|
2356
|
-
node.argument = this.parseMaybeUnary(null, true, update);
|
|
2551
|
+
node.argument = this.parseMaybeUnary(null, true, update, forInit);
|
|
2357
2552
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
2358
2553
|
if (update) { this.checkLValSimple(node.argument); }
|
|
2359
2554
|
else if (this.strict && node.operator === "delete" &&
|
|
@@ -2363,8 +2558,13 @@
|
|
|
2363
2558
|
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
2364
2559
|
else { sawUnary = true; }
|
|
2365
2560
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
2561
|
+
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
2562
|
+
if (forInit || this.privateNameStack.length === 0) { this.unexpected(); }
|
|
2563
|
+
expr = this.parsePrivateIdent();
|
|
2564
|
+
// only could be private fields in 'in', such as #x in obj
|
|
2565
|
+
if (this.type !== types$1._in) { this.unexpected(); }
|
|
2366
2566
|
} else {
|
|
2367
|
-
expr = this.parseExprSubscripts(refDestructuringErrors);
|
|
2567
|
+
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
|
|
2368
2568
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
2369
2569
|
while (this.type.postfix && !this.canInsertSemicolon()) {
|
|
2370
2570
|
var node$1 = this.startNodeAt(startPos, startLoc);
|
|
@@ -2377,11 +2577,11 @@
|
|
|
2377
2577
|
}
|
|
2378
2578
|
}
|
|
2379
2579
|
|
|
2380
|
-
if (!incDec && this.eat(types.starstar)) {
|
|
2580
|
+
if (!incDec && this.eat(types$1.starstar)) {
|
|
2381
2581
|
if (sawUnary)
|
|
2382
2582
|
{ this.unexpected(this.lastTokStart); }
|
|
2383
2583
|
else
|
|
2384
|
-
{ return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
|
|
2584
|
+
{ return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false) }
|
|
2385
2585
|
} else {
|
|
2386
2586
|
return expr
|
|
2387
2587
|
}
|
|
@@ -2396,12 +2596,12 @@
|
|
|
2396
2596
|
|
|
2397
2597
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
2398
2598
|
|
|
2399
|
-
pp$
|
|
2599
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
2400
2600
|
var startPos = this.start, startLoc = this.startLoc;
|
|
2401
|
-
var expr = this.parseExprAtom(refDestructuringErrors);
|
|
2601
|
+
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
2402
2602
|
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
2403
2603
|
{ return expr }
|
|
2404
|
-
var result = this.parseSubscripts(expr, startPos, startLoc);
|
|
2604
|
+
var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
|
|
2405
2605
|
if (refDestructuringErrors && result.type === "MemberExpression") {
|
|
2406
2606
|
if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
|
|
2407
2607
|
if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
|
|
@@ -2410,14 +2610,14 @@
|
|
|
2410
2610
|
return result
|
|
2411
2611
|
};
|
|
2412
2612
|
|
|
2413
|
-
pp$
|
|
2613
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
2414
2614
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
|
2415
2615
|
this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
|
|
2416
2616
|
this.potentialArrowAt === base.start;
|
|
2417
2617
|
var optionalChained = false;
|
|
2418
2618
|
|
|
2419
2619
|
while (true) {
|
|
2420
|
-
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained);
|
|
2620
|
+
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
|
|
2421
2621
|
|
|
2422
2622
|
if (element.optional) { optionalChained = true; }
|
|
2423
2623
|
if (element === base || element.type === "ArrowFunctionExpression") {
|
|
@@ -2433,19 +2633,19 @@
|
|
|
2433
2633
|
}
|
|
2434
2634
|
};
|
|
2435
2635
|
|
|
2436
|
-
pp$
|
|
2636
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
2437
2637
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
2438
|
-
var optional = optionalSupported && this.eat(types.questionDot);
|
|
2638
|
+
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
2439
2639
|
if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
|
|
2440
2640
|
|
|
2441
|
-
var computed = this.eat(types.bracketL);
|
|
2442
|
-
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
2641
|
+
var computed = this.eat(types$1.bracketL);
|
|
2642
|
+
if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
|
|
2443
2643
|
var node = this.startNodeAt(startPos, startLoc);
|
|
2444
2644
|
node.object = base;
|
|
2445
2645
|
if (computed) {
|
|
2446
2646
|
node.property = this.parseExpression();
|
|
2447
|
-
this.expect(types.bracketR);
|
|
2448
|
-
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
2647
|
+
this.expect(types$1.bracketR);
|
|
2648
|
+
} else if (this.type === types$1.privateId && base.type !== "Super") {
|
|
2449
2649
|
node.property = this.parsePrivateIdent();
|
|
2450
2650
|
} else {
|
|
2451
2651
|
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
@@ -2455,13 +2655,13 @@
|
|
|
2455
2655
|
node.optional = optional;
|
|
2456
2656
|
}
|
|
2457
2657
|
base = this.finishNode(node, "MemberExpression");
|
|
2458
|
-
} else if (!noCalls && this.eat(types.parenL)) {
|
|
2658
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
2459
2659
|
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
2460
2660
|
this.yieldPos = 0;
|
|
2461
2661
|
this.awaitPos = 0;
|
|
2462
2662
|
this.awaitIdentPos = 0;
|
|
2463
|
-
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
2464
|
-
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
2663
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
2664
|
+
if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
2465
2665
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
2466
2666
|
this.checkYieldAwaitInDefaultParams();
|
|
2467
2667
|
if (this.awaitIdentPos > 0)
|
|
@@ -2469,7 +2669,7 @@
|
|
|
2469
2669
|
this.yieldPos = oldYieldPos;
|
|
2470
2670
|
this.awaitPos = oldAwaitPos;
|
|
2471
2671
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
2472
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
|
|
2672
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
|
|
2473
2673
|
}
|
|
2474
2674
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
2475
2675
|
this.yieldPos = oldYieldPos || this.yieldPos;
|
|
@@ -2482,7 +2682,7 @@
|
|
|
2482
2682
|
node$1.optional = optional;
|
|
2483
2683
|
}
|
|
2484
2684
|
base = this.finishNode(node$1, "CallExpression");
|
|
2485
|
-
} else if (this.type === types.backQuote) {
|
|
2685
|
+
} else if (this.type === types$1.backQuote) {
|
|
2486
2686
|
if (optional || optionalChained) {
|
|
2487
2687
|
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
2488
2688
|
}
|
|
@@ -2499,19 +2699,19 @@
|
|
|
2499
2699
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
2500
2700
|
// or `{}`.
|
|
2501
2701
|
|
|
2502
|
-
pp$
|
|
2702
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
2503
2703
|
// If a division operator appears in an expression position, the
|
|
2504
2704
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
2505
|
-
if (this.type === types.slash) { this.readRegexp(); }
|
|
2705
|
+
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
2506
2706
|
|
|
2507
2707
|
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
2508
2708
|
switch (this.type) {
|
|
2509
|
-
case types._super:
|
|
2709
|
+
case types$1._super:
|
|
2510
2710
|
if (!this.allowSuper)
|
|
2511
2711
|
{ this.raise(this.start, "'super' keyword outside a method"); }
|
|
2512
2712
|
node = this.startNode();
|
|
2513
2713
|
this.next();
|
|
2514
|
-
if (this.type === types.parenL && !this.allowDirectSuper)
|
|
2714
|
+
if (this.type === types$1.parenL && !this.allowDirectSuper)
|
|
2515
2715
|
{ this.raise(node.start, "super() call outside constructor of a subclass"); }
|
|
2516
2716
|
// The `super` keyword can appear at below:
|
|
2517
2717
|
// SuperProperty:
|
|
@@ -2519,51 +2719,53 @@
|
|
|
2519
2719
|
// super . IdentifierName
|
|
2520
2720
|
// SuperCall:
|
|
2521
2721
|
// super ( Arguments )
|
|
2522
|
-
if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)
|
|
2722
|
+
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
|
|
2523
2723
|
{ this.unexpected(); }
|
|
2524
2724
|
return this.finishNode(node, "Super")
|
|
2525
2725
|
|
|
2526
|
-
case types._this:
|
|
2726
|
+
case types$1._this:
|
|
2527
2727
|
node = this.startNode();
|
|
2528
2728
|
this.next();
|
|
2529
2729
|
return this.finishNode(node, "ThisExpression")
|
|
2530
2730
|
|
|
2531
|
-
case types.name:
|
|
2731
|
+
case types$1.name:
|
|
2532
2732
|
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
|
|
2533
2733
|
var id = this.parseIdent(false);
|
|
2534
|
-
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function))
|
|
2535
|
-
|
|
2734
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
|
|
2735
|
+
this.overrideContext(types.f_expr);
|
|
2736
|
+
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
|
|
2737
|
+
}
|
|
2536
2738
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
2537
|
-
if (this.eat(types.arrow))
|
|
2538
|
-
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
|
|
2539
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
2739
|
+
if (this.eat(types$1.arrow))
|
|
2740
|
+
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
|
|
2741
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
|
|
2540
2742
|
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
2541
2743
|
id = this.parseIdent(false);
|
|
2542
|
-
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
2744
|
+
if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
|
|
2543
2745
|
{ this.unexpected(); }
|
|
2544
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)
|
|
2746
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
|
|
2545
2747
|
}
|
|
2546
2748
|
}
|
|
2547
2749
|
return id
|
|
2548
2750
|
|
|
2549
|
-
case types.regexp:
|
|
2751
|
+
case types$1.regexp:
|
|
2550
2752
|
var value = this.value;
|
|
2551
2753
|
node = this.parseLiteral(value.value);
|
|
2552
2754
|
node.regex = {pattern: value.pattern, flags: value.flags};
|
|
2553
2755
|
return node
|
|
2554
2756
|
|
|
2555
|
-
case types.num: case types.string:
|
|
2757
|
+
case types$1.num: case types$1.string:
|
|
2556
2758
|
return this.parseLiteral(this.value)
|
|
2557
2759
|
|
|
2558
|
-
case types._null: case types._true: case types._false:
|
|
2760
|
+
case types$1._null: case types$1._true: case types$1._false:
|
|
2559
2761
|
node = this.startNode();
|
|
2560
|
-
node.value = this.type === types._null ? null : this.type === types._true;
|
|
2762
|
+
node.value = this.type === types$1._null ? null : this.type === types$1._true;
|
|
2561
2763
|
node.raw = this.type.keyword;
|
|
2562
2764
|
this.next();
|
|
2563
2765
|
return this.finishNode(node, "Literal")
|
|
2564
2766
|
|
|
2565
|
-
case types.parenL:
|
|
2566
|
-
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow);
|
|
2767
|
+
case types$1.parenL:
|
|
2768
|
+
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
2567
2769
|
if (refDestructuringErrors) {
|
|
2568
2770
|
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
|
|
2569
2771
|
{ refDestructuringErrors.parenthesizedAssign = start; }
|
|
@@ -2572,30 +2774,31 @@
|
|
|
2572
2774
|
}
|
|
2573
2775
|
return expr
|
|
2574
2776
|
|
|
2575
|
-
case types.bracketL:
|
|
2777
|
+
case types$1.bracketL:
|
|
2576
2778
|
node = this.startNode();
|
|
2577
2779
|
this.next();
|
|
2578
|
-
node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);
|
|
2780
|
+
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
|
|
2579
2781
|
return this.finishNode(node, "ArrayExpression")
|
|
2580
2782
|
|
|
2581
|
-
case types.braceL:
|
|
2783
|
+
case types$1.braceL:
|
|
2784
|
+
this.overrideContext(types.b_expr);
|
|
2582
2785
|
return this.parseObj(false, refDestructuringErrors)
|
|
2583
2786
|
|
|
2584
|
-
case types._function:
|
|
2787
|
+
case types$1._function:
|
|
2585
2788
|
node = this.startNode();
|
|
2586
2789
|
this.next();
|
|
2587
2790
|
return this.parseFunction(node, 0)
|
|
2588
2791
|
|
|
2589
|
-
case types._class:
|
|
2792
|
+
case types$1._class:
|
|
2590
2793
|
return this.parseClass(this.startNode(), false)
|
|
2591
2794
|
|
|
2592
|
-
case types._new:
|
|
2795
|
+
case types$1._new:
|
|
2593
2796
|
return this.parseNew()
|
|
2594
2797
|
|
|
2595
|
-
case types.backQuote:
|
|
2798
|
+
case types$1.backQuote:
|
|
2596
2799
|
return this.parseTemplate()
|
|
2597
2800
|
|
|
2598
|
-
case types._import:
|
|
2801
|
+
case types$1._import:
|
|
2599
2802
|
if (this.options.ecmaVersion >= 11) {
|
|
2600
2803
|
return this.parseExprImport()
|
|
2601
2804
|
} else {
|
|
@@ -2607,7 +2810,7 @@
|
|
|
2607
2810
|
}
|
|
2608
2811
|
};
|
|
2609
2812
|
|
|
2610
|
-
pp$
|
|
2813
|
+
pp$5.parseExprImport = function() {
|
|
2611
2814
|
var node = this.startNode();
|
|
2612
2815
|
|
|
2613
2816
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -2616,9 +2819,9 @@
|
|
|
2616
2819
|
var meta = this.parseIdent(true);
|
|
2617
2820
|
|
|
2618
2821
|
switch (this.type) {
|
|
2619
|
-
case types.parenL:
|
|
2822
|
+
case types$1.parenL:
|
|
2620
2823
|
return this.parseDynamicImport(node)
|
|
2621
|
-
case types.dot:
|
|
2824
|
+
case types$1.dot:
|
|
2622
2825
|
node.meta = meta;
|
|
2623
2826
|
return this.parseImportMeta(node)
|
|
2624
2827
|
default:
|
|
@@ -2626,16 +2829,16 @@
|
|
|
2626
2829
|
}
|
|
2627
2830
|
};
|
|
2628
2831
|
|
|
2629
|
-
pp$
|
|
2832
|
+
pp$5.parseDynamicImport = function(node) {
|
|
2630
2833
|
this.next(); // skip `(`
|
|
2631
2834
|
|
|
2632
2835
|
// Parse node.source.
|
|
2633
2836
|
node.source = this.parseMaybeAssign();
|
|
2634
2837
|
|
|
2635
2838
|
// Verify ending.
|
|
2636
|
-
if (!this.eat(types.parenR)) {
|
|
2839
|
+
if (!this.eat(types$1.parenR)) {
|
|
2637
2840
|
var errorPos = this.start;
|
|
2638
|
-
if (this.eat(types.comma) && this.eat(types.parenR)) {
|
|
2841
|
+
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
|
|
2639
2842
|
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
|
|
2640
2843
|
} else {
|
|
2641
2844
|
this.unexpected(errorPos);
|
|
@@ -2645,7 +2848,7 @@
|
|
|
2645
2848
|
return this.finishNode(node, "ImportExpression")
|
|
2646
2849
|
};
|
|
2647
2850
|
|
|
2648
|
-
pp$
|
|
2851
|
+
pp$5.parseImportMeta = function(node) {
|
|
2649
2852
|
this.next(); // skip `.`
|
|
2650
2853
|
|
|
2651
2854
|
var containsEsc = this.containsEsc;
|
|
@@ -2661,7 +2864,7 @@
|
|
|
2661
2864
|
return this.finishNode(node, "MetaProperty")
|
|
2662
2865
|
};
|
|
2663
2866
|
|
|
2664
|
-
pp$
|
|
2867
|
+
pp$5.parseLiteral = function(value) {
|
|
2665
2868
|
var node = this.startNode();
|
|
2666
2869
|
node.value = value;
|
|
2667
2870
|
node.raw = this.input.slice(this.start, this.end);
|
|
@@ -2670,14 +2873,14 @@
|
|
|
2670
2873
|
return this.finishNode(node, "Literal")
|
|
2671
2874
|
};
|
|
2672
2875
|
|
|
2673
|
-
pp$
|
|
2674
|
-
this.expect(types.parenL);
|
|
2876
|
+
pp$5.parseParenExpression = function() {
|
|
2877
|
+
this.expect(types$1.parenL);
|
|
2675
2878
|
var val = this.parseExpression();
|
|
2676
|
-
this.expect(types.parenR);
|
|
2879
|
+
this.expect(types$1.parenR);
|
|
2677
2880
|
return val
|
|
2678
2881
|
};
|
|
2679
2882
|
|
|
2680
|
-
pp$
|
|
2883
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
2681
2884
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
2682
2885
|
if (this.options.ecmaVersion >= 6) {
|
|
2683
2886
|
this.next();
|
|
@@ -2688,29 +2891,29 @@
|
|
|
2688
2891
|
this.yieldPos = 0;
|
|
2689
2892
|
this.awaitPos = 0;
|
|
2690
2893
|
// Do not save awaitIdentPos to allow checking awaits nested in parameters
|
|
2691
|
-
while (this.type !== types.parenR) {
|
|
2692
|
-
first ? first = false : this.expect(types.comma);
|
|
2693
|
-
if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {
|
|
2894
|
+
while (this.type !== types$1.parenR) {
|
|
2895
|
+
first ? first = false : this.expect(types$1.comma);
|
|
2896
|
+
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
|
|
2694
2897
|
lastIsComma = true;
|
|
2695
2898
|
break
|
|
2696
|
-
} else if (this.type === types.ellipsis) {
|
|
2899
|
+
} else if (this.type === types$1.ellipsis) {
|
|
2697
2900
|
spreadStart = this.start;
|
|
2698
2901
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
2699
|
-
if (this.type === types.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
2902
|
+
if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
|
|
2700
2903
|
break
|
|
2701
2904
|
} else {
|
|
2702
2905
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
2703
2906
|
}
|
|
2704
2907
|
}
|
|
2705
|
-
var innerEndPos = this.
|
|
2706
|
-
this.expect(types.parenR);
|
|
2908
|
+
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
2909
|
+
this.expect(types$1.parenR);
|
|
2707
2910
|
|
|
2708
|
-
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
|
|
2911
|
+
if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
|
|
2709
2912
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
2710
2913
|
this.checkYieldAwaitInDefaultParams();
|
|
2711
2914
|
this.yieldPos = oldYieldPos;
|
|
2712
2915
|
this.awaitPos = oldAwaitPos;
|
|
2713
|
-
return this.parseParenArrowList(startPos, startLoc, exprList)
|
|
2916
|
+
return this.parseParenArrowList(startPos, startLoc, exprList, forInit)
|
|
2714
2917
|
}
|
|
2715
2918
|
|
|
2716
2919
|
if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
|
|
@@ -2739,12 +2942,12 @@
|
|
|
2739
2942
|
}
|
|
2740
2943
|
};
|
|
2741
2944
|
|
|
2742
|
-
pp$
|
|
2945
|
+
pp$5.parseParenItem = function(item) {
|
|
2743
2946
|
return item
|
|
2744
2947
|
};
|
|
2745
2948
|
|
|
2746
|
-
pp$
|
|
2747
|
-
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)
|
|
2949
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
2950
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
|
|
2748
2951
|
};
|
|
2749
2952
|
|
|
2750
2953
|
// New's precedence is slightly tricky. It must allow its argument to
|
|
@@ -2753,13 +2956,13 @@
|
|
|
2753
2956
|
// argument to parseSubscripts to prevent it from consuming the
|
|
2754
2957
|
// argument list.
|
|
2755
2958
|
|
|
2756
|
-
var empty
|
|
2959
|
+
var empty = [];
|
|
2757
2960
|
|
|
2758
|
-
pp$
|
|
2961
|
+
pp$5.parseNew = function() {
|
|
2759
2962
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
|
|
2760
2963
|
var node = this.startNode();
|
|
2761
2964
|
var meta = this.parseIdent(true);
|
|
2762
|
-
if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {
|
|
2965
|
+
if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
|
|
2763
2966
|
node.meta = meta;
|
|
2764
2967
|
var containsEsc = this.containsEsc;
|
|
2765
2968
|
node.property = this.parseIdent(true);
|
|
@@ -2767,27 +2970,27 @@
|
|
|
2767
2970
|
{ this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
|
|
2768
2971
|
if (containsEsc)
|
|
2769
2972
|
{ this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
|
|
2770
|
-
if (!this.
|
|
2771
|
-
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions"); }
|
|
2973
|
+
if (!this.allowNewDotTarget)
|
|
2974
|
+
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
2772
2975
|
return this.finishNode(node, "MetaProperty")
|
|
2773
2976
|
}
|
|
2774
|
-
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;
|
|
2775
|
-
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
|
|
2977
|
+
var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
|
|
2978
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
2776
2979
|
if (isImport && node.callee.type === "ImportExpression") {
|
|
2777
2980
|
this.raise(startPos, "Cannot use new with import()");
|
|
2778
2981
|
}
|
|
2779
|
-
if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }
|
|
2780
|
-
else { node.arguments = empty
|
|
2982
|
+
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
2983
|
+
else { node.arguments = empty; }
|
|
2781
2984
|
return this.finishNode(node, "NewExpression")
|
|
2782
2985
|
};
|
|
2783
2986
|
|
|
2784
2987
|
// Parse template expression.
|
|
2785
2988
|
|
|
2786
|
-
pp$
|
|
2989
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
2787
2990
|
var isTagged = ref.isTagged;
|
|
2788
2991
|
|
|
2789
2992
|
var elem = this.startNode();
|
|
2790
|
-
if (this.type === types.invalidTemplate) {
|
|
2993
|
+
if (this.type === types$1.invalidTemplate) {
|
|
2791
2994
|
if (!isTagged) {
|
|
2792
2995
|
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
2793
2996
|
}
|
|
@@ -2802,11 +3005,11 @@
|
|
|
2802
3005
|
};
|
|
2803
3006
|
}
|
|
2804
3007
|
this.next();
|
|
2805
|
-
elem.tail = this.type === types.backQuote;
|
|
3008
|
+
elem.tail = this.type === types$1.backQuote;
|
|
2806
3009
|
return this.finishNode(elem, "TemplateElement")
|
|
2807
3010
|
};
|
|
2808
3011
|
|
|
2809
|
-
pp$
|
|
3012
|
+
pp$5.parseTemplate = function(ref) {
|
|
2810
3013
|
if ( ref === void 0 ) ref = {};
|
|
2811
3014
|
var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
|
|
2812
3015
|
|
|
@@ -2816,32 +3019,32 @@
|
|
|
2816
3019
|
var curElt = this.parseTemplateElement({isTagged: isTagged});
|
|
2817
3020
|
node.quasis = [curElt];
|
|
2818
3021
|
while (!curElt.tail) {
|
|
2819
|
-
if (this.type === types.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
2820
|
-
this.expect(types.dollarBraceL);
|
|
3022
|
+
if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
|
|
3023
|
+
this.expect(types$1.dollarBraceL);
|
|
2821
3024
|
node.expressions.push(this.parseExpression());
|
|
2822
|
-
this.expect(types.braceR);
|
|
3025
|
+
this.expect(types$1.braceR);
|
|
2823
3026
|
node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
|
|
2824
3027
|
}
|
|
2825
3028
|
this.next();
|
|
2826
3029
|
return this.finishNode(node, "TemplateLiteral")
|
|
2827
3030
|
};
|
|
2828
3031
|
|
|
2829
|
-
pp$
|
|
3032
|
+
pp$5.isAsyncProp = function(prop) {
|
|
2830
3033
|
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
|
|
2831
|
-
(this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&
|
|
3034
|
+
(this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
|
|
2832
3035
|
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
|
|
2833
3036
|
};
|
|
2834
3037
|
|
|
2835
3038
|
// Parse an object literal or binding pattern.
|
|
2836
3039
|
|
|
2837
|
-
pp$
|
|
3040
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
2838
3041
|
var node = this.startNode(), first = true, propHash = {};
|
|
2839
3042
|
node.properties = [];
|
|
2840
3043
|
this.next();
|
|
2841
|
-
while (!this.eat(types.braceR)) {
|
|
3044
|
+
while (!this.eat(types$1.braceR)) {
|
|
2842
3045
|
if (!first) {
|
|
2843
|
-
this.expect(types.comma);
|
|
2844
|
-
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }
|
|
3046
|
+
this.expect(types$1.comma);
|
|
3047
|
+
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
|
|
2845
3048
|
} else { first = false; }
|
|
2846
3049
|
|
|
2847
3050
|
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
@@ -2851,18 +3054,18 @@
|
|
|
2851
3054
|
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
|
|
2852
3055
|
};
|
|
2853
3056
|
|
|
2854
|
-
pp$
|
|
3057
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
2855
3058
|
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
2856
|
-
if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {
|
|
3059
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
|
|
2857
3060
|
if (isPattern) {
|
|
2858
3061
|
prop.argument = this.parseIdent(false);
|
|
2859
|
-
if (this.type === types.comma) {
|
|
3062
|
+
if (this.type === types$1.comma) {
|
|
2860
3063
|
this.raise(this.start, "Comma is not permitted after the rest element");
|
|
2861
3064
|
}
|
|
2862
3065
|
return this.finishNode(prop, "RestElement")
|
|
2863
3066
|
}
|
|
2864
3067
|
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
2865
|
-
if (this.type === types.parenL && refDestructuringErrors) {
|
|
3068
|
+
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
2866
3069
|
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
2867
3070
|
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
2868
3071
|
}
|
|
@@ -2873,7 +3076,7 @@
|
|
|
2873
3076
|
// Parse argument.
|
|
2874
3077
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
2875
3078
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
2876
|
-
if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
3079
|
+
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
|
|
2877
3080
|
refDestructuringErrors.trailingComma = this.start;
|
|
2878
3081
|
}
|
|
2879
3082
|
// Finish
|
|
@@ -2887,13 +3090,13 @@
|
|
|
2887
3090
|
startLoc = this.startLoc;
|
|
2888
3091
|
}
|
|
2889
3092
|
if (!isPattern)
|
|
2890
|
-
{ isGenerator = this.eat(types.star); }
|
|
3093
|
+
{ isGenerator = this.eat(types$1.star); }
|
|
2891
3094
|
}
|
|
2892
3095
|
var containsEsc = this.containsEsc;
|
|
2893
3096
|
this.parsePropertyName(prop);
|
|
2894
3097
|
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
|
|
2895
3098
|
isAsync = true;
|
|
2896
|
-
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
|
|
3099
|
+
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
|
|
2897
3100
|
this.parsePropertyName(prop, refDestructuringErrors);
|
|
2898
3101
|
} else {
|
|
2899
3102
|
isAsync = false;
|
|
@@ -2902,14 +3105,14 @@
|
|
|
2902
3105
|
return this.finishNode(prop, "Property")
|
|
2903
3106
|
};
|
|
2904
3107
|
|
|
2905
|
-
pp$
|
|
2906
|
-
if ((isGenerator || isAsync) && this.type === types.colon)
|
|
3108
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
3109
|
+
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
2907
3110
|
{ this.unexpected(); }
|
|
2908
3111
|
|
|
2909
|
-
if (this.eat(types.colon)) {
|
|
3112
|
+
if (this.eat(types$1.colon)) {
|
|
2910
3113
|
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
|
|
2911
3114
|
prop.kind = "init";
|
|
2912
|
-
} else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {
|
|
3115
|
+
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
|
|
2913
3116
|
if (isPattern) { this.unexpected(); }
|
|
2914
3117
|
prop.kind = "init";
|
|
2915
3118
|
prop.method = true;
|
|
@@ -2917,7 +3120,7 @@
|
|
|
2917
3120
|
} else if (!isPattern && !containsEsc &&
|
|
2918
3121
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
|
2919
3122
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
2920
|
-
(this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq)) {
|
|
3123
|
+
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
2921
3124
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
2922
3125
|
prop.kind = prop.key.name;
|
|
2923
3126
|
this.parsePropertyName(prop);
|
|
@@ -2941,7 +3144,7 @@
|
|
|
2941
3144
|
prop.kind = "init";
|
|
2942
3145
|
if (isPattern) {
|
|
2943
3146
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
2944
|
-
} else if (this.type === types.eq && refDestructuringErrors) {
|
|
3147
|
+
} else if (this.type === types$1.eq && refDestructuringErrors) {
|
|
2945
3148
|
if (refDestructuringErrors.shorthandAssign < 0)
|
|
2946
3149
|
{ refDestructuringErrors.shorthandAssign = this.start; }
|
|
2947
3150
|
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
|
|
@@ -2952,23 +3155,23 @@
|
|
|
2952
3155
|
} else { this.unexpected(); }
|
|
2953
3156
|
};
|
|
2954
3157
|
|
|
2955
|
-
pp$
|
|
3158
|
+
pp$5.parsePropertyName = function(prop) {
|
|
2956
3159
|
if (this.options.ecmaVersion >= 6) {
|
|
2957
|
-
if (this.eat(types.bracketL)) {
|
|
3160
|
+
if (this.eat(types$1.bracketL)) {
|
|
2958
3161
|
prop.computed = true;
|
|
2959
3162
|
prop.key = this.parseMaybeAssign();
|
|
2960
|
-
this.expect(types.bracketR);
|
|
3163
|
+
this.expect(types$1.bracketR);
|
|
2961
3164
|
return prop.key
|
|
2962
3165
|
} else {
|
|
2963
3166
|
prop.computed = false;
|
|
2964
3167
|
}
|
|
2965
3168
|
}
|
|
2966
|
-
return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
3169
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
|
|
2967
3170
|
};
|
|
2968
3171
|
|
|
2969
3172
|
// Initialize empty function node.
|
|
2970
3173
|
|
|
2971
|
-
pp$
|
|
3174
|
+
pp$5.initFunction = function(node) {
|
|
2972
3175
|
node.id = null;
|
|
2973
3176
|
if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
|
|
2974
3177
|
if (this.options.ecmaVersion >= 8) { node.async = false; }
|
|
@@ -2976,7 +3179,7 @@
|
|
|
2976
3179
|
|
|
2977
3180
|
// Parse object or class method.
|
|
2978
3181
|
|
|
2979
|
-
pp$
|
|
3182
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
2980
3183
|
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
2981
3184
|
|
|
2982
3185
|
this.initFunction(node);
|
|
@@ -2990,10 +3193,10 @@
|
|
|
2990
3193
|
this.awaitIdentPos = 0;
|
|
2991
3194
|
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
|
|
2992
3195
|
|
|
2993
|
-
this.expect(types.parenL);
|
|
2994
|
-
node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);
|
|
3196
|
+
this.expect(types$1.parenL);
|
|
3197
|
+
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
|
|
2995
3198
|
this.checkYieldAwaitInDefaultParams();
|
|
2996
|
-
this.parseFunctionBody(node, false, true);
|
|
3199
|
+
this.parseFunctionBody(node, false, true, false);
|
|
2997
3200
|
|
|
2998
3201
|
this.yieldPos = oldYieldPos;
|
|
2999
3202
|
this.awaitPos = oldAwaitPos;
|
|
@@ -3003,7 +3206,7 @@
|
|
|
3003
3206
|
|
|
3004
3207
|
// Parse arrow function expression with given parameters.
|
|
3005
3208
|
|
|
3006
|
-
pp$
|
|
3209
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
3007
3210
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
3008
3211
|
|
|
3009
3212
|
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
|
|
@@ -3015,7 +3218,7 @@
|
|
|
3015
3218
|
this.awaitIdentPos = 0;
|
|
3016
3219
|
|
|
3017
3220
|
node.params = this.toAssignableList(params, true);
|
|
3018
|
-
this.parseFunctionBody(node, true, false);
|
|
3221
|
+
this.parseFunctionBody(node, true, false, forInit);
|
|
3019
3222
|
|
|
3020
3223
|
this.yieldPos = oldYieldPos;
|
|
3021
3224
|
this.awaitPos = oldAwaitPos;
|
|
@@ -3025,12 +3228,12 @@
|
|
|
3025
3228
|
|
|
3026
3229
|
// Parse function body and check parameters.
|
|
3027
3230
|
|
|
3028
|
-
pp$
|
|
3029
|
-
var isExpression = isArrowFunction && this.type !== types.braceL;
|
|
3231
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
3232
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL;
|
|
3030
3233
|
var oldStrict = this.strict, useStrict = false;
|
|
3031
3234
|
|
|
3032
3235
|
if (isExpression) {
|
|
3033
|
-
node.body = this.parseMaybeAssign();
|
|
3236
|
+
node.body = this.parseMaybeAssign(forInit);
|
|
3034
3237
|
node.expression = true;
|
|
3035
3238
|
this.checkParams(node, false);
|
|
3036
3239
|
} else {
|
|
@@ -3062,7 +3265,7 @@
|
|
|
3062
3265
|
this.exitScope();
|
|
3063
3266
|
};
|
|
3064
3267
|
|
|
3065
|
-
pp$
|
|
3268
|
+
pp$5.isSimpleParamList = function(params) {
|
|
3066
3269
|
for (var i = 0, list = params; i < list.length; i += 1)
|
|
3067
3270
|
{
|
|
3068
3271
|
var param = list[i];
|
|
@@ -3075,7 +3278,7 @@
|
|
|
3075
3278
|
// Checks function params for various disallowed patterns such as using "eval"
|
|
3076
3279
|
// or "arguments" and duplicate parameters.
|
|
3077
3280
|
|
|
3078
|
-
pp$
|
|
3281
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
3079
3282
|
var nameHash = Object.create(null);
|
|
3080
3283
|
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
3081
3284
|
{
|
|
@@ -3091,20 +3294,20 @@
|
|
|
3091
3294
|
// nothing in between them to be parsed as `null` (which is needed
|
|
3092
3295
|
// for array literals).
|
|
3093
3296
|
|
|
3094
|
-
pp$
|
|
3297
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
3095
3298
|
var elts = [], first = true;
|
|
3096
3299
|
while (!this.eat(close)) {
|
|
3097
3300
|
if (!first) {
|
|
3098
|
-
this.expect(types.comma);
|
|
3301
|
+
this.expect(types$1.comma);
|
|
3099
3302
|
if (allowTrailingComma && this.afterTrailingComma(close)) { break }
|
|
3100
3303
|
} else { first = false; }
|
|
3101
3304
|
|
|
3102
3305
|
var elt = (void 0);
|
|
3103
|
-
if (allowEmpty && this.type === types.comma)
|
|
3306
|
+
if (allowEmpty && this.type === types$1.comma)
|
|
3104
3307
|
{ elt = null; }
|
|
3105
|
-
else if (this.type === types.ellipsis) {
|
|
3308
|
+
else if (this.type === types$1.ellipsis) {
|
|
3106
3309
|
elt = this.parseSpread(refDestructuringErrors);
|
|
3107
|
-
if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)
|
|
3310
|
+
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
|
|
3108
3311
|
{ refDestructuringErrors.trailingComma = this.start; }
|
|
3109
3312
|
} else {
|
|
3110
3313
|
elt = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
@@ -3114,7 +3317,7 @@
|
|
|
3114
3317
|
return elts
|
|
3115
3318
|
};
|
|
3116
3319
|
|
|
3117
|
-
pp$
|
|
3320
|
+
pp$5.checkUnreserved = function(ref) {
|
|
3118
3321
|
var start = ref.start;
|
|
3119
3322
|
var end = ref.end;
|
|
3120
3323
|
var name = ref.name;
|
|
@@ -3125,6 +3328,8 @@
|
|
|
3125
3328
|
{ this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
|
|
3126
3329
|
if (this.currentThisScope().inClassFieldInit && name === "arguments")
|
|
3127
3330
|
{ this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
|
|
3331
|
+
if (this.inClassStaticBlock && (name === "arguments" || name === "await"))
|
|
3332
|
+
{ this.raise(start, ("Cannot use " + name + " in class static initialization block")); }
|
|
3128
3333
|
if (this.keywords.test(name))
|
|
3129
3334
|
{ this.raise(start, ("Unexpected keyword '" + name + "'")); }
|
|
3130
3335
|
if (this.options.ecmaVersion < 6 &&
|
|
@@ -3141,9 +3346,9 @@
|
|
|
3141
3346
|
// when parsing properties), it will also convert keywords into
|
|
3142
3347
|
// identifiers.
|
|
3143
3348
|
|
|
3144
|
-
pp$
|
|
3349
|
+
pp$5.parseIdent = function(liberal, isBinding) {
|
|
3145
3350
|
var node = this.startNode();
|
|
3146
|
-
if (this.type === types.name) {
|
|
3351
|
+
if (this.type === types$1.name) {
|
|
3147
3352
|
node.name = this.value;
|
|
3148
3353
|
} else if (this.type.keyword) {
|
|
3149
3354
|
node.name = this.type.keyword;
|
|
@@ -3169,9 +3374,9 @@
|
|
|
3169
3374
|
return node
|
|
3170
3375
|
};
|
|
3171
3376
|
|
|
3172
|
-
pp$
|
|
3377
|
+
pp$5.parsePrivateIdent = function() {
|
|
3173
3378
|
var node = this.startNode();
|
|
3174
|
-
if (this.type === types.privateId) {
|
|
3379
|
+
if (this.type === types$1.privateId) {
|
|
3175
3380
|
node.name = this.value;
|
|
3176
3381
|
} else {
|
|
3177
3382
|
this.unexpected();
|
|
@@ -3191,27 +3396,27 @@
|
|
|
3191
3396
|
|
|
3192
3397
|
// Parses yield expression inside generator.
|
|
3193
3398
|
|
|
3194
|
-
pp$
|
|
3399
|
+
pp$5.parseYield = function(forInit) {
|
|
3195
3400
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
3196
3401
|
|
|
3197
3402
|
var node = this.startNode();
|
|
3198
3403
|
this.next();
|
|
3199
|
-
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
|
3404
|
+
if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
|
|
3200
3405
|
node.delegate = false;
|
|
3201
3406
|
node.argument = null;
|
|
3202
3407
|
} else {
|
|
3203
|
-
node.delegate = this.eat(types.star);
|
|
3408
|
+
node.delegate = this.eat(types$1.star);
|
|
3204
3409
|
node.argument = this.parseMaybeAssign(forInit);
|
|
3205
3410
|
}
|
|
3206
3411
|
return this.finishNode(node, "YieldExpression")
|
|
3207
3412
|
};
|
|
3208
3413
|
|
|
3209
|
-
pp$
|
|
3414
|
+
pp$5.parseAwait = function(forInit) {
|
|
3210
3415
|
if (!this.awaitPos) { this.awaitPos = this.start; }
|
|
3211
3416
|
|
|
3212
3417
|
var node = this.startNode();
|
|
3213
3418
|
this.next();
|
|
3214
|
-
node.argument = this.parseMaybeUnary(null, true);
|
|
3419
|
+
node.argument = this.parseMaybeUnary(null, true, false, forInit);
|
|
3215
3420
|
return this.finishNode(node, "AwaitExpression")
|
|
3216
3421
|
};
|
|
3217
3422
|
|
|
@@ -3239,7 +3444,7 @@
|
|
|
3239
3444
|
}
|
|
3240
3445
|
};
|
|
3241
3446
|
|
|
3242
|
-
var pp$
|
|
3447
|
+
var pp$3 = Parser.prototype;
|
|
3243
3448
|
|
|
3244
3449
|
var Scope = function Scope(flags) {
|
|
3245
3450
|
this.flags = flags;
|
|
@@ -3255,22 +3460,22 @@
|
|
|
3255
3460
|
|
|
3256
3461
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
3257
3462
|
|
|
3258
|
-
pp$
|
|
3463
|
+
pp$3.enterScope = function(flags) {
|
|
3259
3464
|
this.scopeStack.push(new Scope(flags));
|
|
3260
3465
|
};
|
|
3261
3466
|
|
|
3262
|
-
pp$
|
|
3467
|
+
pp$3.exitScope = function() {
|
|
3263
3468
|
this.scopeStack.pop();
|
|
3264
3469
|
};
|
|
3265
3470
|
|
|
3266
3471
|
// The spec says:
|
|
3267
3472
|
// > At the top level of a function, or script, function declarations are
|
|
3268
3473
|
// > treated like var declarations rather than like lexical declarations.
|
|
3269
|
-
pp$
|
|
3474
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
3270
3475
|
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
|
|
3271
3476
|
};
|
|
3272
3477
|
|
|
3273
|
-
pp$
|
|
3478
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
3274
3479
|
var redeclared = false;
|
|
3275
3480
|
if (bindingType === BIND_LEXICAL) {
|
|
3276
3481
|
var scope = this.currentScope();
|
|
@@ -3305,7 +3510,7 @@
|
|
|
3305
3510
|
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
|
|
3306
3511
|
};
|
|
3307
3512
|
|
|
3308
|
-
pp$
|
|
3513
|
+
pp$3.checkLocalExport = function(id) {
|
|
3309
3514
|
// scope.functions must be empty as Module code is always strict.
|
|
3310
3515
|
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
|
|
3311
3516
|
this.scopeStack[0].var.indexOf(id.name) === -1) {
|
|
@@ -3313,11 +3518,11 @@
|
|
|
3313
3518
|
}
|
|
3314
3519
|
};
|
|
3315
3520
|
|
|
3316
|
-
pp$
|
|
3521
|
+
pp$3.currentScope = function() {
|
|
3317
3522
|
return this.scopeStack[this.scopeStack.length - 1]
|
|
3318
3523
|
};
|
|
3319
3524
|
|
|
3320
|
-
pp$
|
|
3525
|
+
pp$3.currentVarScope = function() {
|
|
3321
3526
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
3322
3527
|
var scope = this.scopeStack[i];
|
|
3323
3528
|
if (scope.flags & SCOPE_VAR) { return scope }
|
|
@@ -3325,7 +3530,7 @@
|
|
|
3325
3530
|
};
|
|
3326
3531
|
|
|
3327
3532
|
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
|
|
3328
|
-
pp$
|
|
3533
|
+
pp$3.currentThisScope = function() {
|
|
3329
3534
|
for (var i = this.scopeStack.length - 1;; i--) {
|
|
3330
3535
|
var scope = this.scopeStack[i];
|
|
3331
3536
|
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
|
|
@@ -3346,13 +3551,13 @@
|
|
|
3346
3551
|
|
|
3347
3552
|
// Start an AST node, attaching a start offset.
|
|
3348
3553
|
|
|
3349
|
-
var pp$
|
|
3554
|
+
var pp$2 = Parser.prototype;
|
|
3350
3555
|
|
|
3351
|
-
pp$
|
|
3556
|
+
pp$2.startNode = function() {
|
|
3352
3557
|
return new Node(this, this.start, this.startLoc)
|
|
3353
3558
|
};
|
|
3354
3559
|
|
|
3355
|
-
pp$
|
|
3560
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
3356
3561
|
return new Node(this, pos, loc)
|
|
3357
3562
|
};
|
|
3358
3563
|
|
|
@@ -3368,165 +3573,22 @@
|
|
|
3368
3573
|
return node
|
|
3369
3574
|
}
|
|
3370
3575
|
|
|
3371
|
-
pp$
|
|
3576
|
+
pp$2.finishNode = function(node, type) {
|
|
3372
3577
|
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
|
|
3373
3578
|
};
|
|
3374
3579
|
|
|
3375
3580
|
// Finish node at given position
|
|
3376
3581
|
|
|
3377
|
-
pp$
|
|
3582
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
3378
3583
|
return finishNodeAt.call(this, node, type, pos, loc)
|
|
3379
3584
|
};
|
|
3380
3585
|
|
|
3381
|
-
pp$
|
|
3586
|
+
pp$2.copyNode = function(node) {
|
|
3382
3587
|
var newNode = new Node(this, node.start, this.startLoc);
|
|
3383
3588
|
for (var prop in node) { newNode[prop] = node[prop]; }
|
|
3384
3589
|
return newNode
|
|
3385
3590
|
};
|
|
3386
3591
|
|
|
3387
|
-
// The algorithm used to determine whether a regexp can appear at a
|
|
3388
|
-
|
|
3389
|
-
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
3390
|
-
this.token = token;
|
|
3391
|
-
this.isExpr = !!isExpr;
|
|
3392
|
-
this.preserveSpace = !!preserveSpace;
|
|
3393
|
-
this.override = override;
|
|
3394
|
-
this.generator = !!generator;
|
|
3395
|
-
};
|
|
3396
|
-
|
|
3397
|
-
var types$1 = {
|
|
3398
|
-
b_stat: new TokContext("{", false),
|
|
3399
|
-
b_expr: new TokContext("{", true),
|
|
3400
|
-
b_tmpl: new TokContext("${", false),
|
|
3401
|
-
p_stat: new TokContext("(", false),
|
|
3402
|
-
p_expr: new TokContext("(", true),
|
|
3403
|
-
q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
|
|
3404
|
-
f_stat: new TokContext("function", false),
|
|
3405
|
-
f_expr: new TokContext("function", true),
|
|
3406
|
-
f_expr_gen: new TokContext("function", true, false, null, true),
|
|
3407
|
-
f_gen: new TokContext("function", false, false, null, true)
|
|
3408
|
-
};
|
|
3409
|
-
|
|
3410
|
-
var pp$7 = Parser.prototype;
|
|
3411
|
-
|
|
3412
|
-
pp$7.initialContext = function() {
|
|
3413
|
-
return [types$1.b_stat]
|
|
3414
|
-
};
|
|
3415
|
-
|
|
3416
|
-
pp$7.braceIsBlock = function(prevType) {
|
|
3417
|
-
var parent = this.curContext();
|
|
3418
|
-
if (parent === types$1.f_expr || parent === types$1.f_stat)
|
|
3419
|
-
{ return true }
|
|
3420
|
-
if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))
|
|
3421
|
-
{ return !parent.isExpr }
|
|
3422
|
-
|
|
3423
|
-
// The check for `tt.name && exprAllowed` detects whether we are
|
|
3424
|
-
// after a `yield` or `of` construct. See the `updateContext` for
|
|
3425
|
-
// `tt.name`.
|
|
3426
|
-
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
|
3427
|
-
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
|
3428
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
|
3429
|
-
{ return true }
|
|
3430
|
-
if (prevType === types.braceL)
|
|
3431
|
-
{ return parent === types$1.b_stat }
|
|
3432
|
-
if (prevType === types._var || prevType === types._const || prevType === types.name)
|
|
3433
|
-
{ return false }
|
|
3434
|
-
return !this.exprAllowed
|
|
3435
|
-
};
|
|
3436
|
-
|
|
3437
|
-
pp$7.inGeneratorContext = function() {
|
|
3438
|
-
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
3439
|
-
var context = this.context[i];
|
|
3440
|
-
if (context.token === "function")
|
|
3441
|
-
{ return context.generator }
|
|
3442
|
-
}
|
|
3443
|
-
return false
|
|
3444
|
-
};
|
|
3445
|
-
|
|
3446
|
-
pp$7.updateContext = function(prevType) {
|
|
3447
|
-
var update, type = this.type;
|
|
3448
|
-
if (type.keyword && prevType === types.dot)
|
|
3449
|
-
{ this.exprAllowed = false; }
|
|
3450
|
-
else if (update = type.updateContext)
|
|
3451
|
-
{ update.call(this, prevType); }
|
|
3452
|
-
else
|
|
3453
|
-
{ this.exprAllowed = type.beforeExpr; }
|
|
3454
|
-
};
|
|
3455
|
-
|
|
3456
|
-
// Token-specific context update code
|
|
3457
|
-
|
|
3458
|
-
types.parenR.updateContext = types.braceR.updateContext = function() {
|
|
3459
|
-
if (this.context.length === 1) {
|
|
3460
|
-
this.exprAllowed = true;
|
|
3461
|
-
return
|
|
3462
|
-
}
|
|
3463
|
-
var out = this.context.pop();
|
|
3464
|
-
if (out === types$1.b_stat && this.curContext().token === "function") {
|
|
3465
|
-
out = this.context.pop();
|
|
3466
|
-
}
|
|
3467
|
-
this.exprAllowed = !out.isExpr;
|
|
3468
|
-
};
|
|
3469
|
-
|
|
3470
|
-
types.braceL.updateContext = function(prevType) {
|
|
3471
|
-
this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);
|
|
3472
|
-
this.exprAllowed = true;
|
|
3473
|
-
};
|
|
3474
|
-
|
|
3475
|
-
types.dollarBraceL.updateContext = function() {
|
|
3476
|
-
this.context.push(types$1.b_tmpl);
|
|
3477
|
-
this.exprAllowed = true;
|
|
3478
|
-
};
|
|
3479
|
-
|
|
3480
|
-
types.parenL.updateContext = function(prevType) {
|
|
3481
|
-
var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
|
|
3482
|
-
this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);
|
|
3483
|
-
this.exprAllowed = true;
|
|
3484
|
-
};
|
|
3485
|
-
|
|
3486
|
-
types.incDec.updateContext = function() {
|
|
3487
|
-
// tokExprAllowed stays unchanged
|
|
3488
|
-
};
|
|
3489
|
-
|
|
3490
|
-
types._function.updateContext = types._class.updateContext = function(prevType) {
|
|
3491
|
-
if (prevType.beforeExpr && prevType !== types._else &&
|
|
3492
|
-
!(prevType === types.semi && this.curContext() !== types$1.p_stat) &&
|
|
3493
|
-
!(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
|
|
3494
|
-
!((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))
|
|
3495
|
-
{ this.context.push(types$1.f_expr); }
|
|
3496
|
-
else
|
|
3497
|
-
{ this.context.push(types$1.f_stat); }
|
|
3498
|
-
this.exprAllowed = false;
|
|
3499
|
-
};
|
|
3500
|
-
|
|
3501
|
-
types.backQuote.updateContext = function() {
|
|
3502
|
-
if (this.curContext() === types$1.q_tmpl)
|
|
3503
|
-
{ this.context.pop(); }
|
|
3504
|
-
else
|
|
3505
|
-
{ this.context.push(types$1.q_tmpl); }
|
|
3506
|
-
this.exprAllowed = false;
|
|
3507
|
-
};
|
|
3508
|
-
|
|
3509
|
-
types.star.updateContext = function(prevType) {
|
|
3510
|
-
if (prevType === types._function) {
|
|
3511
|
-
var index = this.context.length - 1;
|
|
3512
|
-
if (this.context[index] === types$1.f_expr)
|
|
3513
|
-
{ this.context[index] = types$1.f_expr_gen; }
|
|
3514
|
-
else
|
|
3515
|
-
{ this.context[index] = types$1.f_gen; }
|
|
3516
|
-
}
|
|
3517
|
-
this.exprAllowed = true;
|
|
3518
|
-
};
|
|
3519
|
-
|
|
3520
|
-
types.name.updateContext = function(prevType) {
|
|
3521
|
-
var allowed = false;
|
|
3522
|
-
if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {
|
|
3523
|
-
if (this.value === "of" && !this.exprAllowed ||
|
|
3524
|
-
this.value === "yield" && this.inGeneratorContext())
|
|
3525
|
-
{ allowed = true; }
|
|
3526
|
-
}
|
|
3527
|
-
this.exprAllowed = allowed;
|
|
3528
|
-
};
|
|
3529
|
-
|
|
3530
3592
|
// This file contains Unicode properties extracted from the ECMAScript
|
|
3531
3593
|
// specification. The lists are extracted like so:
|
|
3532
3594
|
// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
|
|
@@ -3578,7 +3640,7 @@
|
|
|
3578
3640
|
buildUnicodeData(11);
|
|
3579
3641
|
buildUnicodeData(12);
|
|
3580
3642
|
|
|
3581
|
-
var pp$
|
|
3643
|
+
var pp$1 = Parser.prototype;
|
|
3582
3644
|
|
|
3583
3645
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
3584
3646
|
this.parser = parser;
|
|
@@ -3674,7 +3736,7 @@
|
|
|
3674
3736
|
return false
|
|
3675
3737
|
};
|
|
3676
3738
|
|
|
3677
|
-
function codePointToString(ch) {
|
|
3739
|
+
function codePointToString$1(ch) {
|
|
3678
3740
|
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
3679
3741
|
ch -= 0x10000;
|
|
3680
3742
|
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
@@ -3686,7 +3748,7 @@
|
|
|
3686
3748
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
3687
3749
|
* @returns {void}
|
|
3688
3750
|
*/
|
|
3689
|
-
pp$
|
|
3751
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
3690
3752
|
var validFlags = state.validFlags;
|
|
3691
3753
|
var flags = state.flags;
|
|
3692
3754
|
|
|
@@ -3707,7 +3769,7 @@
|
|
|
3707
3769
|
* @param {RegExpValidationState} state The state to validate RegExp.
|
|
3708
3770
|
* @returns {void}
|
|
3709
3771
|
*/
|
|
3710
|
-
pp$
|
|
3772
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
3711
3773
|
this.regexp_pattern(state);
|
|
3712
3774
|
|
|
3713
3775
|
// The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
|
|
@@ -3722,7 +3784,7 @@
|
|
|
3722
3784
|
};
|
|
3723
3785
|
|
|
3724
3786
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
|
|
3725
|
-
pp$
|
|
3787
|
+
pp$1.regexp_pattern = function(state) {
|
|
3726
3788
|
state.pos = 0;
|
|
3727
3789
|
state.lastIntValue = 0;
|
|
3728
3790
|
state.lastStringValue = "";
|
|
@@ -3756,7 +3818,7 @@
|
|
|
3756
3818
|
};
|
|
3757
3819
|
|
|
3758
3820
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
|
|
3759
|
-
pp$
|
|
3821
|
+
pp$1.regexp_disjunction = function(state) {
|
|
3760
3822
|
this.regexp_alternative(state);
|
|
3761
3823
|
while (state.eat(0x7C /* | */)) {
|
|
3762
3824
|
this.regexp_alternative(state);
|
|
@@ -3772,13 +3834,13 @@
|
|
|
3772
3834
|
};
|
|
3773
3835
|
|
|
3774
3836
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
|
|
3775
|
-
pp$
|
|
3837
|
+
pp$1.regexp_alternative = function(state) {
|
|
3776
3838
|
while (state.pos < state.source.length && this.regexp_eatTerm(state))
|
|
3777
3839
|
{ }
|
|
3778
3840
|
};
|
|
3779
3841
|
|
|
3780
3842
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
|
|
3781
|
-
pp$
|
|
3843
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
3782
3844
|
if (this.regexp_eatAssertion(state)) {
|
|
3783
3845
|
// Handle `QuantifiableAssertion Quantifier` alternative.
|
|
3784
3846
|
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
|
|
@@ -3801,7 +3863,7 @@
|
|
|
3801
3863
|
};
|
|
3802
3864
|
|
|
3803
3865
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
|
|
3804
|
-
pp$
|
|
3866
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
3805
3867
|
var start = state.pos;
|
|
3806
3868
|
state.lastAssertionIsQuantifiable = false;
|
|
3807
3869
|
|
|
@@ -3839,7 +3901,7 @@
|
|
|
3839
3901
|
};
|
|
3840
3902
|
|
|
3841
3903
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
|
|
3842
|
-
pp$
|
|
3904
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
3843
3905
|
if ( noError === void 0 ) noError = false;
|
|
3844
3906
|
|
|
3845
3907
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
@@ -3850,7 +3912,7 @@
|
|
|
3850
3912
|
};
|
|
3851
3913
|
|
|
3852
3914
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
|
|
3853
|
-
pp$
|
|
3915
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
3854
3916
|
return (
|
|
3855
3917
|
state.eat(0x2A /* * */) ||
|
|
3856
3918
|
state.eat(0x2B /* + */) ||
|
|
@@ -3858,7 +3920,7 @@
|
|
|
3858
3920
|
this.regexp_eatBracedQuantifier(state, noError)
|
|
3859
3921
|
)
|
|
3860
3922
|
};
|
|
3861
|
-
pp$
|
|
3923
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
3862
3924
|
var start = state.pos;
|
|
3863
3925
|
if (state.eat(0x7B /* { */)) {
|
|
3864
3926
|
var min = 0, max = -1;
|
|
@@ -3884,7 +3946,7 @@
|
|
|
3884
3946
|
};
|
|
3885
3947
|
|
|
3886
3948
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
|
|
3887
|
-
pp$
|
|
3949
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
3888
3950
|
return (
|
|
3889
3951
|
this.regexp_eatPatternCharacters(state) ||
|
|
3890
3952
|
state.eat(0x2E /* . */) ||
|
|
@@ -3894,7 +3956,7 @@
|
|
|
3894
3956
|
this.regexp_eatCapturingGroup(state)
|
|
3895
3957
|
)
|
|
3896
3958
|
};
|
|
3897
|
-
pp$
|
|
3959
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
3898
3960
|
var start = state.pos;
|
|
3899
3961
|
if (state.eat(0x5C /* \ */)) {
|
|
3900
3962
|
if (this.regexp_eatAtomEscape(state)) {
|
|
@@ -3904,7 +3966,7 @@
|
|
|
3904
3966
|
}
|
|
3905
3967
|
return false
|
|
3906
3968
|
};
|
|
3907
|
-
pp$
|
|
3969
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
3908
3970
|
var start = state.pos;
|
|
3909
3971
|
if (state.eat(0x28 /* ( */)) {
|
|
3910
3972
|
if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
|
|
@@ -3918,7 +3980,7 @@
|
|
|
3918
3980
|
}
|
|
3919
3981
|
return false
|
|
3920
3982
|
};
|
|
3921
|
-
pp$
|
|
3983
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
3922
3984
|
if (state.eat(0x28 /* ( */)) {
|
|
3923
3985
|
if (this.options.ecmaVersion >= 9) {
|
|
3924
3986
|
this.regexp_groupSpecifier(state);
|
|
@@ -3936,7 +3998,7 @@
|
|
|
3936
3998
|
};
|
|
3937
3999
|
|
|
3938
4000
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
|
|
3939
|
-
pp$
|
|
4001
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
3940
4002
|
return (
|
|
3941
4003
|
state.eat(0x2E /* . */) ||
|
|
3942
4004
|
this.regexp_eatReverseSolidusAtomEscape(state) ||
|
|
@@ -3949,7 +4011,7 @@
|
|
|
3949
4011
|
};
|
|
3950
4012
|
|
|
3951
4013
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
|
|
3952
|
-
pp$
|
|
4014
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
3953
4015
|
if (this.regexp_eatBracedQuantifier(state, true)) {
|
|
3954
4016
|
state.raise("Nothing to repeat");
|
|
3955
4017
|
}
|
|
@@ -3957,7 +4019,7 @@
|
|
|
3957
4019
|
};
|
|
3958
4020
|
|
|
3959
4021
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
|
|
3960
|
-
pp$
|
|
4022
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
3961
4023
|
var ch = state.current();
|
|
3962
4024
|
if (isSyntaxCharacter(ch)) {
|
|
3963
4025
|
state.lastIntValue = ch;
|
|
@@ -3979,7 +4041,7 @@
|
|
|
3979
4041
|
|
|
3980
4042
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
|
|
3981
4043
|
// But eat eager.
|
|
3982
|
-
pp$
|
|
4044
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
3983
4045
|
var start = state.pos;
|
|
3984
4046
|
var ch = 0;
|
|
3985
4047
|
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
|
|
@@ -3989,7 +4051,7 @@
|
|
|
3989
4051
|
};
|
|
3990
4052
|
|
|
3991
4053
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
|
|
3992
|
-
pp$
|
|
4054
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
3993
4055
|
var ch = state.current();
|
|
3994
4056
|
if (
|
|
3995
4057
|
ch !== -1 &&
|
|
@@ -4010,7 +4072,7 @@
|
|
|
4010
4072
|
// GroupSpecifier ::
|
|
4011
4073
|
// [empty]
|
|
4012
4074
|
// `?` GroupName
|
|
4013
|
-
pp$
|
|
4075
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
4014
4076
|
if (state.eat(0x3F /* ? */)) {
|
|
4015
4077
|
if (this.regexp_eatGroupName(state)) {
|
|
4016
4078
|
if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
|
|
@@ -4026,7 +4088,7 @@
|
|
|
4026
4088
|
// GroupName ::
|
|
4027
4089
|
// `<` RegExpIdentifierName `>`
|
|
4028
4090
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
4029
|
-
pp$
|
|
4091
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
4030
4092
|
state.lastStringValue = "";
|
|
4031
4093
|
if (state.eat(0x3C /* < */)) {
|
|
4032
4094
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
|
|
@@ -4041,12 +4103,12 @@
|
|
|
4041
4103
|
// RegExpIdentifierStart
|
|
4042
4104
|
// RegExpIdentifierName RegExpIdentifierPart
|
|
4043
4105
|
// Note: this updates `state.lastStringValue` property with the eaten name.
|
|
4044
|
-
pp$
|
|
4106
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
4045
4107
|
state.lastStringValue = "";
|
|
4046
4108
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
4047
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
4109
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
4048
4110
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
4049
|
-
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
4111
|
+
state.lastStringValue += codePointToString$1(state.lastIntValue);
|
|
4050
4112
|
}
|
|
4051
4113
|
return true
|
|
4052
4114
|
}
|
|
@@ -4058,7 +4120,7 @@
|
|
|
4058
4120
|
// `$`
|
|
4059
4121
|
// `_`
|
|
4060
4122
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
4061
|
-
pp$
|
|
4123
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
4062
4124
|
var start = state.pos;
|
|
4063
4125
|
var forceU = this.options.ecmaVersion >= 11;
|
|
4064
4126
|
var ch = state.current(forceU);
|
|
@@ -4086,7 +4148,7 @@
|
|
|
4086
4148
|
// `\` RegExpUnicodeEscapeSequence[+U]
|
|
4087
4149
|
// <ZWNJ>
|
|
4088
4150
|
// <ZWJ>
|
|
4089
|
-
pp$
|
|
4151
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
4090
4152
|
var start = state.pos;
|
|
4091
4153
|
var forceU = this.options.ecmaVersion >= 11;
|
|
4092
4154
|
var ch = state.current(forceU);
|
|
@@ -4108,7 +4170,7 @@
|
|
|
4108
4170
|
}
|
|
4109
4171
|
|
|
4110
4172
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
|
|
4111
|
-
pp$
|
|
4173
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
4112
4174
|
if (
|
|
4113
4175
|
this.regexp_eatBackReference(state) ||
|
|
4114
4176
|
this.regexp_eatCharacterClassEscape(state) ||
|
|
@@ -4126,7 +4188,7 @@
|
|
|
4126
4188
|
}
|
|
4127
4189
|
return false
|
|
4128
4190
|
};
|
|
4129
|
-
pp$
|
|
4191
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
4130
4192
|
var start = state.pos;
|
|
4131
4193
|
if (this.regexp_eatDecimalEscape(state)) {
|
|
4132
4194
|
var n = state.lastIntValue;
|
|
@@ -4144,7 +4206,7 @@
|
|
|
4144
4206
|
}
|
|
4145
4207
|
return false
|
|
4146
4208
|
};
|
|
4147
|
-
pp$
|
|
4209
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
4148
4210
|
if (state.eat(0x6B /* k */)) {
|
|
4149
4211
|
if (this.regexp_eatGroupName(state)) {
|
|
4150
4212
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -4156,7 +4218,7 @@
|
|
|
4156
4218
|
};
|
|
4157
4219
|
|
|
4158
4220
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
|
|
4159
|
-
pp$
|
|
4221
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
4160
4222
|
return (
|
|
4161
4223
|
this.regexp_eatControlEscape(state) ||
|
|
4162
4224
|
this.regexp_eatCControlLetter(state) ||
|
|
@@ -4167,7 +4229,7 @@
|
|
|
4167
4229
|
this.regexp_eatIdentityEscape(state)
|
|
4168
4230
|
)
|
|
4169
4231
|
};
|
|
4170
|
-
pp$
|
|
4232
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
4171
4233
|
var start = state.pos;
|
|
4172
4234
|
if (state.eat(0x63 /* c */)) {
|
|
4173
4235
|
if (this.regexp_eatControlLetter(state)) {
|
|
@@ -4177,7 +4239,7 @@
|
|
|
4177
4239
|
}
|
|
4178
4240
|
return false
|
|
4179
4241
|
};
|
|
4180
|
-
pp$
|
|
4242
|
+
pp$1.regexp_eatZero = function(state) {
|
|
4181
4243
|
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
|
|
4182
4244
|
state.lastIntValue = 0;
|
|
4183
4245
|
state.advance();
|
|
@@ -4187,7 +4249,7 @@
|
|
|
4187
4249
|
};
|
|
4188
4250
|
|
|
4189
4251
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
|
|
4190
|
-
pp$
|
|
4252
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
4191
4253
|
var ch = state.current();
|
|
4192
4254
|
if (ch === 0x74 /* t */) {
|
|
4193
4255
|
state.lastIntValue = 0x09; /* \t */
|
|
@@ -4218,7 +4280,7 @@
|
|
|
4218
4280
|
};
|
|
4219
4281
|
|
|
4220
4282
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
|
|
4221
|
-
pp$
|
|
4283
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
4222
4284
|
var ch = state.current();
|
|
4223
4285
|
if (isControlLetter(ch)) {
|
|
4224
4286
|
state.lastIntValue = ch % 0x20;
|
|
@@ -4235,7 +4297,7 @@
|
|
|
4235
4297
|
}
|
|
4236
4298
|
|
|
4237
4299
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
|
|
4238
|
-
pp$
|
|
4300
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
4239
4301
|
if ( forceU === void 0 ) forceU = false;
|
|
4240
4302
|
|
|
4241
4303
|
var start = state.pos;
|
|
@@ -4280,7 +4342,7 @@
|
|
|
4280
4342
|
}
|
|
4281
4343
|
|
|
4282
4344
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
|
|
4283
|
-
pp$
|
|
4345
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
4284
4346
|
if (state.switchU) {
|
|
4285
4347
|
if (this.regexp_eatSyntaxCharacter(state)) {
|
|
4286
4348
|
return true
|
|
@@ -4303,7 +4365,7 @@
|
|
|
4303
4365
|
};
|
|
4304
4366
|
|
|
4305
4367
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
|
|
4306
|
-
pp$
|
|
4368
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
4307
4369
|
state.lastIntValue = 0;
|
|
4308
4370
|
var ch = state.current();
|
|
4309
4371
|
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
|
|
@@ -4317,7 +4379,7 @@
|
|
|
4317
4379
|
};
|
|
4318
4380
|
|
|
4319
4381
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
4320
|
-
pp$
|
|
4382
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
4321
4383
|
var ch = state.current();
|
|
4322
4384
|
|
|
4323
4385
|
if (isCharacterClassEscape(ch)) {
|
|
@@ -4359,7 +4421,7 @@
|
|
|
4359
4421
|
// UnicodePropertyValueExpression ::
|
|
4360
4422
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
4361
4423
|
// LoneUnicodePropertyNameOrValue
|
|
4362
|
-
pp$
|
|
4424
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
4363
4425
|
var start = state.pos;
|
|
4364
4426
|
|
|
4365
4427
|
// UnicodePropertyName `=` UnicodePropertyValue
|
|
@@ -4381,24 +4443,24 @@
|
|
|
4381
4443
|
}
|
|
4382
4444
|
return false
|
|
4383
4445
|
};
|
|
4384
|
-
pp$
|
|
4446
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
4385
4447
|
if (!has(state.unicodeProperties.nonBinary, name))
|
|
4386
4448
|
{ state.raise("Invalid property name"); }
|
|
4387
4449
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
4388
4450
|
{ state.raise("Invalid property value"); }
|
|
4389
4451
|
};
|
|
4390
|
-
pp$
|
|
4452
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
4391
4453
|
if (!state.unicodeProperties.binary.test(nameOrValue))
|
|
4392
4454
|
{ state.raise("Invalid property name"); }
|
|
4393
4455
|
};
|
|
4394
4456
|
|
|
4395
4457
|
// UnicodePropertyName ::
|
|
4396
4458
|
// UnicodePropertyNameCharacters
|
|
4397
|
-
pp$
|
|
4459
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
4398
4460
|
var ch = 0;
|
|
4399
4461
|
state.lastStringValue = "";
|
|
4400
4462
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
4401
|
-
state.lastStringValue += codePointToString(ch);
|
|
4463
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
4402
4464
|
state.advance();
|
|
4403
4465
|
}
|
|
4404
4466
|
return state.lastStringValue !== ""
|
|
@@ -4409,11 +4471,11 @@
|
|
|
4409
4471
|
|
|
4410
4472
|
// UnicodePropertyValue ::
|
|
4411
4473
|
// UnicodePropertyValueCharacters
|
|
4412
|
-
pp$
|
|
4474
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
4413
4475
|
var ch = 0;
|
|
4414
4476
|
state.lastStringValue = "";
|
|
4415
4477
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
4416
|
-
state.lastStringValue += codePointToString(ch);
|
|
4478
|
+
state.lastStringValue += codePointToString$1(ch);
|
|
4417
4479
|
state.advance();
|
|
4418
4480
|
}
|
|
4419
4481
|
return state.lastStringValue !== ""
|
|
@@ -4424,12 +4486,12 @@
|
|
|
4424
4486
|
|
|
4425
4487
|
// LoneUnicodePropertyNameOrValue ::
|
|
4426
4488
|
// UnicodePropertyValueCharacters
|
|
4427
|
-
pp$
|
|
4489
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
4428
4490
|
return this.regexp_eatUnicodePropertyValue(state)
|
|
4429
4491
|
};
|
|
4430
4492
|
|
|
4431
4493
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
4432
|
-
pp$
|
|
4494
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
4433
4495
|
if (state.eat(0x5B /* [ */)) {
|
|
4434
4496
|
state.eat(0x5E /* ^ */);
|
|
4435
4497
|
this.regexp_classRanges(state);
|
|
@@ -4445,7 +4507,7 @@
|
|
|
4445
4507
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
4446
4508
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
4447
4509
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
4448
|
-
pp$
|
|
4510
|
+
pp$1.regexp_classRanges = function(state) {
|
|
4449
4511
|
while (this.regexp_eatClassAtom(state)) {
|
|
4450
4512
|
var left = state.lastIntValue;
|
|
4451
4513
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -4462,7 +4524,7 @@
|
|
|
4462
4524
|
|
|
4463
4525
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
|
|
4464
4526
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
|
|
4465
|
-
pp$
|
|
4527
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
4466
4528
|
var start = state.pos;
|
|
4467
4529
|
|
|
4468
4530
|
if (state.eat(0x5C /* \ */)) {
|
|
@@ -4491,7 +4553,7 @@
|
|
|
4491
4553
|
};
|
|
4492
4554
|
|
|
4493
4555
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
|
|
4494
|
-
pp$
|
|
4556
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
4495
4557
|
var start = state.pos;
|
|
4496
4558
|
|
|
4497
4559
|
if (state.eat(0x62 /* b */)) {
|
|
@@ -4518,7 +4580,7 @@
|
|
|
4518
4580
|
};
|
|
4519
4581
|
|
|
4520
4582
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
4521
|
-
pp$
|
|
4583
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
4522
4584
|
var ch = state.current();
|
|
4523
4585
|
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
|
|
4524
4586
|
state.lastIntValue = ch % 0x20;
|
|
@@ -4529,7 +4591,7 @@
|
|
|
4529
4591
|
};
|
|
4530
4592
|
|
|
4531
4593
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
4532
|
-
pp$
|
|
4594
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
4533
4595
|
var start = state.pos;
|
|
4534
4596
|
if (state.eat(0x78 /* x */)) {
|
|
4535
4597
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
@@ -4544,7 +4606,7 @@
|
|
|
4544
4606
|
};
|
|
4545
4607
|
|
|
4546
4608
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
|
|
4547
|
-
pp$
|
|
4609
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
4548
4610
|
var start = state.pos;
|
|
4549
4611
|
var ch = 0;
|
|
4550
4612
|
state.lastIntValue = 0;
|
|
@@ -4559,7 +4621,7 @@
|
|
|
4559
4621
|
}
|
|
4560
4622
|
|
|
4561
4623
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
|
|
4562
|
-
pp$
|
|
4624
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
4563
4625
|
var start = state.pos;
|
|
4564
4626
|
var ch = 0;
|
|
4565
4627
|
state.lastIntValue = 0;
|
|
@@ -4588,7 +4650,7 @@
|
|
|
4588
4650
|
|
|
4589
4651
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
|
|
4590
4652
|
// Allows only 0-377(octal) i.e. 0-255(decimal).
|
|
4591
|
-
pp$
|
|
4653
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
4592
4654
|
if (this.regexp_eatOctalDigit(state)) {
|
|
4593
4655
|
var n1 = state.lastIntValue;
|
|
4594
4656
|
if (this.regexp_eatOctalDigit(state)) {
|
|
@@ -4607,7 +4669,7 @@
|
|
|
4607
4669
|
};
|
|
4608
4670
|
|
|
4609
4671
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
|
|
4610
|
-
pp$
|
|
4672
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
4611
4673
|
var ch = state.current();
|
|
4612
4674
|
if (isOctalDigit(ch)) {
|
|
4613
4675
|
state.lastIntValue = ch - 0x30; /* 0 */
|
|
@@ -4624,7 +4686,7 @@
|
|
|
4624
4686
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
|
|
4625
4687
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
|
|
4626
4688
|
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
|
|
4627
|
-
pp$
|
|
4689
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
4628
4690
|
var start = state.pos;
|
|
4629
4691
|
state.lastIntValue = 0;
|
|
4630
4692
|
for (var i = 0; i < length; ++i) {
|
|
@@ -4656,11 +4718,11 @@
|
|
|
4656
4718
|
|
|
4657
4719
|
// ## Tokenizer
|
|
4658
4720
|
|
|
4659
|
-
var pp
|
|
4721
|
+
var pp = Parser.prototype;
|
|
4660
4722
|
|
|
4661
4723
|
// Move to the next token
|
|
4662
4724
|
|
|
4663
|
-
pp
|
|
4725
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
4664
4726
|
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
|
|
4665
4727
|
{ this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
|
|
4666
4728
|
if (this.options.onToken)
|
|
@@ -4673,21 +4735,21 @@
|
|
|
4673
4735
|
this.nextToken();
|
|
4674
4736
|
};
|
|
4675
4737
|
|
|
4676
|
-
pp
|
|
4738
|
+
pp.getToken = function() {
|
|
4677
4739
|
this.next();
|
|
4678
4740
|
return new Token(this)
|
|
4679
4741
|
};
|
|
4680
4742
|
|
|
4681
4743
|
// If we're in an ES6 environment, make parsers iterable
|
|
4682
4744
|
if (typeof Symbol !== "undefined")
|
|
4683
|
-
{ pp
|
|
4684
|
-
var this$1 = this;
|
|
4745
|
+
{ pp[Symbol.iterator] = function() {
|
|
4746
|
+
var this$1$1 = this;
|
|
4685
4747
|
|
|
4686
4748
|
return {
|
|
4687
4749
|
next: function () {
|
|
4688
|
-
var token = this$1.getToken();
|
|
4750
|
+
var token = this$1$1.getToken();
|
|
4689
4751
|
return {
|
|
4690
|
-
done: token.type === types.eof,
|
|
4752
|
+
done: token.type === types$1.eof,
|
|
4691
4753
|
value: token
|
|
4692
4754
|
}
|
|
4693
4755
|
}
|
|
@@ -4697,26 +4759,22 @@
|
|
|
4697
4759
|
// Toggle strict mode. Re-reads the next number or string to please
|
|
4698
4760
|
// pedantic tests (`"use strict"; 010;` should fail).
|
|
4699
4761
|
|
|
4700
|
-
pp$9.curContext = function() {
|
|
4701
|
-
return this.context[this.context.length - 1]
|
|
4702
|
-
};
|
|
4703
|
-
|
|
4704
4762
|
// Read a single token, updating the parser object's token-related
|
|
4705
4763
|
// properties.
|
|
4706
4764
|
|
|
4707
|
-
pp
|
|
4765
|
+
pp.nextToken = function() {
|
|
4708
4766
|
var curContext = this.curContext();
|
|
4709
4767
|
if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
|
|
4710
4768
|
|
|
4711
4769
|
this.start = this.pos;
|
|
4712
4770
|
if (this.options.locations) { this.startLoc = this.curPosition(); }
|
|
4713
|
-
if (this.pos >= this.input.length) { return this.finishToken(types.eof) }
|
|
4771
|
+
if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
|
|
4714
4772
|
|
|
4715
4773
|
if (curContext.override) { return curContext.override(this) }
|
|
4716
4774
|
else { this.readToken(this.fullCharCodeAtPos()); }
|
|
4717
4775
|
};
|
|
4718
4776
|
|
|
4719
|
-
pp
|
|
4777
|
+
pp.readToken = function(code) {
|
|
4720
4778
|
// Identifier or keyword. '\uXXXX' sequences are allowed in
|
|
4721
4779
|
// identifiers, so '\' also dispatches to that.
|
|
4722
4780
|
if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
|
|
@@ -4725,14 +4783,14 @@
|
|
|
4725
4783
|
return this.getTokenFromCode(code)
|
|
4726
4784
|
};
|
|
4727
4785
|
|
|
4728
|
-
pp
|
|
4786
|
+
pp.fullCharCodeAtPos = function() {
|
|
4729
4787
|
var code = this.input.charCodeAt(this.pos);
|
|
4730
4788
|
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
4731
4789
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4732
4790
|
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
4733
4791
|
};
|
|
4734
4792
|
|
|
4735
|
-
pp
|
|
4793
|
+
pp.skipBlockComment = function() {
|
|
4736
4794
|
var startLoc = this.options.onComment && this.curPosition();
|
|
4737
4795
|
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
4738
4796
|
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
|
|
@@ -4750,7 +4808,7 @@
|
|
|
4750
4808
|
startLoc, this.curPosition()); }
|
|
4751
4809
|
};
|
|
4752
4810
|
|
|
4753
|
-
pp
|
|
4811
|
+
pp.skipLineComment = function(startSkip) {
|
|
4754
4812
|
var start = this.pos;
|
|
4755
4813
|
var startLoc = this.options.onComment && this.curPosition();
|
|
4756
4814
|
var ch = this.input.charCodeAt(this.pos += startSkip);
|
|
@@ -4765,7 +4823,7 @@
|
|
|
4765
4823
|
// Called at the start of the parse and after every token. Skips
|
|
4766
4824
|
// whitespace and comments, and.
|
|
4767
4825
|
|
|
4768
|
-
pp
|
|
4826
|
+
pp.skipSpace = function() {
|
|
4769
4827
|
loop: while (this.pos < this.input.length) {
|
|
4770
4828
|
var ch = this.input.charCodeAt(this.pos);
|
|
4771
4829
|
switch (ch) {
|
|
@@ -4810,7 +4868,7 @@
|
|
|
4810
4868
|
// the token, so that the next one's `start` will point at the
|
|
4811
4869
|
// right position.
|
|
4812
4870
|
|
|
4813
|
-
pp
|
|
4871
|
+
pp.finishToken = function(type, val) {
|
|
4814
4872
|
this.end = this.pos;
|
|
4815
4873
|
if (this.options.locations) { this.endLoc = this.curPosition(); }
|
|
4816
4874
|
var prevType = this.type;
|
|
@@ -4829,62 +4887,62 @@
|
|
|
4829
4887
|
//
|
|
4830
4888
|
// All in the name of speed.
|
|
4831
4889
|
//
|
|
4832
|
-
pp
|
|
4890
|
+
pp.readToken_dot = function() {
|
|
4833
4891
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4834
4892
|
if (next >= 48 && next <= 57) { return this.readNumber(true) }
|
|
4835
4893
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
4836
4894
|
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
|
|
4837
4895
|
this.pos += 3;
|
|
4838
|
-
return this.finishToken(types.ellipsis)
|
|
4896
|
+
return this.finishToken(types$1.ellipsis)
|
|
4839
4897
|
} else {
|
|
4840
4898
|
++this.pos;
|
|
4841
|
-
return this.finishToken(types.dot)
|
|
4899
|
+
return this.finishToken(types$1.dot)
|
|
4842
4900
|
}
|
|
4843
4901
|
};
|
|
4844
4902
|
|
|
4845
|
-
pp
|
|
4903
|
+
pp.readToken_slash = function() { // '/'
|
|
4846
4904
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4847
4905
|
if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
|
|
4848
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
4849
|
-
return this.finishOp(types.slash, 1)
|
|
4906
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
4907
|
+
return this.finishOp(types$1.slash, 1)
|
|
4850
4908
|
};
|
|
4851
4909
|
|
|
4852
|
-
pp
|
|
4910
|
+
pp.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
4853
4911
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4854
4912
|
var size = 1;
|
|
4855
|
-
var tokentype = code === 42 ? types.star : types.modulo;
|
|
4913
|
+
var tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
4856
4914
|
|
|
4857
4915
|
// exponentiation operator ** and **=
|
|
4858
4916
|
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
|
4859
4917
|
++size;
|
|
4860
|
-
tokentype = types.starstar;
|
|
4918
|
+
tokentype = types$1.starstar;
|
|
4861
4919
|
next = this.input.charCodeAt(this.pos + 2);
|
|
4862
4920
|
}
|
|
4863
4921
|
|
|
4864
|
-
if (next === 61) { return this.finishOp(types.assign, size + 1) }
|
|
4922
|
+
if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
4865
4923
|
return this.finishOp(tokentype, size)
|
|
4866
4924
|
};
|
|
4867
4925
|
|
|
4868
|
-
pp
|
|
4926
|
+
pp.readToken_pipe_amp = function(code) { // '|&'
|
|
4869
4927
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4870
4928
|
if (next === code) {
|
|
4871
4929
|
if (this.options.ecmaVersion >= 12) {
|
|
4872
4930
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
4873
|
-
if (next2 === 61) { return this.finishOp(types.assign, 3) }
|
|
4931
|
+
if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
4874
4932
|
}
|
|
4875
|
-
return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2)
|
|
4933
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
|
|
4876
4934
|
}
|
|
4877
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
4878
|
-
return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)
|
|
4935
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
4936
|
+
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
|
|
4879
4937
|
};
|
|
4880
4938
|
|
|
4881
|
-
pp
|
|
4939
|
+
pp.readToken_caret = function() { // '^'
|
|
4882
4940
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4883
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
4884
|
-
return this.finishOp(types.bitwiseXOR, 1)
|
|
4941
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
4942
|
+
return this.finishOp(types$1.bitwiseXOR, 1)
|
|
4885
4943
|
};
|
|
4886
4944
|
|
|
4887
|
-
pp
|
|
4945
|
+
pp.readToken_plus_min = function(code) { // '+-'
|
|
4888
4946
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4889
4947
|
if (next === code) {
|
|
4890
4948
|
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
|
@@ -4894,19 +4952,19 @@
|
|
|
4894
4952
|
this.skipSpace();
|
|
4895
4953
|
return this.nextToken()
|
|
4896
4954
|
}
|
|
4897
|
-
return this.finishOp(types.incDec, 2)
|
|
4955
|
+
return this.finishOp(types$1.incDec, 2)
|
|
4898
4956
|
}
|
|
4899
|
-
if (next === 61) { return this.finishOp(types.assign, 2) }
|
|
4900
|
-
return this.finishOp(types.plusMin, 1)
|
|
4957
|
+
if (next === 61) { return this.finishOp(types$1.assign, 2) }
|
|
4958
|
+
return this.finishOp(types$1.plusMin, 1)
|
|
4901
4959
|
};
|
|
4902
4960
|
|
|
4903
|
-
pp
|
|
4961
|
+
pp.readToken_lt_gt = function(code) { // '<>'
|
|
4904
4962
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4905
4963
|
var size = 1;
|
|
4906
4964
|
if (next === code) {
|
|
4907
4965
|
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
|
|
4908
|
-
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
|
4909
|
-
return this.finishOp(types.bitShift, size)
|
|
4966
|
+
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
|
|
4967
|
+
return this.finishOp(types$1.bitShift, size)
|
|
4910
4968
|
}
|
|
4911
4969
|
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
|
4912
4970
|
this.input.charCodeAt(this.pos + 3) === 45) {
|
|
@@ -4916,53 +4974,53 @@
|
|
|
4916
4974
|
return this.nextToken()
|
|
4917
4975
|
}
|
|
4918
4976
|
if (next === 61) { size = 2; }
|
|
4919
|
-
return this.finishOp(types.relational, size)
|
|
4977
|
+
return this.finishOp(types$1.relational, size)
|
|
4920
4978
|
};
|
|
4921
4979
|
|
|
4922
|
-
pp
|
|
4980
|
+
pp.readToken_eq_excl = function(code) { // '=!'
|
|
4923
4981
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4924
|
-
if (next === 61) { return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
4982
|
+
if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }
|
|
4925
4983
|
if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'
|
|
4926
4984
|
this.pos += 2;
|
|
4927
|
-
return this.finishToken(types.arrow)
|
|
4985
|
+
return this.finishToken(types$1.arrow)
|
|
4928
4986
|
}
|
|
4929
|
-
return this.finishOp(code === 61 ? types.eq : types.prefix, 1)
|
|
4987
|
+
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)
|
|
4930
4988
|
};
|
|
4931
4989
|
|
|
4932
|
-
pp
|
|
4990
|
+
pp.readToken_question = function() { // '?'
|
|
4933
4991
|
var ecmaVersion = this.options.ecmaVersion;
|
|
4934
4992
|
if (ecmaVersion >= 11) {
|
|
4935
4993
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
4936
4994
|
if (next === 46) {
|
|
4937
4995
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
4938
|
-
if (next2 < 48 || next2 > 57) { return this.finishOp(types.questionDot, 2) }
|
|
4996
|
+
if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }
|
|
4939
4997
|
}
|
|
4940
4998
|
if (next === 63) {
|
|
4941
4999
|
if (ecmaVersion >= 12) {
|
|
4942
5000
|
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
4943
|
-
if (next2$1 === 61) { return this.finishOp(types.assign, 3) }
|
|
5001
|
+
if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }
|
|
4944
5002
|
}
|
|
4945
|
-
return this.finishOp(types.coalesce, 2)
|
|
5003
|
+
return this.finishOp(types$1.coalesce, 2)
|
|
4946
5004
|
}
|
|
4947
5005
|
}
|
|
4948
|
-
return this.finishOp(types.question, 1)
|
|
5006
|
+
return this.finishOp(types$1.question, 1)
|
|
4949
5007
|
};
|
|
4950
5008
|
|
|
4951
|
-
pp
|
|
5009
|
+
pp.readToken_numberSign = function() { // '#'
|
|
4952
5010
|
var ecmaVersion = this.options.ecmaVersion;
|
|
4953
5011
|
var code = 35; // '#'
|
|
4954
5012
|
if (ecmaVersion >= 13) {
|
|
4955
5013
|
++this.pos;
|
|
4956
5014
|
code = this.fullCharCodeAtPos();
|
|
4957
5015
|
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
4958
|
-
return this.finishToken(types.privateId, this.readWord1())
|
|
5016
|
+
return this.finishToken(types$1.privateId, this.readWord1())
|
|
4959
5017
|
}
|
|
4960
5018
|
}
|
|
4961
5019
|
|
|
4962
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
5020
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
4963
5021
|
};
|
|
4964
5022
|
|
|
4965
|
-
pp
|
|
5023
|
+
pp.getTokenFromCode = function(code) {
|
|
4966
5024
|
switch (code) {
|
|
4967
5025
|
// The interpretation of a dot depends on whether it is followed
|
|
4968
5026
|
// by a digit or another two dots.
|
|
@@ -4970,20 +5028,20 @@
|
|
|
4970
5028
|
return this.readToken_dot()
|
|
4971
5029
|
|
|
4972
5030
|
// Punctuation tokens.
|
|
4973
|
-
case 40: ++this.pos; return this.finishToken(types.parenL)
|
|
4974
|
-
case 41: ++this.pos; return this.finishToken(types.parenR)
|
|
4975
|
-
case 59: ++this.pos; return this.finishToken(types.semi)
|
|
4976
|
-
case 44: ++this.pos; return this.finishToken(types.comma)
|
|
4977
|
-
case 91: ++this.pos; return this.finishToken(types.bracketL)
|
|
4978
|
-
case 93: ++this.pos; return this.finishToken(types.bracketR)
|
|
4979
|
-
case 123: ++this.pos; return this.finishToken(types.braceL)
|
|
4980
|
-
case 125: ++this.pos; return this.finishToken(types.braceR)
|
|
4981
|
-
case 58: ++this.pos; return this.finishToken(types.colon)
|
|
5031
|
+
case 40: ++this.pos; return this.finishToken(types$1.parenL)
|
|
5032
|
+
case 41: ++this.pos; return this.finishToken(types$1.parenR)
|
|
5033
|
+
case 59: ++this.pos; return this.finishToken(types$1.semi)
|
|
5034
|
+
case 44: ++this.pos; return this.finishToken(types$1.comma)
|
|
5035
|
+
case 91: ++this.pos; return this.finishToken(types$1.bracketL)
|
|
5036
|
+
case 93: ++this.pos; return this.finishToken(types$1.bracketR)
|
|
5037
|
+
case 123: ++this.pos; return this.finishToken(types$1.braceL)
|
|
5038
|
+
case 125: ++this.pos; return this.finishToken(types$1.braceR)
|
|
5039
|
+
case 58: ++this.pos; return this.finishToken(types$1.colon)
|
|
4982
5040
|
|
|
4983
5041
|
case 96: // '`'
|
|
4984
5042
|
if (this.options.ecmaVersion < 6) { break }
|
|
4985
5043
|
++this.pos;
|
|
4986
|
-
return this.finishToken(types.backQuote)
|
|
5044
|
+
return this.finishToken(types$1.backQuote)
|
|
4987
5045
|
|
|
4988
5046
|
case 48: // '0'
|
|
4989
5047
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
@@ -5006,7 +5064,6 @@
|
|
|
5006
5064
|
// often referred to. `finishOp` simply skips the amount of
|
|
5007
5065
|
// characters it is given as second argument, and returns a token
|
|
5008
5066
|
// of the type given by its first argument.
|
|
5009
|
-
|
|
5010
5067
|
case 47: // '/'
|
|
5011
5068
|
return this.readToken_slash()
|
|
5012
5069
|
|
|
@@ -5032,22 +5089,22 @@
|
|
|
5032
5089
|
return this.readToken_question()
|
|
5033
5090
|
|
|
5034
5091
|
case 126: // '~'
|
|
5035
|
-
return this.finishOp(types.prefix, 1)
|
|
5092
|
+
return this.finishOp(types$1.prefix, 1)
|
|
5036
5093
|
|
|
5037
5094
|
case 35: // '#'
|
|
5038
5095
|
return this.readToken_numberSign()
|
|
5039
5096
|
}
|
|
5040
5097
|
|
|
5041
|
-
this.raise(this.pos, "Unexpected character '" + codePointToString
|
|
5098
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
5042
5099
|
};
|
|
5043
5100
|
|
|
5044
|
-
pp
|
|
5101
|
+
pp.finishOp = function(type, size) {
|
|
5045
5102
|
var str = this.input.slice(this.pos, this.pos + size);
|
|
5046
5103
|
this.pos += size;
|
|
5047
5104
|
return this.finishToken(type, str)
|
|
5048
5105
|
};
|
|
5049
5106
|
|
|
5050
|
-
pp
|
|
5107
|
+
pp.readRegexp = function() {
|
|
5051
5108
|
var escaped, inClass, start = this.pos;
|
|
5052
5109
|
for (;;) {
|
|
5053
5110
|
if (this.pos >= this.input.length) { this.raise(start, "Unterminated regular expression"); }
|
|
@@ -5082,14 +5139,14 @@
|
|
|
5082
5139
|
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
|
|
5083
5140
|
}
|
|
5084
5141
|
|
|
5085
|
-
return this.finishToken(types.regexp, {pattern: pattern, flags: flags, value: value})
|
|
5142
|
+
return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})
|
|
5086
5143
|
};
|
|
5087
5144
|
|
|
5088
5145
|
// Read an integer in the given radix. Return null if zero digits
|
|
5089
5146
|
// were read, the integer value otherwise. When `len` is given, this
|
|
5090
5147
|
// will return `null` unless the integer has exactly `len` digits.
|
|
5091
5148
|
|
|
5092
|
-
pp
|
|
5149
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
5093
5150
|
// `len` is used for character escape sequences. In that case, disallow separators.
|
|
5094
5151
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;
|
|
5095
5152
|
|
|
@@ -5143,7 +5200,7 @@
|
|
|
5143
5200
|
return BigInt(str.replace(/_/g, ""))
|
|
5144
5201
|
}
|
|
5145
5202
|
|
|
5146
|
-
pp
|
|
5203
|
+
pp.readRadixNumber = function(radix) {
|
|
5147
5204
|
var start = this.pos;
|
|
5148
5205
|
this.pos += 2; // 0x
|
|
5149
5206
|
var val = this.readInt(radix);
|
|
@@ -5152,12 +5209,12 @@
|
|
|
5152
5209
|
val = stringToBigInt(this.input.slice(start, this.pos));
|
|
5153
5210
|
++this.pos;
|
|
5154
5211
|
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
5155
|
-
return this.finishToken(types.num, val)
|
|
5212
|
+
return this.finishToken(types$1.num, val)
|
|
5156
5213
|
};
|
|
5157
5214
|
|
|
5158
5215
|
// Read an integer, octal integer, or floating-point number.
|
|
5159
5216
|
|
|
5160
|
-
pp
|
|
5217
|
+
pp.readNumber = function(startsWithDot) {
|
|
5161
5218
|
var start = this.pos;
|
|
5162
5219
|
if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, "Invalid number"); }
|
|
5163
5220
|
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
@@ -5167,7 +5224,7 @@
|
|
|
5167
5224
|
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
5168
5225
|
++this.pos;
|
|
5169
5226
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
5170
|
-
return this.finishToken(types.num, val$1)
|
|
5227
|
+
return this.finishToken(types$1.num, val$1)
|
|
5171
5228
|
}
|
|
5172
5229
|
if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }
|
|
5173
5230
|
if (next === 46 && !octal) { // '.'
|
|
@@ -5183,12 +5240,12 @@
|
|
|
5183
5240
|
if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); }
|
|
5184
5241
|
|
|
5185
5242
|
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
5186
|
-
return this.finishToken(types.num, val)
|
|
5243
|
+
return this.finishToken(types$1.num, val)
|
|
5187
5244
|
};
|
|
5188
5245
|
|
|
5189
5246
|
// Read a string value, interpreting backslash-escapes.
|
|
5190
5247
|
|
|
5191
|
-
pp
|
|
5248
|
+
pp.readCodePoint = function() {
|
|
5192
5249
|
var ch = this.input.charCodeAt(this.pos), code;
|
|
5193
5250
|
|
|
5194
5251
|
if (ch === 123) { // '{'
|
|
@@ -5203,14 +5260,14 @@
|
|
|
5203
5260
|
return code
|
|
5204
5261
|
};
|
|
5205
5262
|
|
|
5206
|
-
function codePointToString
|
|
5263
|
+
function codePointToString(code) {
|
|
5207
5264
|
// UTF-16 Decoding
|
|
5208
5265
|
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
5209
5266
|
code -= 0x10000;
|
|
5210
5267
|
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
5211
5268
|
}
|
|
5212
5269
|
|
|
5213
|
-
pp
|
|
5270
|
+
pp.readString = function(quote) {
|
|
5214
5271
|
var out = "", chunkStart = ++this.pos;
|
|
5215
5272
|
for (;;) {
|
|
5216
5273
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated string constant"); }
|
|
@@ -5220,20 +5277,27 @@
|
|
|
5220
5277
|
out += this.input.slice(chunkStart, this.pos);
|
|
5221
5278
|
out += this.readEscapedChar(false);
|
|
5222
5279
|
chunkStart = this.pos;
|
|
5280
|
+
} else if (ch === 0x2028 || ch === 0x2029) {
|
|
5281
|
+
if (this.options.ecmaVersion < 10) { this.raise(this.start, "Unterminated string constant"); }
|
|
5282
|
+
++this.pos;
|
|
5283
|
+
if (this.options.locations) {
|
|
5284
|
+
this.curLine++;
|
|
5285
|
+
this.lineStart = this.pos;
|
|
5286
|
+
}
|
|
5223
5287
|
} else {
|
|
5224
|
-
if (isNewLine(ch
|
|
5288
|
+
if (isNewLine(ch)) { this.raise(this.start, "Unterminated string constant"); }
|
|
5225
5289
|
++this.pos;
|
|
5226
5290
|
}
|
|
5227
5291
|
}
|
|
5228
5292
|
out += this.input.slice(chunkStart, this.pos++);
|
|
5229
|
-
return this.finishToken(types.string, out)
|
|
5293
|
+
return this.finishToken(types$1.string, out)
|
|
5230
5294
|
};
|
|
5231
5295
|
|
|
5232
5296
|
// Reads template string tokens.
|
|
5233
5297
|
|
|
5234
5298
|
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
5235
5299
|
|
|
5236
|
-
pp
|
|
5300
|
+
pp.tryReadTemplateToken = function() {
|
|
5237
5301
|
this.inTemplateElement = true;
|
|
5238
5302
|
try {
|
|
5239
5303
|
this.readTmplToken();
|
|
@@ -5248,7 +5312,7 @@
|
|
|
5248
5312
|
this.inTemplateElement = false;
|
|
5249
5313
|
};
|
|
5250
5314
|
|
|
5251
|
-
pp
|
|
5315
|
+
pp.invalidStringToken = function(position, message) {
|
|
5252
5316
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
|
|
5253
5317
|
throw INVALID_TEMPLATE_ESCAPE_ERROR
|
|
5254
5318
|
} else {
|
|
@@ -5256,23 +5320,23 @@
|
|
|
5256
5320
|
}
|
|
5257
5321
|
};
|
|
5258
5322
|
|
|
5259
|
-
pp
|
|
5323
|
+
pp.readTmplToken = function() {
|
|
5260
5324
|
var out = "", chunkStart = this.pos;
|
|
5261
5325
|
for (;;) {
|
|
5262
5326
|
if (this.pos >= this.input.length) { this.raise(this.start, "Unterminated template"); }
|
|
5263
5327
|
var ch = this.input.charCodeAt(this.pos);
|
|
5264
5328
|
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'
|
|
5265
|
-
if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) {
|
|
5329
|
+
if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {
|
|
5266
5330
|
if (ch === 36) {
|
|
5267
5331
|
this.pos += 2;
|
|
5268
|
-
return this.finishToken(types.dollarBraceL)
|
|
5332
|
+
return this.finishToken(types$1.dollarBraceL)
|
|
5269
5333
|
} else {
|
|
5270
5334
|
++this.pos;
|
|
5271
|
-
return this.finishToken(types.backQuote)
|
|
5335
|
+
return this.finishToken(types$1.backQuote)
|
|
5272
5336
|
}
|
|
5273
5337
|
}
|
|
5274
5338
|
out += this.input.slice(chunkStart, this.pos);
|
|
5275
|
-
return this.finishToken(types.template, out)
|
|
5339
|
+
return this.finishToken(types$1.template, out)
|
|
5276
5340
|
}
|
|
5277
5341
|
if (ch === 92) { // '\'
|
|
5278
5342
|
out += this.input.slice(chunkStart, this.pos);
|
|
@@ -5303,7 +5367,7 @@
|
|
|
5303
5367
|
};
|
|
5304
5368
|
|
|
5305
5369
|
// Reads a template token to search for the end, without validating any escape sequences
|
|
5306
|
-
pp
|
|
5370
|
+
pp.readInvalidTemplateToken = function() {
|
|
5307
5371
|
for (; this.pos < this.input.length; this.pos++) {
|
|
5308
5372
|
switch (this.input[this.pos]) {
|
|
5309
5373
|
case "\\":
|
|
@@ -5314,10 +5378,10 @@
|
|
|
5314
5378
|
if (this.input[this.pos + 1] !== "{") {
|
|
5315
5379
|
break
|
|
5316
5380
|
}
|
|
5317
|
-
// falls through
|
|
5318
5381
|
|
|
5382
|
+
// falls through
|
|
5319
5383
|
case "`":
|
|
5320
|
-
return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
5384
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))
|
|
5321
5385
|
|
|
5322
5386
|
// no default
|
|
5323
5387
|
}
|
|
@@ -5327,14 +5391,14 @@
|
|
|
5327
5391
|
|
|
5328
5392
|
// Used to read escaped characters
|
|
5329
5393
|
|
|
5330
|
-
pp
|
|
5394
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
5331
5395
|
var ch = this.input.charCodeAt(++this.pos);
|
|
5332
5396
|
++this.pos;
|
|
5333
5397
|
switch (ch) {
|
|
5334
5398
|
case 110: return "\n" // 'n' -> '\n'
|
|
5335
5399
|
case 114: return "\r" // 'r' -> '\r'
|
|
5336
5400
|
case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'
|
|
5337
|
-
case 117: return codePointToString
|
|
5401
|
+
case 117: return codePointToString(this.readCodePoint()) // 'u'
|
|
5338
5402
|
case 116: return "\t" // 't' -> '\t'
|
|
5339
5403
|
case 98: return "\b" // 'b' -> '\b'
|
|
5340
5404
|
case 118: return "\u000b" // 'v' -> '\u000b'
|
|
@@ -5392,7 +5456,7 @@
|
|
|
5392
5456
|
|
|
5393
5457
|
// Used to read character escape sequences ('\x', '\u', '\U').
|
|
5394
5458
|
|
|
5395
|
-
pp
|
|
5459
|
+
pp.readHexChar = function(len) {
|
|
5396
5460
|
var codePos = this.pos;
|
|
5397
5461
|
var n = this.readInt(16, len);
|
|
5398
5462
|
if (n === null) { this.invalidStringToken(codePos, "Bad character escape sequence"); }
|
|
@@ -5405,7 +5469,7 @@
|
|
|
5405
5469
|
// Incrementally adds only escaped chars, adding other chunks as-is
|
|
5406
5470
|
// as a micro-optimization.
|
|
5407
5471
|
|
|
5408
|
-
pp
|
|
5472
|
+
pp.readWord1 = function() {
|
|
5409
5473
|
this.containsEsc = false;
|
|
5410
5474
|
var word = "", first = true, chunkStart = this.pos;
|
|
5411
5475
|
var astral = this.options.ecmaVersion >= 6;
|
|
@@ -5423,7 +5487,7 @@
|
|
|
5423
5487
|
var esc = this.readCodePoint();
|
|
5424
5488
|
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))
|
|
5425
5489
|
{ this.invalidStringToken(escStart, "Invalid Unicode escape"); }
|
|
5426
|
-
word += codePointToString
|
|
5490
|
+
word += codePointToString(esc);
|
|
5427
5491
|
chunkStart = this.pos;
|
|
5428
5492
|
} else {
|
|
5429
5493
|
break
|
|
@@ -5436,18 +5500,18 @@
|
|
|
5436
5500
|
// Read an identifier or keyword token. Will check for reserved
|
|
5437
5501
|
// words when necessary.
|
|
5438
5502
|
|
|
5439
|
-
pp
|
|
5503
|
+
pp.readWord = function() {
|
|
5440
5504
|
var word = this.readWord1();
|
|
5441
|
-
var type = types.name;
|
|
5505
|
+
var type = types$1.name;
|
|
5442
5506
|
if (this.keywords.test(word)) {
|
|
5443
|
-
type = keywords
|
|
5507
|
+
type = keywords[word];
|
|
5444
5508
|
}
|
|
5445
5509
|
return this.finishToken(type, word)
|
|
5446
5510
|
};
|
|
5447
5511
|
|
|
5448
5512
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
5449
5513
|
|
|
5450
|
-
var version = "8.
|
|
5514
|
+
var version = "8.6.0";
|
|
5451
5515
|
|
|
5452
5516
|
Parser.acorn = {
|
|
5453
5517
|
Parser: Parser,
|
|
@@ -5458,10 +5522,10 @@
|
|
|
5458
5522
|
getLineInfo: getLineInfo,
|
|
5459
5523
|
Node: Node,
|
|
5460
5524
|
TokenType: TokenType,
|
|
5461
|
-
tokTypes: types,
|
|
5462
|
-
keywordTypes: keywords
|
|
5525
|
+
tokTypes: types$1,
|
|
5526
|
+
keywordTypes: keywords,
|
|
5463
5527
|
TokContext: TokContext,
|
|
5464
|
-
tokContexts: types
|
|
5528
|
+
tokContexts: types,
|
|
5465
5529
|
isIdentifierChar: isIdentifierChar,
|
|
5466
5530
|
isIdentifierStart: isIdentifierStart,
|
|
5467
5531
|
Token: Token,
|
|
@@ -5509,17 +5573,17 @@
|
|
|
5509
5573
|
exports.isIdentifierChar = isIdentifierChar;
|
|
5510
5574
|
exports.isIdentifierStart = isIdentifierStart;
|
|
5511
5575
|
exports.isNewLine = isNewLine;
|
|
5512
|
-
exports.keywordTypes = keywords
|
|
5576
|
+
exports.keywordTypes = keywords;
|
|
5513
5577
|
exports.lineBreak = lineBreak;
|
|
5514
5578
|
exports.lineBreakG = lineBreakG;
|
|
5515
5579
|
exports.nonASCIIwhitespace = nonASCIIwhitespace;
|
|
5516
5580
|
exports.parse = parse;
|
|
5517
5581
|
exports.parseExpressionAt = parseExpressionAt;
|
|
5518
|
-
exports.tokContexts = types
|
|
5519
|
-
exports.tokTypes = types;
|
|
5582
|
+
exports.tokContexts = types;
|
|
5583
|
+
exports.tokTypes = types$1;
|
|
5520
5584
|
exports.tokenizer = tokenizer;
|
|
5521
5585
|
exports.version = version;
|
|
5522
5586
|
|
|
5523
5587
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5524
5588
|
|
|
5525
|
-
}))
|
|
5589
|
+
}));
|