@engine262/engine262 0.0.1-01e9fa95a4e8a1c042efd00492309a2de4998fd0
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/LICENSE +19 -0
- package/README.md +149 -0
- package/bin/engine262.js +5 -0
- package/declaration/abstract-ops/all.d.mts +39 -0
- package/declaration/abstract-ops/all.d.mts.map +1 -0
- package/declaration/abstract-ops/arguments-operations.d.mts +14 -0
- package/declaration/abstract-ops/arguments-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/array-objects.d.mts +20 -0
- package/declaration/abstract-ops/array-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/arraybuffer-objects.d.mts +43 -0
- package/declaration/abstract-ops/arraybuffer-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/async-function-operations.d.mts +7 -0
- package/declaration/abstract-ops/async-function-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/async-generator-objects.d.mts +35 -0
- package/declaration/abstract-ops/async-generator-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/data-types-and-values.d.mts +6 -0
- package/declaration/abstract-ops/data-types-and-values.d.mts.map +1 -0
- package/declaration/abstract-ops/dataview-objects.d.mts +20 -0
- package/declaration/abstract-ops/dataview-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/date-objects.d.mts +57 -0
- package/declaration/abstract-ops/date-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/disposable-operations.d.mts +19 -0
- package/declaration/abstract-ops/disposable-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/error-objects.d.mts +8 -0
- package/declaration/abstract-ops/error-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/execution-contexts.d.mts +3 -0
- package/declaration/abstract-ops/execution-contexts.d.mts.map +1 -0
- package/declaration/abstract-ops/function-operations.d.mts +101 -0
- package/declaration/abstract-ops/function-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/generator-operations.d.mts +33 -0
- package/declaration/abstract-ops/generator-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/global-object.d.mts +11 -0
- package/declaration/abstract-ops/global-object.d.mts.map +1 -0
- package/declaration/abstract-ops/immutable-prototype-objects.d.mts +7 -0
- package/declaration/abstract-ops/immutable-prototype-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/import-calls.d.mts +5 -0
- package/declaration/abstract-ops/import-calls.d.mts.map +1 -0
- package/declaration/abstract-ops/iterator-operations.d.mts +53 -0
- package/declaration/abstract-ops/iterator-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/keyed-collections.d.mts +4 -0
- package/declaration/abstract-ops/keyed-collections.d.mts.map +1 -0
- package/declaration/abstract-ops/math.d.mts +23 -0
- package/declaration/abstract-ops/math.d.mts.map +1 -0
- package/declaration/abstract-ops/module-namespace-exotic-objects.d.mts +13 -0
- package/declaration/abstract-ops/module-namespace-exotic-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/module-records.d.mts +64 -0
- package/declaration/abstract-ops/module-records.d.mts.map +1 -0
- package/declaration/abstract-ops/notational-conventions.d.mts +19 -0
- package/declaration/abstract-ops/notational-conventions.d.mts.map +1 -0
- package/declaration/abstract-ops/object-operations.d.mts +79 -0
- package/declaration/abstract-ops/object-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/objects.d.mts +32 -0
- package/declaration/abstract-ops/objects.d.mts.map +1 -0
- package/declaration/abstract-ops/private-names.d.mts +15 -0
- package/declaration/abstract-ops/private-names.d.mts.map +1 -0
- package/declaration/abstract-ops/promise-operations.d.mts +49 -0
- package/declaration/abstract-ops/promise-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/proxy-objects.d.mts +6 -0
- package/declaration/abstract-ops/proxy-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/realms.d.mts +181 -0
- package/declaration/abstract-ops/realms.d.mts.map +1 -0
- package/declaration/abstract-ops/reference-operations.d.mts +28 -0
- package/declaration/abstract-ops/reference-operations.d.mts.map +1 -0
- package/declaration/abstract-ops/regexp-objects.d.mts +28 -0
- package/declaration/abstract-ops/regexp-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/shadow-realm.d.mts +26 -0
- package/declaration/abstract-ops/shadow-realm.d.mts.map +1 -0
- package/declaration/abstract-ops/shared-arraybuffer.d.mts +4 -0
- package/declaration/abstract-ops/shared-arraybuffer.d.mts.map +1 -0
- package/declaration/abstract-ops/spec-types.d.mts +53 -0
- package/declaration/abstract-ops/spec-types.d.mts.map +1 -0
- package/declaration/abstract-ops/string-objects.d.mts +8 -0
- package/declaration/abstract-ops/string-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/symbol-objects.d.mts +11 -0
- package/declaration/abstract-ops/symbol-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/addition.d.mts +62 -0
- package/declaration/abstract-ops/temporal/addition.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/all.d.mts +13 -0
- package/declaration/abstract-ops/temporal/all.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/calendar.d.mts +203 -0
- package/declaration/abstract-ops/temporal/calendar.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/duration.d.mts +126 -0
- package/declaration/abstract-ops/temporal/duration.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/instant.d.mts +25 -0
- package/declaration/abstract-ops/temporal/instant.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/not-implemented.d.mts +5 -0
- package/declaration/abstract-ops/temporal/not-implemented.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/now.d.mts +11 -0
- package/declaration/abstract-ops/temporal/now.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/plain-date-time.d.mts +36 -0
- package/declaration/abstract-ops/temporal/plain-date-time.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/plain-date.d.mts +32 -0
- package/declaration/abstract-ops/temporal/plain-date.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/plain-month-day.d.mts +10 -0
- package/declaration/abstract-ops/temporal/plain-month-day.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/plain-time.d.mts +58 -0
- package/declaration/abstract-ops/temporal/plain-time.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/plain-year-month.d.mts +19 -0
- package/declaration/abstract-ops/temporal/plain-year-month.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/temporal.d.mts +157 -0
- package/declaration/abstract-ops/temporal/temporal.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/time-zone.d.mts +26 -0
- package/declaration/abstract-ops/temporal/time-zone.d.mts.map +1 -0
- package/declaration/abstract-ops/temporal/zoned-datetime.d.mts +28 -0
- package/declaration/abstract-ops/temporal/zoned-datetime.d.mts.map +1 -0
- package/declaration/abstract-ops/testing-comparison.d.mts +35 -0
- package/declaration/abstract-ops/testing-comparison.d.mts.map +1 -0
- package/declaration/abstract-ops/type-conversion.d.mts +62 -0
- package/declaration/abstract-ops/type-conversion.d.mts.map +1 -0
- package/declaration/abstract-ops/typedarray-objects.d.mts +33 -0
- package/declaration/abstract-ops/typedarray-objects.d.mts.map +1 -0
- package/declaration/abstract-ops/weak-operations.d.mts +4 -0
- package/declaration/abstract-ops/weak-operations.d.mts.map +1 -0
- package/declaration/api.d.mts +76 -0
- package/declaration/api.d.mts.map +1 -0
- package/declaration/completion.d.mts +156 -0
- package/declaration/completion.d.mts.map +1 -0
- package/declaration/ecma402/not-implemented.d.mts +3 -0
- package/declaration/ecma402/not-implemented.d.mts.map +1 -0
- package/declaration/evaluator.d.mts +61 -0
- package/declaration/evaluator.d.mts.map +1 -0
- package/declaration/execution-context/Agent.d.mts +75 -0
- package/declaration/execution-context/Agent.d.mts.map +1 -0
- package/declaration/execution-context/Environment.d.mts +175 -0
- package/declaration/execution-context/Environment.d.mts.map +1 -0
- package/declaration/execution-context/ExecutionContext.d.mts +48 -0
- package/declaration/execution-context/ExecutionContext.d.mts.map +1 -0
- package/declaration/execution-context/Job.d.mts +23 -0
- package/declaration/execution-context/Job.d.mts.map +1 -0
- package/declaration/execution-context/PrivateEnvironment.d.mts +12 -0
- package/declaration/execution-context/PrivateEnvironment.d.mts.map +1 -0
- package/declaration/execution-context/Realm.d.mts +24 -0
- package/declaration/execution-context/Realm.d.mts.map +1 -0
- package/declaration/execution-context/WeakReference.d.mts +12 -0
- package/declaration/execution-context/WeakReference.d.mts.map +1 -0
- package/declaration/execution-context/all.d.mts +8 -0
- package/declaration/execution-context/all.d.mts.map +1 -0
- package/declaration/host-defined/base64.d.mts +10 -0
- package/declaration/host-defined/base64.d.mts.map +1 -0
- package/declaration/host-defined/debugger-util.d.mts +2 -0
- package/declaration/host-defined/debugger-util.d.mts.map +1 -0
- package/declaration/host-defined/decimal.d.mts +29 -0
- package/declaration/host-defined/decimal.d.mts.map +1 -0
- package/declaration/host-defined/devtoolsEval.d.mts +3 -0
- package/declaration/host-defined/devtoolsEval.d.mts.map +1 -0
- package/declaration/host-defined/engine.d.mts +133 -0
- package/declaration/host-defined/engine.d.mts.map +1 -0
- package/declaration/host-defined/error-messages.d.mts +45 -0
- package/declaration/host-defined/error-messages.d.mts.map +1 -0
- package/declaration/host-defined/event-loop.d.mts +92 -0
- package/declaration/host-defined/event-loop.d.mts.map +1 -0
- package/declaration/host-defined/ieee754.d.mts +7 -0
- package/declaration/host-defined/ieee754.d.mts.map +1 -0
- package/declaration/host-defined/inspect.d.mts +4 -0
- package/declaration/host-defined/inspect.d.mts.map +1 -0
- package/declaration/host-defined/job-queue.d.mts +42 -0
- package/declaration/host-defined/job-queue.d.mts.map +1 -0
- package/declaration/host-defined/sort.d.mts +14 -0
- package/declaration/host-defined/sort.d.mts.map +1 -0
- package/declaration/host-defined/test262-intrinsics.d.mts +8 -0
- package/declaration/host-defined/test262-intrinsics.d.mts.map +1 -0
- package/declaration/index.d.mts +56 -0
- package/declaration/index.d.mts.map +1 -0
- package/declaration/intrinsics/AbstractModuleSource.d.mts +5 -0
- package/declaration/intrinsics/AbstractModuleSource.d.mts.map +1 -0
- package/declaration/intrinsics/AggregateError.d.mts +3 -0
- package/declaration/intrinsics/AggregateError.d.mts.map +1 -0
- package/declaration/intrinsics/AggregateErrorPrototype.d.mts +3 -0
- package/declaration/intrinsics/AggregateErrorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Array.d.mts +3 -0
- package/declaration/intrinsics/Array.d.mts.map +1 -0
- package/declaration/intrinsics/ArrayBuffer.d.mts +3 -0
- package/declaration/intrinsics/ArrayBuffer.d.mts.map +1 -0
- package/declaration/intrinsics/ArrayBufferPrototype.d.mts +3 -0
- package/declaration/intrinsics/ArrayBufferPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/ArrayIteratorPrototype.d.mts +3 -0
- package/declaration/intrinsics/ArrayIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/ArrayPrototype.d.mts +3 -0
- package/declaration/intrinsics/ArrayPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/ArrayPrototypeShared.d.mts +8 -0
- package/declaration/intrinsics/ArrayPrototypeShared.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncDisposableStack.d.mts +8 -0
- package/declaration/intrinsics/AsyncDisposableStack.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncDisposableStackPrototype.d.mts +3 -0
- package/declaration/intrinsics/AsyncDisposableStackPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncFromSyncIteratorPrototype.d.mts +6 -0
- package/declaration/intrinsics/AsyncFromSyncIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncFunction.d.mts +3 -0
- package/declaration/intrinsics/AsyncFunction.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncFunctionPrototype.d.mts +3 -0
- package/declaration/intrinsics/AsyncFunctionPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncGeneratorFunction.d.mts +3 -0
- package/declaration/intrinsics/AsyncGeneratorFunction.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncGeneratorFunctionPrototype.d.mts +3 -0
- package/declaration/intrinsics/AsyncGeneratorFunctionPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncGeneratorFunctionPrototypePrototype.d.mts +3 -0
- package/declaration/intrinsics/AsyncGeneratorFunctionPrototypePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/AsyncIteratorPrototype.d.mts +3 -0
- package/declaration/intrinsics/AsyncIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/BigInt.d.mts +8 -0
- package/declaration/intrinsics/BigInt.d.mts.map +1 -0
- package/declaration/intrinsics/BigIntPrototype.d.mts +6 -0
- package/declaration/intrinsics/BigIntPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Boolean.d.mts +8 -0
- package/declaration/intrinsics/Boolean.d.mts.map +1 -0
- package/declaration/intrinsics/BooleanPrototype.d.mts +5 -0
- package/declaration/intrinsics/BooleanPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/DataView.d.mts +12 -0
- package/declaration/intrinsics/DataView.d.mts.map +1 -0
- package/declaration/intrinsics/DataViewPrototype.d.mts +3 -0
- package/declaration/intrinsics/DataViewPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Date.d.mts +8 -0
- package/declaration/intrinsics/Date.d.mts.map +1 -0
- package/declaration/intrinsics/DatePrototype.d.mts +12 -0
- package/declaration/intrinsics/DatePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/DisposableStack.d.mts +8 -0
- package/declaration/intrinsics/DisposableStack.d.mts.map +1 -0
- package/declaration/intrinsics/DisposableStackPrototype.d.mts +3 -0
- package/declaration/intrinsics/DisposableStackPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Error.d.mts +18 -0
- package/declaration/intrinsics/Error.d.mts.map +1 -0
- package/declaration/intrinsics/ErrorPrototype.d.mts +3 -0
- package/declaration/intrinsics/ErrorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/FinalizationRegistry.d.mts +16 -0
- package/declaration/intrinsics/FinalizationRegistry.d.mts.map +1 -0
- package/declaration/intrinsics/FinalizationRegistryPrototype.d.mts +3 -0
- package/declaration/intrinsics/FinalizationRegistryPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/ForInIteratorPrototype.d.mts +13 -0
- package/declaration/intrinsics/ForInIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Function.d.mts +3 -0
- package/declaration/intrinsics/Function.d.mts.map +1 -0
- package/declaration/intrinsics/FunctionPrototype.d.mts +13 -0
- package/declaration/intrinsics/FunctionPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/GeneratorFunction.d.mts +3 -0
- package/declaration/intrinsics/GeneratorFunction.d.mts.map +1 -0
- package/declaration/intrinsics/GeneratorFunctionPrototype.d.mts +3 -0
- package/declaration/intrinsics/GeneratorFunctionPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/GeneratorFunctionPrototypePrototype.d.mts +3 -0
- package/declaration/intrinsics/GeneratorFunctionPrototypePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Iterator.d.mts +3 -0
- package/declaration/intrinsics/Iterator.d.mts.map +1 -0
- package/declaration/intrinsics/IteratorHelperPrototype.d.mts +3 -0
- package/declaration/intrinsics/IteratorHelperPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/IteratorPrototype.d.mts +3 -0
- package/declaration/intrinsics/IteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/JSON.d.mts +9 -0
- package/declaration/intrinsics/JSON.d.mts.map +1 -0
- package/declaration/intrinsics/Map.d.mts +13 -0
- package/declaration/intrinsics/Map.d.mts.map +1 -0
- package/declaration/intrinsics/MapIteratorPrototype.d.mts +7 -0
- package/declaration/intrinsics/MapIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/MapPrototype.d.mts +3 -0
- package/declaration/intrinsics/MapPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Math.d.mts +4 -0
- package/declaration/intrinsics/Math.d.mts.map +1 -0
- package/declaration/intrinsics/NativeError.d.mts +6 -0
- package/declaration/intrinsics/NativeError.d.mts.map +1 -0
- package/declaration/intrinsics/Number.d.mts +8 -0
- package/declaration/intrinsics/Number.d.mts.map +1 -0
- package/declaration/intrinsics/NumberPrototype.d.mts +5 -0
- package/declaration/intrinsics/NumberPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Object.d.mts +3 -0
- package/declaration/intrinsics/Object.d.mts.map +1 -0
- package/declaration/intrinsics/ObjectPrototype.d.mts +5 -0
- package/declaration/intrinsics/ObjectPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Promise.d.mts +18 -0
- package/declaration/intrinsics/Promise.d.mts.map +1 -0
- package/declaration/intrinsics/PromisePrototype.d.mts +3 -0
- package/declaration/intrinsics/PromisePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Proxy.d.mts +12 -0
- package/declaration/intrinsics/Proxy.d.mts.map +1 -0
- package/declaration/intrinsics/Reflect.d.mts +3 -0
- package/declaration/intrinsics/Reflect.d.mts.map +1 -0
- package/declaration/intrinsics/RegExp.d.mts +13 -0
- package/declaration/intrinsics/RegExp.d.mts.map +1 -0
- package/declaration/intrinsics/RegExpPrototype.d.mts +12 -0
- package/declaration/intrinsics/RegExpPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/RegExpStringIteratorPrototype.d.mts +7 -0
- package/declaration/intrinsics/RegExpStringIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Set.d.mts +8 -0
- package/declaration/intrinsics/Set.d.mts.map +1 -0
- package/declaration/intrinsics/SetIteratorPrototype.d.mts +7 -0
- package/declaration/intrinsics/SetIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/SetPrototype.d.mts +3 -0
- package/declaration/intrinsics/SetPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/ShadowRealm.d.mts +8 -0
- package/declaration/intrinsics/ShadowRealm.d.mts.map +1 -0
- package/declaration/intrinsics/ShadowRealmPrototype.d.mts +3 -0
- package/declaration/intrinsics/ShadowRealmPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/String.d.mts +10 -0
- package/declaration/intrinsics/String.d.mts.map +1 -0
- package/declaration/intrinsics/StringIteratorPrototype.d.mts +3 -0
- package/declaration/intrinsics/StringIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/StringPrototype.d.mts +6 -0
- package/declaration/intrinsics/StringPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/SuppressedError.d.mts +3 -0
- package/declaration/intrinsics/SuppressedError.d.mts.map +1 -0
- package/declaration/intrinsics/SuppressedErrorPrototype.d.mts +3 -0
- package/declaration/intrinsics/SuppressedErrorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Symbol.d.mts +8 -0
- package/declaration/intrinsics/Symbol.d.mts.map +1 -0
- package/declaration/intrinsics/SymbolPrototype.d.mts +6 -0
- package/declaration/intrinsics/SymbolPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/Duration.d.mts +18 -0
- package/declaration/intrinsics/Temporal/Duration.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/DurationPrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/DurationPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/Instant.d.mts +9 -0
- package/declaration/intrinsics/Temporal/Instant.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/InstantPrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/InstantPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/Now.d.mts +3 -0
- package/declaration/intrinsics/Temporal/Now.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainDate.d.mts +16 -0
- package/declaration/intrinsics/Temporal/PlainDate.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainDatePrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/PlainDatePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainDateTime.d.mts +17 -0
- package/declaration/intrinsics/Temporal/PlainDateTime.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainDateTimePrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/PlainDateTimePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainMonthDay.d.mts +12 -0
- package/declaration/intrinsics/Temporal/PlainMonthDay.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainMonthDayPrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/PlainMonthDayPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainTime.d.mts +9 -0
- package/declaration/intrinsics/Temporal/PlainTime.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainTimePrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/PlainTimePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainYearMonth.d.mts +17 -0
- package/declaration/intrinsics/Temporal/PlainYearMonth.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/PlainYearMonthPrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/PlainYearMonthPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/Temporal.d.mts +3 -0
- package/declaration/intrinsics/Temporal/Temporal.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/ZonedDateTime.d.mts +13 -0
- package/declaration/intrinsics/Temporal/ZonedDateTime.d.mts.map +1 -0
- package/declaration/intrinsics/Temporal/ZonedDateTimePrototype.d.mts +3 -0
- package/declaration/intrinsics/Temporal/ZonedDateTimePrototype.d.mts.map +1 -0
- package/declaration/intrinsics/ThrowTypeError.d.mts +3 -0
- package/declaration/intrinsics/ThrowTypeError.d.mts.map +1 -0
- package/declaration/intrinsics/TypedArray.d.mts +196 -0
- package/declaration/intrinsics/TypedArray.d.mts.map +1 -0
- package/declaration/intrinsics/TypedArrayConstructors.d.mts +3 -0
- package/declaration/intrinsics/TypedArrayConstructors.d.mts.map +1 -0
- package/declaration/intrinsics/TypedArrayPrototype.d.mts +3 -0
- package/declaration/intrinsics/TypedArrayPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/TypedArrayPrototypes.d.mts +4 -0
- package/declaration/intrinsics/TypedArrayPrototypes.d.mts.map +1 -0
- package/declaration/intrinsics/TypedArray_Uint8Array.d.mts +3 -0
- package/declaration/intrinsics/TypedArray_Uint8Array.d.mts.map +1 -0
- package/declaration/intrinsics/URIHandling.d.mts +3 -0
- package/declaration/intrinsics/URIHandling.d.mts.map +1 -0
- package/declaration/intrinsics/WeakMap.d.mts +11 -0
- package/declaration/intrinsics/WeakMap.d.mts.map +1 -0
- package/declaration/intrinsics/WeakMapPrototype.d.mts +3 -0
- package/declaration/intrinsics/WeakMapPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/WeakRef.d.mts +8 -0
- package/declaration/intrinsics/WeakRef.d.mts.map +1 -0
- package/declaration/intrinsics/WeakRefPrototype.d.mts +3 -0
- package/declaration/intrinsics/WeakRefPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/WeakSet.d.mts +8 -0
- package/declaration/intrinsics/WeakSet.d.mts.map +1 -0
- package/declaration/intrinsics/WeakSetPrototype.d.mts +3 -0
- package/declaration/intrinsics/WeakSetPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/WrapForValidIteratorPrototype.d.mts +3 -0
- package/declaration/intrinsics/WrapForValidIteratorPrototype.d.mts.map +1 -0
- package/declaration/intrinsics/bootstrap.d.mts +19 -0
- package/declaration/intrinsics/bootstrap.d.mts.map +1 -0
- package/declaration/intrinsics/eval.d.mts +3 -0
- package/declaration/intrinsics/eval.d.mts.map +1 -0
- package/declaration/intrinsics/isFinite.d.mts +3 -0
- package/declaration/intrinsics/isFinite.d.mts.map +1 -0
- package/declaration/intrinsics/isNaN.d.mts +3 -0
- package/declaration/intrinsics/isNaN.d.mts.map +1 -0
- package/declaration/intrinsics/parseFloat.d.mts +3 -0
- package/declaration/intrinsics/parseFloat.d.mts.map +1 -0
- package/declaration/intrinsics/parseInt.d.mts +3 -0
- package/declaration/intrinsics/parseInt.d.mts.map +1 -0
- package/declaration/modules.d.mts +126 -0
- package/declaration/modules.d.mts.map +1 -0
- package/declaration/parse.d.mts +35 -0
- package/declaration/parse.d.mts.map +1 -0
- package/declaration/parser/BaseParser.d.mts +24 -0
- package/declaration/parser/BaseParser.d.mts.map +1 -0
- package/declaration/parser/ExpressionParser.d.mts +70 -0
- package/declaration/parser/ExpressionParser.d.mts.map +1 -0
- package/declaration/parser/FunctionParser.d.mts +43 -0
- package/declaration/parser/FunctionParser.d.mts.map +1 -0
- package/declaration/parser/IdentifierParser.d.mts +12 -0
- package/declaration/parser/IdentifierParser.d.mts.map +1 -0
- package/declaration/parser/LanguageParser.d.mts +10 -0
- package/declaration/parser/LanguageParser.d.mts.map +1 -0
- package/declaration/parser/Lexer.d.mts +76 -0
- package/declaration/parser/Lexer.d.mts.map +1 -0
- package/declaration/parser/ModuleParser.d.mts +19 -0
- package/declaration/parser/ModuleParser.d.mts.map +1 -0
- package/declaration/parser/ParseNode.d.mts +1323 -0
- package/declaration/parser/ParseNode.d.mts.map +1 -0
- package/declaration/parser/Parser.d.mts +30 -0
- package/declaration/parser/Parser.d.mts.map +1 -0
- package/declaration/parser/RegExpParser.d.mts +67 -0
- package/declaration/parser/RegExpParser.d.mts.map +1 -0
- package/declaration/parser/Scope.d.mts +114 -0
- package/declaration/parser/Scope.d.mts.map +1 -0
- package/declaration/parser/StatementParser.d.mts +56 -0
- package/declaration/parser/StatementParser.d.mts.map +1 -0
- package/declaration/parser/TemporalParser.d.mts +211 -0
- package/declaration/parser/TemporalParser.d.mts.map +1 -0
- package/declaration/parser/tokens.d.mts +31 -0
- package/declaration/parser/tokens.d.mts.map +1 -0
- package/declaration/parser/utils.d.mts +10 -0
- package/declaration/parser/utils.d.mts.map +1 -0
- package/declaration/runtime-semantics/AdditiveExpression.d.mts +3 -0
- package/declaration/runtime-semantics/AdditiveExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/ApplyStringOrNumericBinaryOperator.d.mts +5 -0
- package/declaration/runtime-semantics/ApplyStringOrNumericBinaryOperator.d.mts.map +1 -0
- package/declaration/runtime-semantics/ArgumentListEvaluation.d.mts +5 -0
- package/declaration/runtime-semantics/ArgumentListEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/ArrayLiteral.d.mts +5 -0
- package/declaration/runtime-semantics/ArrayLiteral.d.mts.map +1 -0
- package/declaration/runtime-semantics/ArrowFunction.d.mts +4 -0
- package/declaration/runtime-semantics/ArrowFunction.d.mts.map +1 -0
- package/declaration/runtime-semantics/AssignmentExpression.d.mts +8 -0
- package/declaration/runtime-semantics/AssignmentExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/AsyncArrowFunction.d.mts +4 -0
- package/declaration/runtime-semantics/AsyncArrowFunction.d.mts.map +1 -0
- package/declaration/runtime-semantics/AsyncFunctionExpression.d.mts +4 -0
- package/declaration/runtime-semantics/AsyncFunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/AsyncGeneratorExpression.d.mts +4 -0
- package/declaration/runtime-semantics/AsyncGeneratorExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/AwaitExpression.d.mts +5 -0
- package/declaration/runtime-semantics/AwaitExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/BindingInitialization.d.mts +8 -0
- package/declaration/runtime-semantics/BindingInitialization.d.mts.map +1 -0
- package/declaration/runtime-semantics/BitwiseOperators.d.mts +5 -0
- package/declaration/runtime-semantics/BitwiseOperators.d.mts.map +1 -0
- package/declaration/runtime-semantics/Block.d.mts +8 -0
- package/declaration/runtime-semantics/Block.d.mts.map +1 -0
- package/declaration/runtime-semantics/BreakStatement.d.mts +4 -0
- package/declaration/runtime-semantics/BreakStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/BreakableStatement.d.mts +4 -0
- package/declaration/runtime-semantics/BreakableStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/CallExpression.d.mts +5 -0
- package/declaration/runtime-semantics/CallExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/ClassDeclaration.d.mts +8 -0
- package/declaration/runtime-semantics/ClassDeclaration.d.mts.map +1 -0
- package/declaration/runtime-semantics/ClassDefinitionEvaluation.d.mts +88 -0
- package/declaration/runtime-semantics/ClassDefinitionEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/ClassExpression.d.mts +5 -0
- package/declaration/runtime-semantics/ClassExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/ClassFieldDefinitionEvaluation.d.mts +21 -0
- package/declaration/runtime-semantics/ClassFieldDefinitionEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/ClassStaticBlockDefinitionEvaluation.d.mts +13 -0
- package/declaration/runtime-semantics/ClassStaticBlockDefinitionEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/CoalesceExpression.d.mts +5 -0
- package/declaration/runtime-semantics/CoalesceExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/CommaOperator.d.mts +5 -0
- package/declaration/runtime-semantics/CommaOperator.d.mts.map +1 -0
- package/declaration/runtime-semantics/ConditionalExpression.d.mts +5 -0
- package/declaration/runtime-semantics/ConditionalExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/ContinueStatement.d.mts +4 -0
- package/declaration/runtime-semantics/ContinueStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/CreateDynamicFunction.d.mts +4 -0
- package/declaration/runtime-semantics/CreateDynamicFunction.d.mts.map +1 -0
- package/declaration/runtime-semantics/DebuggerStatement.d.mts +5 -0
- package/declaration/runtime-semantics/DebuggerStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/DefineMethod.d.mts +10 -0
- package/declaration/runtime-semantics/DefineMethod.d.mts.map +1 -0
- package/declaration/runtime-semantics/DestructuringAssignmentEvaluation.d.mts +5 -0
- package/declaration/runtime-semantics/DestructuringAssignmentEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/EmptyStatement.d.mts +5 -0
- package/declaration/runtime-semantics/EmptyStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/EqualityExpression.d.mts +6 -0
- package/declaration/runtime-semantics/EqualityExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/EvaluateBody.d.mts +37 -0
- package/declaration/runtime-semantics/EvaluateBody.d.mts.map +1 -0
- package/declaration/runtime-semantics/EvaluateCall.d.mts +5 -0
- package/declaration/runtime-semantics/EvaluateCall.d.mts.map +1 -0
- package/declaration/runtime-semantics/EvaluatePropertyAccess.d.mts +9 -0
- package/declaration/runtime-semantics/EvaluatePropertyAccess.d.mts.map +1 -0
- package/declaration/runtime-semantics/EvaluateStringOrNumericBinaryExpression.d.mts +6 -0
- package/declaration/runtime-semantics/EvaluateStringOrNumericBinaryExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/ExponentiationExpression.d.mts +5 -0
- package/declaration/runtime-semantics/ExponentiationExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/ExportDeclaration.d.mts +11 -0
- package/declaration/runtime-semantics/ExportDeclaration.d.mts.map +1 -0
- package/declaration/runtime-semantics/ExpressionStatement.d.mts +5 -0
- package/declaration/runtime-semantics/ExpressionStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/ForDeclarationBindingInitialization.d.mts +7 -0
- package/declaration/runtime-semantics/ForDeclarationBindingInitialization.d.mts.map +1 -0
- package/declaration/runtime-semantics/FunctionDeclaration.d.mts +5 -0
- package/declaration/runtime-semantics/FunctionDeclaration.d.mts.map +1 -0
- package/declaration/runtime-semantics/FunctionDeclarationInstantiation.d.mts +6 -0
- package/declaration/runtime-semantics/FunctionDeclarationInstantiation.d.mts.map +1 -0
- package/declaration/runtime-semantics/FunctionExpression.d.mts +4 -0
- package/declaration/runtime-semantics/FunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/FunctionStatementList.d.mts +5 -0
- package/declaration/runtime-semantics/FunctionStatementList.d.mts.map +1 -0
- package/declaration/runtime-semantics/GeneratorExpression.d.mts +4 -0
- package/declaration/runtime-semantics/GeneratorExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/GetSubstitution.d.mts +5 -0
- package/declaration/runtime-semantics/GetSubstitution.d.mts.map +1 -0
- package/declaration/runtime-semantics/GlobalDeclarationInstantiation.d.mts +5 -0
- package/declaration/runtime-semantics/GlobalDeclarationInstantiation.d.mts.map +1 -0
- package/declaration/runtime-semantics/HoistableDeclaration.d.mts +5 -0
- package/declaration/runtime-semantics/HoistableDeclaration.d.mts.map +1 -0
- package/declaration/runtime-semantics/IdentifierReference.d.mts +6 -0
- package/declaration/runtime-semantics/IdentifierReference.d.mts.map +1 -0
- package/declaration/runtime-semantics/IfStatement.d.mts +11 -0
- package/declaration/runtime-semantics/IfStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/ImportCall.d.mts +6 -0
- package/declaration/runtime-semantics/ImportCall.d.mts.map +1 -0
- package/declaration/runtime-semantics/ImportDeclaration.d.mts +5 -0
- package/declaration/runtime-semantics/ImportDeclaration.d.mts.map +1 -0
- package/declaration/runtime-semantics/ImportMeta.d.mts +5 -0
- package/declaration/runtime-semantics/ImportMeta.d.mts.map +1 -0
- package/declaration/runtime-semantics/InstantiateArrowFunctionExpression.d.mts +5 -0
- package/declaration/runtime-semantics/InstantiateArrowFunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/InstantiateAsyncArrowFunctionExpression.d.mts +5 -0
- package/declaration/runtime-semantics/InstantiateAsyncArrowFunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/InstantiateAsyncFunctionExpression.d.mts +5 -0
- package/declaration/runtime-semantics/InstantiateAsyncFunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/InstantiateAsyncGeneratorFunctionExpression.d.mts +5 -0
- package/declaration/runtime-semantics/InstantiateAsyncGeneratorFunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/InstantiateFunctionObject.d.mts +12 -0
- package/declaration/runtime-semantics/InstantiateFunctionObject.d.mts.map +1 -0
- package/declaration/runtime-semantics/InstantiateGeneratorFunctionExpression.d.mts +5 -0
- package/declaration/runtime-semantics/InstantiateGeneratorFunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/InstantiateOrdinaryFunctionExpression.d.mts +5 -0
- package/declaration/runtime-semantics/InstantiateOrdinaryFunctionExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/IteratorBindingInitialization.d.mts +7 -0
- package/declaration/runtime-semantics/IteratorBindingInitialization.d.mts.map +1 -0
- package/declaration/runtime-semantics/KeyedBindingInitialization.d.mts +6 -0
- package/declaration/runtime-semantics/KeyedBindingInitialization.d.mts.map +1 -0
- package/declaration/runtime-semantics/LabelledEvaluation.d.mts +7 -0
- package/declaration/runtime-semantics/LabelledEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/LabelledStatement.d.mts +4 -0
- package/declaration/runtime-semantics/LabelledStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/LexicalDeclaration.d.mts +14 -0
- package/declaration/runtime-semantics/LexicalDeclaration.d.mts.map +1 -0
- package/declaration/runtime-semantics/Literal.d.mts +6 -0
- package/declaration/runtime-semantics/Literal.d.mts.map +1 -0
- package/declaration/runtime-semantics/LogicalANDExpression.d.mts +5 -0
- package/declaration/runtime-semantics/LogicalANDExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/LogicalORExpression.d.mts +5 -0
- package/declaration/runtime-semantics/LogicalORExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/MV.d.mts +3 -0
- package/declaration/runtime-semantics/MV.d.mts.map +1 -0
- package/declaration/runtime-semantics/MemberExpression.d.mts +5 -0
- package/declaration/runtime-semantics/MemberExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/MethodDefinitionEvaluation.d.mts +28 -0
- package/declaration/runtime-semantics/MethodDefinitionEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/Module.d.mts +11 -0
- package/declaration/runtime-semantics/Module.d.mts.map +1 -0
- package/declaration/runtime-semantics/ModuleBody.d.mts +4 -0
- package/declaration/runtime-semantics/ModuleBody.d.mts.map +1 -0
- package/declaration/runtime-semantics/MultiplicativeExpression.d.mts +5 -0
- package/declaration/runtime-semantics/MultiplicativeExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/NamedEvaluation.d.mts +4 -0
- package/declaration/runtime-semantics/NamedEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/NewExpression.d.mts +5 -0
- package/declaration/runtime-semantics/NewExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/NewTarget.d.mts +3 -0
- package/declaration/runtime-semantics/NewTarget.d.mts.map +1 -0
- package/declaration/runtime-semantics/NumberToBigInt.d.mts +4 -0
- package/declaration/runtime-semantics/NumberToBigInt.d.mts.map +1 -0
- package/declaration/runtime-semantics/ObjectLiteral.d.mts +5 -0
- package/declaration/runtime-semantics/ObjectLiteral.d.mts.map +1 -0
- package/declaration/runtime-semantics/OptionalExpression.d.mts +5 -0
- package/declaration/runtime-semantics/OptionalExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/ParenthesizedExpression.d.mts +4 -0
- package/declaration/runtime-semantics/ParenthesizedExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/PropertyBindingInitialization.d.mts +6 -0
- package/declaration/runtime-semantics/PropertyBindingInitialization.d.mts.map +1 -0
- package/declaration/runtime-semantics/PropertyDefinitionEvaluation.d.mts +6 -0
- package/declaration/runtime-semantics/PropertyDefinitionEvaluation.d.mts.map +1 -0
- package/declaration/runtime-semantics/PropertyName.d.mts +5 -0
- package/declaration/runtime-semantics/PropertyName.d.mts.map +1 -0
- package/declaration/runtime-semantics/RegExp.d.mts +36 -0
- package/declaration/runtime-semantics/RegExp.d.mts.map +1 -0
- package/declaration/runtime-semantics/RegularExpressionLiteral.d.mts +4 -0
- package/declaration/runtime-semantics/RegularExpressionLiteral.d.mts.map +1 -0
- package/declaration/runtime-semantics/RelationalExpression.d.mts +8 -0
- package/declaration/runtime-semantics/RelationalExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/RestBindingInitialization.d.mts +5 -0
- package/declaration/runtime-semantics/RestBindingInitialization.d.mts.map +1 -0
- package/declaration/runtime-semantics/ReturnStatement.d.mts +6 -0
- package/declaration/runtime-semantics/ReturnStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/Script.d.mts +5 -0
- package/declaration/runtime-semantics/Script.d.mts.map +1 -0
- package/declaration/runtime-semantics/ScriptBody.d.mts +3 -0
- package/declaration/runtime-semantics/ScriptBody.d.mts.map +1 -0
- package/declaration/runtime-semantics/ShiftExpression.d.mts +7 -0
- package/declaration/runtime-semantics/ShiftExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/StatementList.d.mts +5 -0
- package/declaration/runtime-semantics/StatementList.d.mts.map +1 -0
- package/declaration/runtime-semantics/StringIndexOf.d.mts +3 -0
- package/declaration/runtime-semantics/StringIndexOf.d.mts.map +1 -0
- package/declaration/runtime-semantics/StringPad.d.mts +5 -0
- package/declaration/runtime-semantics/StringPad.d.mts.map +1 -0
- package/declaration/runtime-semantics/SuperCall.d.mts +5 -0
- package/declaration/runtime-semantics/SuperCall.d.mts.map +1 -0
- package/declaration/runtime-semantics/SuperProperty.d.mts +5 -0
- package/declaration/runtime-semantics/SuperProperty.d.mts.map +1 -0
- package/declaration/runtime-semantics/SwitchStatement.d.mts +9 -0
- package/declaration/runtime-semantics/SwitchStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/TaggedTemplateExpression.d.mts +5 -0
- package/declaration/runtime-semantics/TaggedTemplateExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/TemplateLiteral.d.mts +5 -0
- package/declaration/runtime-semantics/TemplateLiteral.d.mts.map +1 -0
- package/declaration/runtime-semantics/This.d.mts +5 -0
- package/declaration/runtime-semantics/This.d.mts.map +1 -0
- package/declaration/runtime-semantics/ThrowStatement.d.mts +5 -0
- package/declaration/runtime-semantics/ThrowStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/TrimString.d.mts +5 -0
- package/declaration/runtime-semantics/TrimString.d.mts.map +1 -0
- package/declaration/runtime-semantics/TryStatement.d.mts +10 -0
- package/declaration/runtime-semantics/TryStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/UnaryExpression.d.mts +4 -0
- package/declaration/runtime-semantics/UnaryExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/Unicode.d.mts +166 -0
- package/declaration/runtime-semantics/Unicode.d.mts.map +1 -0
- package/declaration/runtime-semantics/UpdateExpression.d.mts +4 -0
- package/declaration/runtime-semantics/UpdateExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/VariableStatement.d.mts +7 -0
- package/declaration/runtime-semantics/VariableStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/WithStatement.d.mts +10 -0
- package/declaration/runtime-semantics/WithStatement.d.mts.map +1 -0
- package/declaration/runtime-semantics/YieldExpression.d.mts +5 -0
- package/declaration/runtime-semantics/YieldExpression.d.mts.map +1 -0
- package/declaration/runtime-semantics/all.d.mts +110 -0
- package/declaration/runtime-semantics/all.d.mts.map +1 -0
- package/declaration/static-semantics/BodyText.d.mts +4 -0
- package/declaration/static-semantics/BodyText.d.mts.map +1 -0
- package/declaration/static-semantics/BoundNames.d.mts +4 -0
- package/declaration/static-semantics/BoundNames.d.mts.map +1 -0
- package/declaration/static-semantics/CharacterValue.d.mts +6 -0
- package/declaration/static-semantics/CharacterValue.d.mts.map +1 -0
- package/declaration/static-semantics/CodePointAt.d.mts +8 -0
- package/declaration/static-semantics/CodePointAt.d.mts.map +1 -0
- package/declaration/static-semantics/CodePointsToString.d.mts +3 -0
- package/declaration/static-semantics/CodePointsToString.d.mts.map +1 -0
- package/declaration/static-semantics/ConstructorMethod.d.mts +4 -0
- package/declaration/static-semantics/ConstructorMethod.d.mts.map +1 -0
- package/declaration/static-semantics/ContainsArguments.d.mts +4 -0
- package/declaration/static-semantics/ContainsArguments.d.mts.map +1 -0
- package/declaration/static-semantics/ContainsExpression.d.mts +3 -0
- package/declaration/static-semantics/ContainsExpression.d.mts.map +1 -0
- package/declaration/static-semantics/ContainsUsing.d.mts +4 -0
- package/declaration/static-semantics/ContainsUsing.d.mts.map +1 -0
- package/declaration/static-semantics/DeclarationPart.d.mts +3 -0
- package/declaration/static-semantics/DeclarationPart.d.mts.map +1 -0
- package/declaration/static-semantics/ExpectedArgumentCount.d.mts +3 -0
- package/declaration/static-semantics/ExpectedArgumentCount.d.mts.map +1 -0
- package/declaration/static-semantics/ExportEntries.d.mts +14 -0
- package/declaration/static-semantics/ExportEntries.d.mts.map +1 -0
- package/declaration/static-semantics/ExportEntriesForModule.d.mts +5 -0
- package/declaration/static-semantics/ExportEntriesForModule.d.mts.map +1 -0
- package/declaration/static-semantics/FlagText.d.mts +4 -0
- package/declaration/static-semantics/FlagText.d.mts.map +1 -0
- package/declaration/static-semantics/HasInitializer.d.mts +5 -0
- package/declaration/static-semantics/HasInitializer.d.mts.map +1 -0
- package/declaration/static-semantics/HasName.d.mts +3 -0
- package/declaration/static-semantics/HasName.d.mts.map +1 -0
- package/declaration/static-semantics/ImportEntries.d.mts +11 -0
- package/declaration/static-semantics/ImportEntries.d.mts.map +1 -0
- package/declaration/static-semantics/ImportEntriesForModule.d.mts +4 -0
- package/declaration/static-semantics/ImportEntriesForModule.d.mts.map +1 -0
- package/declaration/static-semantics/ImportedLocalNames.d.mts +4 -0
- package/declaration/static-semantics/ImportedLocalNames.d.mts.map +1 -0
- package/declaration/static-semantics/IsAnonymousFunctionDefinition.d.mts +4 -0
- package/declaration/static-semantics/IsAnonymousFunctionDefinition.d.mts.map +1 -0
- package/declaration/static-semantics/IsAwaitUsingDeclaration.d.mts +3 -0
- package/declaration/static-semantics/IsAwaitUsingDeclaration.d.mts.map +1 -0
- package/declaration/static-semantics/IsComputedPropertyKey.d.mts +3 -0
- package/declaration/static-semantics/IsComputedPropertyKey.d.mts.map +1 -0
- package/declaration/static-semantics/IsConstantDeclaration.d.mts +3 -0
- package/declaration/static-semantics/IsConstantDeclaration.d.mts.map +1 -0
- package/declaration/static-semantics/IsDestructuring.d.mts +4 -0
- package/declaration/static-semantics/IsDestructuring.d.mts.map +1 -0
- package/declaration/static-semantics/IsFunctionDefinition.d.mts +6 -0
- package/declaration/static-semantics/IsFunctionDefinition.d.mts.map +1 -0
- package/declaration/static-semantics/IsIdentifierRef.d.mts +3 -0
- package/declaration/static-semantics/IsIdentifierRef.d.mts.map +1 -0
- package/declaration/static-semantics/IsInTailPosition.d.mts +3 -0
- package/declaration/static-semantics/IsInTailPosition.d.mts.map +1 -0
- package/declaration/static-semantics/IsSimpleParameterList.d.mts +3 -0
- package/declaration/static-semantics/IsSimpleParameterList.d.mts.map +1 -0
- package/declaration/static-semantics/IsStatic.d.mts +4 -0
- package/declaration/static-semantics/IsStatic.d.mts.map +1 -0
- package/declaration/static-semantics/IsStrict.d.mts +4 -0
- package/declaration/static-semantics/IsStrict.d.mts.map +1 -0
- package/declaration/static-semantics/IsStringWellFormedUnicode.d.mts +3 -0
- package/declaration/static-semantics/IsStringWellFormedUnicode.d.mts.map +1 -0
- package/declaration/static-semantics/IsUsingDeclaration.d.mts +3 -0
- package/declaration/static-semantics/IsUsingDeclaration.d.mts.map +1 -0
- package/declaration/static-semantics/LexicallyDeclaredNames.d.mts +4 -0
- package/declaration/static-semantics/LexicallyDeclaredNames.d.mts.map +1 -0
- package/declaration/static-semantics/LexicallyScopedDeclarations.d.mts +3 -0
- package/declaration/static-semantics/LexicallyScopedDeclarations.d.mts.map +1 -0
- package/declaration/static-semantics/ModuleRequests.d.mts +22 -0
- package/declaration/static-semantics/ModuleRequests.d.mts.map +1 -0
- package/declaration/static-semantics/NonConstructorElements.d.mts +4 -0
- package/declaration/static-semantics/NonConstructorElements.d.mts.map +1 -0
- package/declaration/static-semantics/NumericValue.d.mts +4 -0
- package/declaration/static-semantics/NumericValue.d.mts.map +1 -0
- package/declaration/static-semantics/PrivateBoundIdentifiers.d.mts +5 -0
- package/declaration/static-semantics/PrivateBoundIdentifiers.d.mts.map +1 -0
- package/declaration/static-semantics/PropName.d.mts +3 -0
- package/declaration/static-semantics/PropName.d.mts.map +1 -0
- package/declaration/static-semantics/StringToCodePoints.d.mts +3 -0
- package/declaration/static-semantics/StringToCodePoints.d.mts.map +1 -0
- package/declaration/static-semantics/StringValue.d.mts +3 -0
- package/declaration/static-semantics/StringValue.d.mts.map +1 -0
- package/declaration/static-semantics/TemplateStrings.d.mts +5 -0
- package/declaration/static-semantics/TemplateStrings.d.mts.map +1 -0
- package/declaration/static-semantics/TopLevelLexicallyDeclaredNames.d.mts +4 -0
- package/declaration/static-semantics/TopLevelLexicallyDeclaredNames.d.mts.map +1 -0
- package/declaration/static-semantics/TopLevelLexicallyScopedDeclarations.d.mts +4 -0
- package/declaration/static-semantics/TopLevelLexicallyScopedDeclarations.d.mts.map +1 -0
- package/declaration/static-semantics/TopLevelVarDeclaredNames.d.mts +4 -0
- package/declaration/static-semantics/TopLevelVarDeclaredNames.d.mts.map +1 -0
- package/declaration/static-semantics/TopLevelVarScopedDeclarations.d.mts +4 -0
- package/declaration/static-semantics/TopLevelVarScopedDeclarations.d.mts.map +1 -0
- package/declaration/static-semantics/UTF16EncodeCodePoint.d.mts +4 -0
- package/declaration/static-semantics/UTF16EncodeCodePoint.d.mts.map +1 -0
- package/declaration/static-semantics/UTF16SurrogatePairToCodePoint.d.mts +4 -0
- package/declaration/static-semantics/UTF16SurrogatePairToCodePoint.d.mts.map +1 -0
- package/declaration/static-semantics/VarDeclaredNames.d.mts +4 -0
- package/declaration/static-semantics/VarDeclaredNames.d.mts.map +1 -0
- package/declaration/static-semantics/VarScopedDeclarations.d.mts +4 -0
- package/declaration/static-semantics/VarScopedDeclarations.d.mts.map +1 -0
- package/declaration/static-semantics/all.d.mts +51 -0
- package/declaration/static-semantics/all.d.mts.map +1 -0
- package/declaration/utils/callback.d.mts +3 -0
- package/declaration/utils/callback.d.mts.map +1 -0
- package/declaration/utils/container.d.mts +54 -0
- package/declaration/utils/container.d.mts.map +1 -0
- package/declaration/utils/internal.d.mts +3 -0
- package/declaration/utils/internal.d.mts.map +1 -0
- package/declaration/utils/language.d.mts +13 -0
- package/declaration/utils/language.d.mts.map +1 -0
- package/declaration/utils/module-loader.d.mts +15 -0
- package/declaration/utils/module-loader.d.mts.map +1 -0
- package/declaration/utils/module-loaders/builtin-loader.d.mts +13 -0
- package/declaration/utils/module-loaders/builtin-loader.d.mts.map +1 -0
- package/declaration/utils/module.d.mts +15 -0
- package/declaration/utils/module.d.mts.map +1 -0
- package/declaration/utils/stack.d.mts +49 -0
- package/declaration/utils/stack.d.mts.map +1 -0
- package/declaration/value.d.mts +276 -0
- package/declaration/value.d.mts.map +1 -0
- package/lib/engine262.d.mts +1 -0
- package/lib/engine262.d.ts +1 -0
- package/lib/engine262.js +80493 -0
- package/lib/engine262.js.map +1 -0
- package/lib/engine262.mjs +79570 -0
- package/lib/engine262.mjs.map +1 -0
- package/lib/inspector/context.d.mts +39 -0
- package/lib/inspector/context.d.mts.map +1 -0
- package/lib/inspector/context.mjs +307 -0
- package/lib/inspector/context.mjs.map +1 -0
- package/lib/inspector/evaluator.d.mts +4 -0
- package/lib/inspector/evaluator.d.mts.map +1 -0
- package/lib/inspector/evaluator.mjs +16 -0
- package/lib/inspector/evaluator.mjs.map +1 -0
- package/lib/inspector/index.d.mts +17 -0
- package/lib/inspector/index.d.mts.map +1 -0
- package/lib/inspector/index.mjs +180 -0
- package/lib/inspector/index.mjs.map +1 -0
- package/lib/inspector/internal-utils.d.mts +4 -0
- package/lib/inspector/internal-utils.d.mts.map +1 -0
- package/lib/inspector/internal-utils.mjs +17 -0
- package/lib/inspector/internal-utils.mjs.map +1 -0
- package/lib/inspector/methods.d.mts +7 -0
- package/lib/inspector/methods.d.mts.map +1 -0
- package/lib/inspector/methods.mjs +368 -0
- package/lib/inspector/methods.mjs.map +1 -0
- package/lib/inspector/objects/RegExp.d.mts +4 -0
- package/lib/inspector/objects/RegExp.d.mts.map +1 -0
- package/lib/inspector/objects/RegExp.mjs +3 -0
- package/lib/inspector/objects/RegExp.mjs.map +1 -0
- package/lib/inspector/objects/arrays.d.mts +8 -0
- package/lib/inspector/objects/arrays.d.mts.map +1 -0
- package/lib/inspector/objects/arrays.mjs +72 -0
- package/lib/inspector/objects/arrays.mjs.map +1 -0
- package/lib/inspector/objects/collections.d.mts +7 -0
- package/lib/inspector/objects/collections.d.mts.map +1 -0
- package/lib/inspector/objects/collections.mjs +32 -0
- package/lib/inspector/objects/collections.mjs.map +1 -0
- package/lib/inspector/objects/dates.d.mts +12 -0
- package/lib/inspector/objects/dates.d.mts.map +1 -0
- package/lib/inspector/objects/dates.mjs +18 -0
- package/lib/inspector/objects/dates.mjs.map +1 -0
- package/lib/inspector/objects/errors.d.mts +4 -0
- package/lib/inspector/objects/errors.d.mts.map +1 -0
- package/lib/inspector/objects/errors.mjs +51 -0
- package/lib/inspector/objects/errors.mjs.map +1 -0
- package/lib/inspector/objects/function.d.mts +4 -0
- package/lib/inspector/objects/function.d.mts.map +1 -0
- package/lib/inspector/objects/function.mjs +137 -0
- package/lib/inspector/objects/function.mjs.map +1 -0
- package/lib/inspector/objects/index.d.mts +13 -0
- package/lib/inspector/objects/index.d.mts.map +1 -0
- package/lib/inspector/objects/index.mjs +84 -0
- package/lib/inspector/objects/index.mjs.map +1 -0
- package/lib/inspector/objects/modules.d.mts +4 -0
- package/lib/inspector/objects/modules.d.mts.map +1 -0
- package/lib/inspector/objects/modules.mjs +57 -0
- package/lib/inspector/objects/modules.mjs.map +1 -0
- package/lib/inspector/objects/objects.d.mts +31 -0
- package/lib/inspector/objects/objects.d.mts.map +1 -0
- package/lib/inspector/objects/objects.mjs +166 -0
- package/lib/inspector/objects/objects.mjs.map +1 -0
- package/lib/inspector/objects/primitives.d.mts +9 -0
- package/lib/inspector/objects/primitives.d.mts.map +1 -0
- package/lib/inspector/objects/primitives.mjs +105 -0
- package/lib/inspector/objects/primitives.mjs.map +1 -0
- package/lib/inspector/objects/promises.d.mts +4 -0
- package/lib/inspector/objects/promises.d.mts.map +1 -0
- package/lib/inspector/objects/promises.mjs +6 -0
- package/lib/inspector/objects/promises.mjs.map +1 -0
- package/lib/inspector/objects/proxies.d.mts +4 -0
- package/lib/inspector/objects/proxies.d.mts.map +1 -0
- package/lib/inspector/objects/proxies.mjs +12 -0
- package/lib/inspector/objects/proxies.mjs.map +1 -0
- package/lib/inspector/objects/shadow-realms.d.mts +4 -0
- package/lib/inspector/objects/shadow-realms.d.mts.map +1 -0
- package/lib/inspector/objects/shadow-realms.mjs +5 -0
- package/lib/inspector/objects/shadow-realms.mjs.map +1 -0
- package/lib/inspector/types.d.mts +223 -0
- package/lib/inspector/types.d.mts.map +1 -0
- package/lib/inspector/types.mjs +2 -0
- package/lib/inspector/types.mjs.map +1 -0
- package/lib/inspector/utils.d.mts +8 -0
- package/lib/inspector/utils.d.mts.map +1 -0
- package/lib/inspector/utils.mjs +61 -0
- package/lib/inspector/utils.mjs.map +1 -0
- package/lib/inspector.d.mts +1 -0
- package/lib/inspector.d.ts +1 -0
- package/lib/inspector.js +1888 -0
- package/lib/inspector.js.map +1 -0
- package/lib/inspector.mjs +1881 -0
- package/lib/inspector.mjs.map +1 -0
- package/lib/node/bin.d.mts +3 -0
- package/lib/node/bin.d.mts.map +1 -0
- package/lib/node/bin.mjs +312 -0
- package/lib/node/bin.mjs.map +1 -0
- package/lib/node/example.d.mts +2 -0
- package/lib/node/example.d.mts.map +1 -0
- package/lib/node/example.mjs +153 -0
- package/lib/node/example.mjs.map +1 -0
- package/lib/node/inspector.d.mts +17 -0
- package/lib/node/inspector.d.mts.map +1 -0
- package/lib/node/inspector.mjs +138 -0
- package/lib/node/inspector.mjs.map +1 -0
- package/lib/node/module.d.mts +23 -0
- package/lib/node/module.d.mts.map +1 -0
- package/lib/node/module.mjs +205 -0
- package/lib/node/module.mjs.map +1 -0
- package/lib/test262-harness.json +45 -0
- package/lib-src/inspector/context.mts +361 -0
- package/lib-src/inspector/evaluator.mts +19 -0
- package/lib-src/inspector/index.mts +209 -0
- package/lib-src/inspector/internal-utils.mts +18 -0
- package/lib-src/inspector/js_protocol.json +3288 -0
- package/lib-src/inspector/methods.mts +400 -0
- package/lib-src/inspector/objects/RegExp.mts +4 -0
- package/lib-src/inspector/objects/arrays.mts +78 -0
- package/lib-src/inspector/objects/collections.mts +37 -0
- package/lib-src/inspector/objects/dates.mts +49 -0
- package/lib-src/inspector/objects/errors.mts +58 -0
- package/lib-src/inspector/objects/function.mts +154 -0
- package/lib-src/inspector/objects/index.mts +134 -0
- package/lib-src/inspector/objects/modules.mts +60 -0
- package/lib-src/inspector/objects/objects.mts +211 -0
- package/lib-src/inspector/objects/primitives.mts +119 -0
- package/lib-src/inspector/objects/promises.mts +6 -0
- package/lib-src/inspector/objects/proxies.mts +12 -0
- package/lib-src/inspector/objects/shadow-realms.mts +6 -0
- package/lib-src/inspector/tsconfig.json +17 -0
- package/lib-src/inspector/types.mts +228 -0
- package/lib-src/inspector/utils.mts +83 -0
- package/lib-src/node/bin.mts +339 -0
- package/lib-src/node/example.mts +173 -0
- package/lib-src/node/inspector.mts +152 -0
- package/lib-src/node/module.mts +233 -0
- package/lib-src/node/tsconfig.json +21 -0
- package/package.json +147 -0
- package/src/abstract-ops/all.mts +38 -0
- package/src/abstract-ops/arguments-operations.mts +246 -0
- package/src/abstract-ops/array-objects.mts +311 -0
- package/src/abstract-ops/arraybuffer-objects.mts +361 -0
- package/src/abstract-ops/async-function-operations.mts +46 -0
- package/src/abstract-ops/async-generator-objects.mts +320 -0
- package/src/abstract-ops/data-types-and-values.mts +43 -0
- package/src/abstract-ops/dataview-objects.mts +147 -0
- package/src/abstract-ops/date-objects.mts +226 -0
- package/src/abstract-ops/disposable-operations.mts +166 -0
- package/src/abstract-ops/error-objects.mts +38 -0
- package/src/abstract-ops/execution-contexts.mts +18 -0
- package/src/abstract-ops/function-operations.mts +740 -0
- package/src/abstract-ops/generator-operations.mts +298 -0
- package/src/abstract-ops/global-object.mts +394 -0
- package/src/abstract-ops/immutable-prototype-objects.mts +21 -0
- package/src/abstract-ops/import-calls.mts +153 -0
- package/src/abstract-ops/iterator-operations.mts +409 -0
- package/src/abstract-ops/keyed-collections.mts +15 -0
- package/src/abstract-ops/math.mts +72 -0
- package/src/abstract-ops/module-namespace-exotic-objects.mts +277 -0
- package/src/abstract-ops/module-records.mts +1044 -0
- package/src/abstract-ops/notational-conventions.mts +67 -0
- package/src/abstract-ops/object-operations.mts +623 -0
- package/src/abstract-ops/objects.mts +453 -0
- package/src/abstract-ops/private-names.mts +170 -0
- package/src/abstract-ops/promise-operations.mts +444 -0
- package/src/abstract-ops/proxy-objects.mts +580 -0
- package/src/abstract-ops/realms.mts +209 -0
- package/src/abstract-ops/reference-operations.mts +211 -0
- package/src/abstract-ops/regexp-objects.mts +310 -0
- package/src/abstract-ops/shadow-realm.mts +216 -0
- package/src/abstract-ops/shared-arraybuffer.mts +8 -0
- package/src/abstract-ops/spec-types.mts +251 -0
- package/src/abstract-ops/string-objects.mts +156 -0
- package/src/abstract-ops/symbol-objects.mts +35 -0
- package/src/abstract-ops/temporal/addition.mts +221 -0
- package/src/abstract-ops/temporal/all.mts +12 -0
- package/src/abstract-ops/temporal/calendar.mts +801 -0
- package/src/abstract-ops/temporal/duration.mts +1015 -0
- package/src/abstract-ops/temporal/instant.mts +174 -0
- package/src/abstract-ops/temporal/not-implemented.mts +15 -0
- package/src/abstract-ops/temporal/now.mts +46 -0
- package/src/abstract-ops/temporal/plain-date-time.mts +242 -0
- package/src/abstract-ops/temporal/plain-date.mts +249 -0
- package/src/abstract-ops/temporal/plain-month-day.mts +86 -0
- package/src/abstract-ops/temporal/plain-time.mts +331 -0
- package/src/abstract-ops/temporal/plain-year-month.mts +195 -0
- package/src/abstract-ops/temporal/temporal.mts +837 -0
- package/src/abstract-ops/temporal/time-zone.mts +304 -0
- package/src/abstract-ops/temporal/zoned-datetime.mts +373 -0
- package/src/abstract-ops/testing-comparison.mts +376 -0
- package/src/abstract-ops/type-conversion.mts +514 -0
- package/src/abstract-ops/typedarray-objects.mts +385 -0
- package/src/abstract-ops/weak-operations.mts +20 -0
- package/src/api.mts +359 -0
- package/src/completion.mts +477 -0
- package/src/ecma402/not-implemented.mts +4 -0
- package/src/evaluator.mts +384 -0
- package/src/execution-context/Agent.mts +481 -0
- package/src/execution-context/Environment.mts +994 -0
- package/src/execution-context/ExecutionContext.mts +248 -0
- package/src/execution-context/Job.mts +64 -0
- package/src/execution-context/PrivateEnvironment.mts +41 -0
- package/src/execution-context/Realm.mts +378 -0
- package/src/execution-context/WeakReference.mts +86 -0
- package/src/execution-context/all.mts +7 -0
- package/src/host-defined/base64.mts +58 -0
- package/src/host-defined/debugger-util.mts +15 -0
- package/src/host-defined/decimal.mts +117 -0
- package/src/host-defined/devtoolsEval.mts +150 -0
- package/src/host-defined/engine.mts +283 -0
- package/src/host-defined/error-messages.mts +637 -0
- package/src/host-defined/event-loop.mts +311 -0
- package/src/host-defined/ieee754.mts +212 -0
- package/src/host-defined/inspect.mts +250 -0
- package/src/host-defined/job-queue.mts +191 -0
- package/src/host-defined/sort.mts +860 -0
- package/src/host-defined/test262-intrinsics.mts +167 -0
- package/src/index.mts +66 -0
- package/src/intrinsics/AbstractModuleSource.mts +47 -0
- package/src/intrinsics/AggregateError.mts +66 -0
- package/src/intrinsics/AggregateErrorPrototype.mts +12 -0
- package/src/intrinsics/Array.mts +302 -0
- package/src/intrinsics/ArrayBuffer.mts +48 -0
- package/src/intrinsics/ArrayBufferPrototype.mts +189 -0
- package/src/intrinsics/ArrayIteratorPrototype.mts +23 -0
- package/src/intrinsics/ArrayPrototype.mts +688 -0
- package/src/intrinsics/ArrayPrototypeShared.mts +572 -0
- package/src/intrinsics/AsyncDisposableStack.mts +36 -0
- package/src/intrinsics/AsyncDisposableStackPrototype.mts +103 -0
- package/src/intrinsics/AsyncFromSyncIteratorPrototype.mts +165 -0
- package/src/intrinsics/AsyncFunction.mts +33 -0
- package/src/intrinsics/AsyncFunctionPrototype.mts +8 -0
- package/src/intrinsics/AsyncGeneratorFunction.mts +39 -0
- package/src/intrinsics/AsyncGeneratorFunctionPrototype.mts +19 -0
- package/src/intrinsics/AsyncGeneratorFunctionPrototypePrototype.mts +148 -0
- package/src/intrinsics/AsyncIteratorPrototype.mts +56 -0
- package/src/intrinsics/BigInt.mts +69 -0
- package/src/intrinsics/BigIntPrototype.mts +64 -0
- package/src/intrinsics/Boolean.mts +47 -0
- package/src/intrinsics/BooleanPrototype.mts +56 -0
- package/src/intrinsics/DataView.mts +81 -0
- package/src/intrinsics/DataViewPrototype.mts +284 -0
- package/src/intrinsics/Date.mts +243 -0
- package/src/intrinsics/DatePrototype.mts +771 -0
- package/src/intrinsics/DisposableStack.mts +41 -0
- package/src/intrinsics/DisposableStackPrototype.mts +103 -0
- package/src/intrinsics/Error.mts +106 -0
- package/src/intrinsics/ErrorPrototype.mts +100 -0
- package/src/intrinsics/FinalizationRegistry.mts +69 -0
- package/src/intrinsics/FinalizationRegistryPrototype.mts +110 -0
- package/src/intrinsics/ForInIteratorPrototype.mts +120 -0
- package/src/intrinsics/Function.mts +24 -0
- package/src/intrinsics/FunctionPrototype.mts +232 -0
- package/src/intrinsics/GeneratorFunction.mts +38 -0
- package/src/intrinsics/GeneratorFunctionPrototype.mts +22 -0
- package/src/intrinsics/GeneratorFunctionPrototypePrototype.mts +59 -0
- package/src/intrinsics/Iterator.mts +302 -0
- package/src/intrinsics/IteratorHelperPrototype.mts +61 -0
- package/src/intrinsics/IteratorPrototype.mts +700 -0
- package/src/intrinsics/JSON.mts +740 -0
- package/src/intrinsics/Map.mts +129 -0
- package/src/intrinsics/MapIteratorPrototype.mts +81 -0
- package/src/intrinsics/MapPrototype.mts +295 -0
- package/src/intrinsics/Math.mts +605 -0
- package/src/intrinsics/NativeError.mts +86 -0
- package/src/intrinsics/Number.mts +135 -0
- package/src/intrinsics/NumberPrototype.mts +116 -0
- package/src/intrinsics/Object.mts +466 -0
- package/src/intrinsics/ObjectPrototype.mts +333 -0
- package/src/intrinsics/Promise.mts +807 -0
- package/src/intrinsics/PromisePrototype.mts +126 -0
- package/src/intrinsics/Proxy.mts +101 -0
- package/src/intrinsics/Reflect.mts +211 -0
- package/src/intrinsics/RegExp.mts +166 -0
- package/src/intrinsics/RegExpPrototype.mts +762 -0
- package/src/intrinsics/RegExpStringIteratorPrototype.mts +73 -0
- package/src/intrinsics/Set.mts +75 -0
- package/src/intrinsics/SetIteratorPrototype.mts +78 -0
- package/src/intrinsics/SetPrototype.mts +684 -0
- package/src/intrinsics/ShadowRealm.mts +71 -0
- package/src/intrinsics/ShadowRealmPrototype.mts +47 -0
- package/src/intrinsics/String.mts +138 -0
- package/src/intrinsics/StringIteratorPrototype.mts +23 -0
- package/src/intrinsics/StringPrototype.mts +813 -0
- package/src/intrinsics/SuppressedError.mts +53 -0
- package/src/intrinsics/SuppressedErrorPrototype.mts +11 -0
- package/src/intrinsics/Symbol.mts +99 -0
- package/src/intrinsics/SymbolPrototype.mts +81 -0
- package/src/intrinsics/Temporal/Duration.mts +140 -0
- package/src/intrinsics/Temporal/DurationPrototype.mts +425 -0
- package/src/intrinsics/Temporal/Instant.mts +90 -0
- package/src/intrinsics/Temporal/InstantPrototype.mts +211 -0
- package/src/intrinsics/Temporal/Now.mts +66 -0
- package/src/intrinsics/Temporal/PlainDate.mts +79 -0
- package/src/intrinsics/Temporal/PlainDatePrototype.mts +331 -0
- package/src/intrinsics/Temporal/PlainDateTime.mts +113 -0
- package/src/intrinsics/Temporal/PlainDateTimePrototype.mts +418 -0
- package/src/intrinsics/Temporal/PlainMonthDay.mts +81 -0
- package/src/intrinsics/Temporal/PlainMonthDayPrototype.mts +139 -0
- package/src/intrinsics/Temporal/PlainTime.mts +74 -0
- package/src/intrinsics/Temporal/PlainTimePrototype.mts +224 -0
- package/src/intrinsics/Temporal/PlainYearMonth.mts +96 -0
- package/src/intrinsics/Temporal/PlainYearMonthPrototype.mts +223 -0
- package/src/intrinsics/Temporal/Temporal.mts +30 -0
- package/src/intrinsics/Temporal/ZonedDateTime.mts +103 -0
- package/src/intrinsics/Temporal/ZonedDateTimePrototype.mts +601 -0
- package/src/intrinsics/ThrowTypeError.mts +21 -0
- package/src/intrinsics/TypedArray.mts +585 -0
- package/src/intrinsics/TypedArrayConstructors.mts +85 -0
- package/src/intrinsics/TypedArrayPrototype.mts +600 -0
- package/src/intrinsics/TypedArrayPrototypes.mts +17 -0
- package/src/intrinsics/TypedArray_Uint8Array.mts +438 -0
- package/src/intrinsics/URIHandling.mts +277 -0
- package/src/intrinsics/WeakMap.mts +56 -0
- package/src/intrinsics/WeakMapPrototype.mts +203 -0
- package/src/intrinsics/WeakRef.mts +43 -0
- package/src/intrinsics/WeakRefPrototype.mts +23 -0
- package/src/intrinsics/WeakSet.mts +66 -0
- package/src/intrinsics/WeakSetPrototype.mts +100 -0
- package/src/intrinsics/WrapForValidIteratorPrototype.mts +65 -0
- package/src/intrinsics/bootstrap.mts +153 -0
- package/src/intrinsics/eval.mts +16 -0
- package/src/intrinsics/isFinite.mts +23 -0
- package/src/intrinsics/isNaN.mts +23 -0
- package/src/intrinsics/parseFloat.mts +78 -0
- package/src/intrinsics/parseInt.mts +85 -0
- package/src/modules.mts +1088 -0
- package/src/parse.mts +267 -0
- package/src/parser/BaseParser.mts +36 -0
- package/src/parser/ExpressionParser.mts +1697 -0
- package/src/parser/FunctionParser.mts +398 -0
- package/src/parser/IdentifierParser.mts +149 -0
- package/src/parser/LanguageParser.mts +140 -0
- package/src/parser/Lexer.mts +1190 -0
- package/src/parser/ModuleParser.mts +429 -0
- package/src/parser/ParseNode.mts +2923 -0
- package/src/parser/Parser.mts +88 -0
- package/src/parser/RegExpParser.mts +1428 -0
- package/src/parser/Scope.mts +571 -0
- package/src/parser/StatementParser.mts +1160 -0
- package/src/parser/TemporalParser.mts +1245 -0
- package/src/parser/tokens.mts +210 -0
- package/src/parser/unicode.d.ts +20 -0
- package/src/parser/utils.mts +114 -0
- package/src/runtime-semantics/AdditiveExpression.mts +29 -0
- package/src/runtime-semantics/ApplyStringOrNumericBinaryOperator.mts +78 -0
- package/src/runtime-semantics/ArgumentListEvaluation.mts +178 -0
- package/src/runtime-semantics/ArrayLiteral.mts +99 -0
- package/src/runtime-semantics/ArrowFunction.mts +8 -0
- package/src/runtime-semantics/AssignmentExpression.mts +284 -0
- package/src/runtime-semantics/AsyncArrowFunction.mts +8 -0
- package/src/runtime-semantics/AsyncFunctionExpression.mts +11 -0
- package/src/runtime-semantics/AsyncGeneratorExpression.mts +11 -0
- package/src/runtime-semantics/AwaitExpression.mts +16 -0
- package/src/runtime-semantics/BindingInitialization.mts +91 -0
- package/src/runtime-semantics/BitwiseOperators.mts +14 -0
- package/src/runtime-semantics/Block.mts +73 -0
- package/src/runtime-semantics/BreakStatement.mts +18 -0
- package/src/runtime-semantics/BreakableStatement.mts +18 -0
- package/src/runtime-semantics/CallExpression.mts +57 -0
- package/src/runtime-semantics/ClassDeclaration.mts +41 -0
- package/src/runtime-semantics/ClassDefinitionEvaluation.mts +811 -0
- package/src/runtime-semantics/ClassExpression.mts +24 -0
- package/src/runtime-semantics/ClassFieldDefinitionEvaluation.mts +189 -0
- package/src/runtime-semantics/ClassStaticBlockDefinitionEvaluation.mts +48 -0
- package/src/runtime-semantics/CoalesceExpression.mts +24 -0
- package/src/runtime-semantics/CommaOperator.mts +18 -0
- package/src/runtime-semantics/ConditionalExpression.mts +31 -0
- package/src/runtime-semantics/ContinueStatement.mts +18 -0
- package/src/runtime-semantics/CreateDynamicFunction.mts +161 -0
- package/src/runtime-semantics/DebuggerStatement.mts +20 -0
- package/src/runtime-semantics/DefineMethod.mts +42 -0
- package/src/runtime-semantics/DestructuringAssignmentEvaluation.mts +306 -0
- package/src/runtime-semantics/EmptyStatement.mts +9 -0
- package/src/runtime-semantics/EqualityExpression.mts +60 -0
- package/src/runtime-semantics/EvaluateBody.mts +211 -0
- package/src/runtime-semantics/EvaluateCall.mts +67 -0
- package/src/runtime-semantics/EvaluatePropertyAccess.mts +39 -0
- package/src/runtime-semantics/EvaluateStringOrNumericBinaryExpression.mts +19 -0
- package/src/runtime-semantics/ExponentiationExpression.mts +11 -0
- package/src/runtime-semantics/ExportDeclaration.mts +100 -0
- package/src/runtime-semantics/ExpressionStatement.mts +14 -0
- package/src/runtime-semantics/ForDeclarationBindingInitialization.mts +21 -0
- package/src/runtime-semantics/FunctionDeclaration.mts +10 -0
- package/src/runtime-semantics/FunctionDeclarationInstantiation.mts +273 -0
- package/src/runtime-semantics/FunctionExpression.mts +10 -0
- package/src/runtime-semantics/FunctionStatementList.mts +17 -0
- package/src/runtime-semantics/GeneratorExpression.mts +11 -0
- package/src/runtime-semantics/GetSubstitution.mts +90 -0
- package/src/runtime-semantics/GlobalDeclarationInstantiation.mts +140 -0
- package/src/runtime-semantics/HoistableDeclaration.mts +12 -0
- package/src/runtime-semantics/IdentifierReference.mts +15 -0
- package/src/runtime-semantics/IfStatement.mts +49 -0
- package/src/runtime-semantics/ImportCall.mts +137 -0
- package/src/runtime-semantics/ImportDeclaration.mts +9 -0
- package/src/runtime-semantics/ImportMeta.mts +45 -0
- package/src/runtime-semantics/InstantiateArrowFunctionExpression.mts +36 -0
- package/src/runtime-semantics/InstantiateAsyncArrowFunctionExpression.mts +38 -0
- package/src/runtime-semantics/InstantiateAsyncFunctionExpression.mts +75 -0
- package/src/runtime-semantics/InstantiateAsyncGeneratorFunctionExpression.mts +90 -0
- package/src/runtime-semantics/InstantiateFunctionObject.mts +123 -0
- package/src/runtime-semantics/InstantiateGeneratorFunctionExpression.mts +82 -0
- package/src/runtime-semantics/InstantiateOrdinaryFunctionExpression.mts +64 -0
- package/src/runtime-semantics/IteratorBindingInitialization.mts +212 -0
- package/src/runtime-semantics/KeyedBindingInitialization.mts +61 -0
- package/src/runtime-semantics/LabelledEvaluation.mts +749 -0
- package/src/runtime-semantics/LabelledStatement.mts +11 -0
- package/src/runtime-semantics/LexicalDeclaration.mts +114 -0
- package/src/runtime-semantics/Literal.mts +36 -0
- package/src/runtime-semantics/LogicalANDExpression.mts +25 -0
- package/src/runtime-semantics/LogicalORExpression.mts +25 -0
- package/src/runtime-semantics/MV.mts +10 -0
- package/src/runtime-semantics/MemberExpression.mts +71 -0
- package/src/runtime-semantics/MethodDefinitionEvaluation.mts +364 -0
- package/src/runtime-semantics/Module.mts +15 -0
- package/src/runtime-semantics/ModuleBody.mts +10 -0
- package/src/runtime-semantics/MultiplicativeExpression.mts +18 -0
- package/src/runtime-semantics/NamedEvaluation.mts +97 -0
- package/src/runtime-semantics/NewExpression.mts +51 -0
- package/src/runtime-semantics/NewTarget.mts +8 -0
- package/src/runtime-semantics/NumberToBigInt.mts +16 -0
- package/src/runtime-semantics/ObjectLiteral.mts +25 -0
- package/src/runtime-semantics/OptionalExpression.mts +129 -0
- package/src/runtime-semantics/ParenthesizedExpression.mts +8 -0
- package/src/runtime-semantics/PropertyBindingInitialization.mts +45 -0
- package/src/runtime-semantics/PropertyDefinitionEvaluation.mts +132 -0
- package/src/runtime-semantics/PropertyName.mts +62 -0
- package/src/runtime-semantics/RegExp.mts +1344 -0
- package/src/runtime-semantics/RegularExpressionLiteral.mts +16 -0
- package/src/runtime-semantics/RelationalExpression.mts +150 -0
- package/src/runtime-semantics/RestBindingInitialization.mts +29 -0
- package/src/runtime-semantics/ReturnStatement.mts +32 -0
- package/src/runtime-semantics/Script.mts +15 -0
- package/src/runtime-semantics/ScriptBody.mts +7 -0
- package/src/runtime-semantics/ShiftExpression.mts +17 -0
- package/src/runtime-semantics/StatementList.mts +33 -0
- package/src/runtime-semantics/StringIndexOf.mts +43 -0
- package/src/runtime-semantics/StringPad.mts +34 -0
- package/src/runtime-semantics/SuperCall.mts +65 -0
- package/src/runtime-semantics/SuperProperty.mts +58 -0
- package/src/runtime-semantics/SwitchStatement.mts +214 -0
- package/src/runtime-semantics/TaggedTemplateExpression.mts +23 -0
- package/src/runtime-semantics/TemplateLiteral.mts +34 -0
- package/src/runtime-semantics/This.mts +9 -0
- package/src/runtime-semantics/ThrowStatement.mts +23 -0
- package/src/runtime-semantics/TrimString.mts +19 -0
- package/src/runtime-semantics/TryStatement.mts +119 -0
- package/src/runtime-semantics/UnaryExpression.mts +218 -0
- package/src/runtime-semantics/Unicode.mts +268 -0
- package/src/runtime-semantics/UpdateExpression.mts +126 -0
- package/src/runtime-semantics/VariableStatement.mts +72 -0
- package/src/runtime-semantics/WithStatement.mts +33 -0
- package/src/runtime-semantics/YieldExpression.mts +175 -0
- package/src/runtime-semantics/all.mts +109 -0
- package/src/static-semantics/BodyText.mts +7 -0
- package/src/static-semantics/BoundNames.mts +108 -0
- package/src/static-semantics/CharacterValue.mts +112 -0
- package/src/static-semantics/CodePointAt.mts +53 -0
- package/src/static-semantics/CodePointsToString.mts +15 -0
- package/src/static-semantics/ConstructorMethod.mts +10 -0
- package/src/static-semantics/ContainsArguments.mts +33 -0
- package/src/static-semantics/ContainsExpression.mts +59 -0
- package/src/static-semantics/ContainsUsing.mts +15 -0
- package/src/static-semantics/DeclarationPart.mts +5 -0
- package/src/static-semantics/ExpectedArgumentCount.mts +26 -0
- package/src/static-semantics/ExportEntries.mts +183 -0
- package/src/static-semantics/ExportEntriesForModule.mts +79 -0
- package/src/static-semantics/FlagText.mts +7 -0
- package/src/static-semantics/HasInitializer.mts +5 -0
- package/src/static-semantics/HasName.mts +8 -0
- package/src/static-semantics/ImportEntries.mts +49 -0
- package/src/static-semantics/ImportEntriesForModule.mts +110 -0
- package/src/static-semantics/ImportedLocalNames.mts +14 -0
- package/src/static-semantics/IsAnonymousFunctionDefinition.mts +18 -0
- package/src/static-semantics/IsAwaitUsingDeclaration.mts +12 -0
- package/src/static-semantics/IsComputedPropertyKey.mts +7 -0
- package/src/static-semantics/IsConstantDeclaration.mts +11 -0
- package/src/static-semantics/IsDestructuring.mts +21 -0
- package/src/static-semantics/IsFunctionDefinition.mts +15 -0
- package/src/static-semantics/IsIdentifierRef.mts +5 -0
- package/src/static-semantics/IsInTailPosition.mts +5 -0
- package/src/static-semantics/IsSimpleParameterList.mts +23 -0
- package/src/static-semantics/IsStatic.mts +10 -0
- package/src/static-semantics/IsStrict.mts +7 -0
- package/src/static-semantics/IsStringWellFormedUnicode.mts +24 -0
- package/src/static-semantics/IsUsingDeclaration.mts +12 -0
- package/src/static-semantics/LexicallyDeclaredNames.mts +26 -0
- package/src/static-semantics/LexicallyScopedDeclarations.mts +84 -0
- package/src/static-semantics/ModuleRequests.mts +185 -0
- package/src/static-semantics/NonConstructorElements.mts +15 -0
- package/src/static-semantics/NumericValue.mts +7 -0
- package/src/static-semantics/PrivateBoundIdentifiers.mts +23 -0
- package/src/static-semantics/PropName.mts +23 -0
- package/src/static-semantics/StringToCodePoints.mts +22 -0
- package/src/static-semantics/StringValue.mts +19 -0
- package/src/static-semantics/TemplateStrings.mts +109 -0
- package/src/static-semantics/TopLevelLexicallyDeclaredNames.mts +23 -0
- package/src/static-semantics/TopLevelLexicallyScopedDeclarations.mts +27 -0
- package/src/static-semantics/TopLevelVarDeclaredNames.mts +28 -0
- package/src/static-semantics/TopLevelVarScopedDeclarations.mts +36 -0
- package/src/static-semantics/UTF16EncodeCodePoint.mts +19 -0
- package/src/static-semantics/UTF16SurrogatePairToCodePoint.mts +12 -0
- package/src/static-semantics/VarDeclaredNames.mts +109 -0
- package/src/static-semantics/VarScopedDeclarations.mts +115 -0
- package/src/static-semantics/all.mts +50 -0
- package/src/tsconfig.json +12 -0
- package/src/unicode/.gitkeep +0 -0
- package/src/unicode/CodePointProperties.json +1 -0
- package/src/unicode/PropertyValueAliases.json +434 -0
- package/src/unicode/SequenceProperties.json +1 -0
- package/src/utils/callback.mts +7 -0
- package/src/utils/container.mts +284 -0
- package/src/utils/internal.mts +2 -0
- package/src/utils/language.mts +35 -0
- package/src/utils/module-loader.mts +73 -0
- package/src/utils/module-loaders/builtin-loader.mts +84 -0
- package/src/utils/module.mts +75 -0
- package/src/utils/stack.mts +324 -0
- package/src/value.mts +996 -0
|
@@ -0,0 +1,1697 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TV,
|
|
3
|
+
PropName,
|
|
4
|
+
StringValue,
|
|
5
|
+
IsComputedPropertyKey,
|
|
6
|
+
ContainsArguments,
|
|
7
|
+
} from '../static-semantics/all.mts';
|
|
8
|
+
import type { Mutable } from '../utils/language.mts';
|
|
9
|
+
import {
|
|
10
|
+
Token,
|
|
11
|
+
isPropertyOrCall,
|
|
12
|
+
isMember,
|
|
13
|
+
isKeywordRaw,
|
|
14
|
+
isAutomaticSemicolon,
|
|
15
|
+
isKeyword,
|
|
16
|
+
} from './tokens.mts';
|
|
17
|
+
import { isLineTerminator, type TokenData } from './Lexer.mts';
|
|
18
|
+
import { FunctionParser, FunctionKind } from './FunctionParser.mts';
|
|
19
|
+
import { RegExpParser, type RegExpParserContext } from './RegExpParser.mts';
|
|
20
|
+
import type { Location, ParseNode } from './ParseNode.mts';
|
|
21
|
+
import { surroundingAgent, type Feature } from '#self';
|
|
22
|
+
import { Throw } from '#self';
|
|
23
|
+
|
|
24
|
+
export abstract class ExpressionParser extends FunctionParser {
|
|
25
|
+
protected abstract readonly state: {
|
|
26
|
+
hasTopLevelAwait: boolean;
|
|
27
|
+
strict: boolean;
|
|
28
|
+
json: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
abstract parseBindingPattern(): ParseNode.BindingPattern;
|
|
32
|
+
|
|
33
|
+
abstract markNodeStart(node: ParseNode.BaseParseNode | ParseNode.Unfinished): void;
|
|
34
|
+
|
|
35
|
+
abstract parseInitializerOpt(): ParseNode.Initializer | null;
|
|
36
|
+
|
|
37
|
+
abstract semicolon(): void;
|
|
38
|
+
|
|
39
|
+
abstract feature(name: Feature): boolean;
|
|
40
|
+
|
|
41
|
+
protected getLocation(inheritStart?: ParseNode.BaseParseNode): Location {
|
|
42
|
+
return {
|
|
43
|
+
startIndex: inheritStart ? inheritStart.location.startIndex : this.peekToken.startIndex,
|
|
44
|
+
endIndex: -1,
|
|
45
|
+
start: inheritStart ? { ...inheritStart.location.start } : {
|
|
46
|
+
line: this.peekToken.line,
|
|
47
|
+
column: this.peekToken.column,
|
|
48
|
+
},
|
|
49
|
+
end: {
|
|
50
|
+
line: -1,
|
|
51
|
+
column: -1,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected markLocationEnd(node: Pick<ParseNode.Unfinished, 'location'>) {
|
|
57
|
+
node.location.endIndex = this.currentToken.endIndex;
|
|
58
|
+
node.location.end.line = this.currentToken.line;
|
|
59
|
+
node.location.end.column = this.currentToken.column;
|
|
60
|
+
return node;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private isParsingArrowParameterCandidate() {
|
|
64
|
+
if (this.scope.inParameters()) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
if (this.scope.inArrowParameterCandidate() && !this.scope.inArrowBody()) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return this.scope.assignmentInfoStack.some((info) => info.type === 'arrow');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Expression :
|
|
74
|
+
// AssignmentExpression
|
|
75
|
+
// Expression `,` AssignmentExpression
|
|
76
|
+
parseExpression(): ParseNode.Expression {
|
|
77
|
+
const AssignmentExpression = this.parseAssignmentExpression();
|
|
78
|
+
if (this.eat(Token.COMMA)) {
|
|
79
|
+
const CommaOperator = this.startNode<ParseNode.CommaOperator>(AssignmentExpression);
|
|
80
|
+
const ExpressionList = [AssignmentExpression];
|
|
81
|
+
do {
|
|
82
|
+
ExpressionList.push(this.parseAssignmentExpression());
|
|
83
|
+
} while (this.eat(Token.COMMA));
|
|
84
|
+
CommaOperator.ExpressionList = ExpressionList;
|
|
85
|
+
return this.finishNode(CommaOperator, 'CommaOperator');
|
|
86
|
+
}
|
|
87
|
+
return AssignmentExpression;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// AssignmentExpression :
|
|
91
|
+
// ConditionalExpression
|
|
92
|
+
// [+Yield] YieldExpression
|
|
93
|
+
// ArrowFunction
|
|
94
|
+
// AsyncArrowFunction
|
|
95
|
+
// LeftHandSideExpression `=` AssignmentExpression
|
|
96
|
+
// LeftHandSideExpression AssignmentOperator AssignmentExpression
|
|
97
|
+
// LeftHandSideExpression LogicalAssignmentOperator AssignmentExpression
|
|
98
|
+
//
|
|
99
|
+
// AssignmentOperator : one of
|
|
100
|
+
// *= /= %= += -= <<= >>= >>>= &= ^= |= **=
|
|
101
|
+
//
|
|
102
|
+
// LogicalAssignmentOperator : one of
|
|
103
|
+
// &&= ||= ??=
|
|
104
|
+
parseAssignmentExpression(): ParseNode.AssignmentExpressionOrHigher {
|
|
105
|
+
if (this.test(Token.YIELD) && this.scope.hasYield()) {
|
|
106
|
+
return this.parseYieldExpression();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.scope.pushAssignmentInfo('assign');
|
|
110
|
+
const left = this.parseConditionalExpression();
|
|
111
|
+
const assignmentInfo = this.scope.popAssignmentInfo();
|
|
112
|
+
|
|
113
|
+
if (left.type === 'IdentifierReference') {
|
|
114
|
+
// `async` [no LineTerminator here] IdentifierReference [no LineTerminator here] `=>`
|
|
115
|
+
if (left.name === 'async'
|
|
116
|
+
&& !left.escaped
|
|
117
|
+
&& this.test(Token.IDENTIFIER)
|
|
118
|
+
&& !this.peek().hadLineTerminatorBefore
|
|
119
|
+
&& this.testAhead(Token.ARROW)
|
|
120
|
+
&& !this.peekAhead().hadLineTerminatorBefore) {
|
|
121
|
+
assignmentInfo.clear();
|
|
122
|
+
const node = this.startNode<ParseNode.AsyncArrowFunction>(left);
|
|
123
|
+
return this.parseArrowFunction(node, {
|
|
124
|
+
Arguments: [this.parseIdentifierReference()],
|
|
125
|
+
}, FunctionKind.ASYNC);
|
|
126
|
+
}
|
|
127
|
+
// IdentifierReference [no LineTerminator here] `=>`
|
|
128
|
+
if (this.test(Token.ARROW) && !this.peek().hadLineTerminatorBefore) {
|
|
129
|
+
assignmentInfo.clear();
|
|
130
|
+
const node = this.startNode<ParseNode.ArrowFunction>(left);
|
|
131
|
+
return this.parseArrowFunction(node, { Arguments: [left] }, FunctionKind.NORMAL);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// `async` [no LineTerminator here] Arguments [no LineTerminator here] `=>`
|
|
136
|
+
if (left.type === 'CallExpression' && left.arrowInfo && this.test(Token.ARROW)
|
|
137
|
+
&& !this.peek().hadLineTerminatorBefore) {
|
|
138
|
+
const last = left.Arguments[left.Arguments.length - 1];
|
|
139
|
+
if (!left.arrowInfo.hasTrailingComma || (last && last.type !== 'AssignmentRestElement')) {
|
|
140
|
+
assignmentInfo.clear();
|
|
141
|
+
const node = this.startNode<ParseNode.AsyncArrowFunction>(left);
|
|
142
|
+
return this.parseArrowFunction(node, left, FunctionKind.ASYNC);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (left.type === 'CoverParenthesizedExpressionAndArrowParameterList') {
|
|
147
|
+
assignmentInfo.clear();
|
|
148
|
+
const node = this.startNode<ParseNode.ArrowFunction>(left);
|
|
149
|
+
return this.parseArrowFunction(node, left, FunctionKind.NORMAL);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
switch (this.peek().type) {
|
|
153
|
+
case Token.ASSIGN:
|
|
154
|
+
case Token.ASSIGN_MUL:
|
|
155
|
+
case Token.ASSIGN_DIV:
|
|
156
|
+
case Token.ASSIGN_MOD:
|
|
157
|
+
case Token.ASSIGN_ADD:
|
|
158
|
+
case Token.ASSIGN_SUB:
|
|
159
|
+
case Token.ASSIGN_SHL:
|
|
160
|
+
case Token.ASSIGN_SAR:
|
|
161
|
+
case Token.ASSIGN_SHR:
|
|
162
|
+
case Token.ASSIGN_BIT_AND:
|
|
163
|
+
case Token.ASSIGN_BIT_XOR:
|
|
164
|
+
case Token.ASSIGN_BIT_OR:
|
|
165
|
+
case Token.ASSIGN_EXP:
|
|
166
|
+
case Token.ASSIGN_AND:
|
|
167
|
+
case Token.ASSIGN_OR:
|
|
168
|
+
case Token.ASSIGN_NULLISH: {
|
|
169
|
+
assignmentInfo.clear();
|
|
170
|
+
const node = this.startNode<ParseNode.AssignmentExpression>(left);
|
|
171
|
+
this.validateAssignmentTarget(left);
|
|
172
|
+
node.LeftHandSideExpression = left;
|
|
173
|
+
// NOTE: This cast isn't strictly sound as it depends on an expectation that `this.next.value` is correlated
|
|
174
|
+
// to `this.peek().type` which cannot be verified by the type system.
|
|
175
|
+
node.AssignmentOperator = this.next().value as ParseNode.AssignmentExpression['AssignmentOperator'];
|
|
176
|
+
node.AssignmentExpression = this.parseAssignmentExpression();
|
|
177
|
+
return this.finishNode(node, 'AssignmentExpression');
|
|
178
|
+
}
|
|
179
|
+
default:
|
|
180
|
+
return left;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
validateAssignmentTarget(node: ParseNode) {
|
|
185
|
+
switch (node.type) {
|
|
186
|
+
case 'IdentifierReference':
|
|
187
|
+
if (this.isStrictMode() && (node.name === 'eval' || node.name === 'arguments')) {
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
case 'CoverInitializedName':
|
|
192
|
+
this.validateAssignmentTarget(node.IdentifierReference);
|
|
193
|
+
return;
|
|
194
|
+
case 'MemberExpression':
|
|
195
|
+
if (node.MemberExpression.type === 'ObjectLiteral'
|
|
196
|
+
&& node.MemberExpression.PropertyDefinitionList.some((p) => p.type === 'CoverInitializedName')) {
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
return;
|
|
200
|
+
case 'SuperProperty':
|
|
201
|
+
return;
|
|
202
|
+
case 'ParenthesizedExpression':
|
|
203
|
+
if (node.Expression.type === 'ObjectLiteral' || node.Expression.type === 'ArrayLiteral') {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
this.validateAssignmentTarget(node.Expression);
|
|
207
|
+
return;
|
|
208
|
+
case 'ArrayLiteral':
|
|
209
|
+
node.ElementList.forEach((p, i) => {
|
|
210
|
+
if (p.type === 'SpreadElement' && (i !== node.ElementList.length - 1 || node.hasTrailingComma)) {
|
|
211
|
+
this.addEarlyError(Throw.SyntaxError('Spread element must be last element'), p);
|
|
212
|
+
}
|
|
213
|
+
if (p.type === 'AssignmentExpression') {
|
|
214
|
+
this.validateAssignmentTarget(p.LeftHandSideExpression);
|
|
215
|
+
} else {
|
|
216
|
+
this.validateAssignmentTarget(p);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
return;
|
|
220
|
+
case 'ObjectLiteral':
|
|
221
|
+
node.PropertyDefinitionList.forEach((p, i) => {
|
|
222
|
+
if (p.type === 'PropertyDefinition' && !p.PropertyName
|
|
223
|
+
&& (i !== node.PropertyDefinitionList.length - 1 || node.hasTrailingComma)) {
|
|
224
|
+
this.addEarlyError(Throw.SyntaxError('Rest property must be last property'), p);
|
|
225
|
+
}
|
|
226
|
+
this.validateAssignmentTarget(p);
|
|
227
|
+
});
|
|
228
|
+
return;
|
|
229
|
+
case 'PropertyDefinition':
|
|
230
|
+
if (node.AssignmentExpression.type === 'AssignmentExpression') {
|
|
231
|
+
this.validateAssignmentTarget(node.AssignmentExpression.LeftHandSideExpression);
|
|
232
|
+
} else {
|
|
233
|
+
this.validateAssignmentTarget(node.AssignmentExpression);
|
|
234
|
+
}
|
|
235
|
+
return;
|
|
236
|
+
case 'Elision':
|
|
237
|
+
return;
|
|
238
|
+
case 'SpreadElement':
|
|
239
|
+
if (node.AssignmentExpression.type === 'AssignmentExpression') {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
this.validateAssignmentTarget(node.AssignmentExpression);
|
|
243
|
+
return;
|
|
244
|
+
default:
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
this.addEarlyError(Throw.SyntaxError('Invalid assignment target'), node);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// YieldExpression :
|
|
251
|
+
// `yield`
|
|
252
|
+
// `yield` [no LineTerminator here] AssignmentExpression
|
|
253
|
+
// `yield` [no LineTerminator here] `*` AssignmentExpression
|
|
254
|
+
parseYieldExpression(): ParseNode.YieldExpression {
|
|
255
|
+
if (this.scope.inParameters()) {
|
|
256
|
+
this.addEarlyError(Throw.SyntaxError('yield cannot be used in formal parameters'));
|
|
257
|
+
}
|
|
258
|
+
const node = this.startNode<ParseNode.YieldExpression>();
|
|
259
|
+
this.expect(Token.YIELD);
|
|
260
|
+
if (this.peek().hadLineTerminatorBefore) {
|
|
261
|
+
node.hasStar = false;
|
|
262
|
+
node.AssignmentExpression = null;
|
|
263
|
+
} else {
|
|
264
|
+
node.hasStar = this.eat(Token.MUL);
|
|
265
|
+
if (node.hasStar) {
|
|
266
|
+
node.AssignmentExpression = this.parseAssignmentExpression();
|
|
267
|
+
} else {
|
|
268
|
+
switch (this.peek().type) {
|
|
269
|
+
case Token.EOS:
|
|
270
|
+
case Token.SEMICOLON:
|
|
271
|
+
case Token.RBRACE:
|
|
272
|
+
case Token.RBRACK:
|
|
273
|
+
case Token.RPAREN:
|
|
274
|
+
case Token.COLON:
|
|
275
|
+
case Token.COMMA:
|
|
276
|
+
case Token.IN:
|
|
277
|
+
node.AssignmentExpression = null;
|
|
278
|
+
break;
|
|
279
|
+
default:
|
|
280
|
+
node.AssignmentExpression = this.parseAssignmentExpression();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (this.isParsingArrowParameterCandidate()) {
|
|
285
|
+
this.scope.arrowInfo?.yieldExpressions.push(node as ParseNode.YieldExpression);
|
|
286
|
+
}
|
|
287
|
+
return this.finishNode(node, 'YieldExpression');
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ConditionalExpression :
|
|
291
|
+
// ShortCircuitExpression
|
|
292
|
+
// ShortCircuitExpression `?` AssignmentExpression `:` AssignmentExpression
|
|
293
|
+
parseConditionalExpression(): ParseNode.ConditionalExpressionOrHigher {
|
|
294
|
+
const ShortCircuitExpression = this.parseShortCircuitExpression();
|
|
295
|
+
if (this.eat(Token.CONDITIONAL)) {
|
|
296
|
+
const node = this.startNode<ParseNode.ConditionalExpression>(ShortCircuitExpression);
|
|
297
|
+
node.ShortCircuitExpression = ShortCircuitExpression;
|
|
298
|
+
this.scope.with({ in: true }, () => {
|
|
299
|
+
node.AssignmentExpression_a = this.parseAssignmentExpression();
|
|
300
|
+
});
|
|
301
|
+
this.expect(Token.COLON);
|
|
302
|
+
node.AssignmentExpression_b = this.parseAssignmentExpression();
|
|
303
|
+
return this.finishNode(node, 'ConditionalExpression');
|
|
304
|
+
}
|
|
305
|
+
return ShortCircuitExpression;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// ShortCircuitExpression :
|
|
309
|
+
// LogicalORExpression
|
|
310
|
+
// CoalesceExpression
|
|
311
|
+
//
|
|
312
|
+
// CoalesceExpression :
|
|
313
|
+
// CoalesceExpressionHead `??` BitwiseORExpression
|
|
314
|
+
//
|
|
315
|
+
// CoalesceExpressionHead :
|
|
316
|
+
// CoalesceExpression
|
|
317
|
+
// BitwiseORExpression
|
|
318
|
+
parseShortCircuitExpression(): ParseNode.ShortCircuitExpressionOrHigher {
|
|
319
|
+
if (this.state.json) {
|
|
320
|
+
return this.parseUnaryExpression();
|
|
321
|
+
}
|
|
322
|
+
const expression = this.parseLogicalORExpression();
|
|
323
|
+
if (!this.test(Token.NULLISH)) return expression;
|
|
324
|
+
if (expression.type === 'LogicalANDExpression' || expression.type === 'LogicalORExpression') {
|
|
325
|
+
this.raise(Throw.SyntaxError('Cannot mix logical operator with ?? operator. Add parentheses to determine precedence.'));
|
|
326
|
+
}
|
|
327
|
+
let result: ParseNode.CoalesceExpressionHead = expression;
|
|
328
|
+
while (this.eat(Token.NULLISH)) {
|
|
329
|
+
const node: ParseNode.Unfinished<ParseNode.CoalesceExpression> = this.startNode(result);
|
|
330
|
+
node.CoalesceExpressionHead = result;
|
|
331
|
+
node.BitwiseORExpression = this.parseBitwiseORExpression();
|
|
332
|
+
result = this.finishNode(node, 'CoalesceExpression');
|
|
333
|
+
}
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
parseLogicalORExpression(): ParseNode.LogicalORExpressionOrHigher {
|
|
338
|
+
let result: ParseNode.LogicalORExpressionOrHigher = this.parseLogicalANDExpression();
|
|
339
|
+
while (this.eat(Token.OR)) {
|
|
340
|
+
const node: ParseNode.Unfinished<ParseNode.LogicalORExpression> = this.startNode(result);
|
|
341
|
+
node.LogicalORExpression = result;
|
|
342
|
+
node.LogicalANDExpression = this.parseLogicalANDExpression();
|
|
343
|
+
result = this.finishNode(node, 'LogicalORExpression');
|
|
344
|
+
}
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
parseLogicalANDExpression(): ParseNode.LogicalANDExpressionOrHigher {
|
|
349
|
+
let result: ParseNode.LogicalANDExpressionOrHigher = this.parseBitwiseORExpression();
|
|
350
|
+
while (this.eat(Token.AND)) {
|
|
351
|
+
const node: ParseNode.Unfinished<ParseNode.LogicalANDExpression> = this.startNode(result);
|
|
352
|
+
node.LogicalANDExpression = result;
|
|
353
|
+
node.BitwiseORExpression = this.parseBitwiseORExpression();
|
|
354
|
+
result = this.finishNode(node, 'LogicalANDExpression');
|
|
355
|
+
}
|
|
356
|
+
return result;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
parseBitwiseORExpression(): ParseNode.BitwiseORExpressionOrHigher {
|
|
360
|
+
let result: ParseNode.BitwiseORExpressionOrHigher = this.parseBitwiseXORExpression();
|
|
361
|
+
while (this.eat(Token.BIT_OR)) {
|
|
362
|
+
const node: ParseNode.Unfinished<ParseNode.BitwiseORExpression> = this.startNode(result);
|
|
363
|
+
node.A = result;
|
|
364
|
+
node.operator = '|';
|
|
365
|
+
node.B = this.parseBitwiseXORExpression();
|
|
366
|
+
result = this.finishNode(node, 'BitwiseORExpression');
|
|
367
|
+
}
|
|
368
|
+
return result;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
parseBitwiseXORExpression(): ParseNode.BitwiseXORExpressionOrHigher {
|
|
372
|
+
let result: ParseNode.BitwiseXORExpressionOrHigher = this.parseBitwiseANDExpression();
|
|
373
|
+
while (this.eat(Token.BIT_XOR)) {
|
|
374
|
+
const node: ParseNode.Unfinished<ParseNode.BitwiseXORExpression> = this.startNode(result);
|
|
375
|
+
node.A = result;
|
|
376
|
+
node.operator = '^';
|
|
377
|
+
node.B = this.parseBitwiseANDExpression();
|
|
378
|
+
result = this.finishNode(node, 'BitwiseXORExpression');
|
|
379
|
+
}
|
|
380
|
+
return result;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
parseBitwiseANDExpression(): ParseNode.BitwiseANDExpressionOrHigher {
|
|
384
|
+
let result: ParseNode.BitwiseANDExpressionOrHigher = this.parseEqualityExpression();
|
|
385
|
+
while (this.eat(Token.BIT_AND)) {
|
|
386
|
+
const node: ParseNode.Unfinished<ParseNode.BitwiseANDExpression> = this.startNode(result);
|
|
387
|
+
node.A = result;
|
|
388
|
+
node.operator = '&';
|
|
389
|
+
node.B = this.parseEqualityExpression();
|
|
390
|
+
result = this.finishNode(node, 'BitwiseANDExpression');
|
|
391
|
+
}
|
|
392
|
+
return result;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
parseEqualityExpression(): ParseNode.EqualityExpressionOrHigher {
|
|
396
|
+
let result: ParseNode.EqualityExpressionOrHigher = this.parseRelationalExpression();
|
|
397
|
+
const operators: readonly Token[] = [Token.EQ, Token.NE, Token.EQ_STRICT, Token.NE_STRICT];
|
|
398
|
+
while (operators.includes(this.peek().type)) {
|
|
399
|
+
const node: ParseNode.Unfinished<ParseNode.EqualityExpression> = this.startNode(result);
|
|
400
|
+
node.EqualityExpression = result;
|
|
401
|
+
node.operator = this.next().value as ParseNode.EqualityExpression['operator'];
|
|
402
|
+
node.RelationalExpression = this.parseRelationalExpression();
|
|
403
|
+
result = this.finishNode(node, 'EqualityExpression');
|
|
404
|
+
}
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
parseRelationalExpression(): ParseNode.RelationalExpressionOrHigher {
|
|
409
|
+
if (this.scope.hasIn() && this.test(Token.PRIVATE_IDENTIFIER)) {
|
|
410
|
+
const PrivateIdentifier = this.parsePrivateIdentifier();
|
|
411
|
+
this.scope.checkUndefinedPrivate(PrivateIdentifier);
|
|
412
|
+
const node = this.startNode<ParseNode.RelationalExpression>(PrivateIdentifier);
|
|
413
|
+
node.PrivateIdentifier = PrivateIdentifier;
|
|
414
|
+
this.expect(Token.IN);
|
|
415
|
+
node.operator = 'in';
|
|
416
|
+
node.ShiftExpression = this.parseShiftExpression();
|
|
417
|
+
return this.finishNode(node, 'RelationalExpression');
|
|
418
|
+
}
|
|
419
|
+
let result: ParseNode.RelationalExpressionOrHigher = this.parseShiftExpression();
|
|
420
|
+
const operators: Token[] = [Token.LT, Token.GT, Token.LTE, Token.GTE, Token.INSTANCEOF];
|
|
421
|
+
if (this.scope.hasIn()) operators.push(Token.IN);
|
|
422
|
+
while (operators.includes(this.peek().type)) {
|
|
423
|
+
const node: ParseNode.Unfinished<ParseNode.RelationalExpression> = this.startNode(result);
|
|
424
|
+
node.RelationalExpression = result;
|
|
425
|
+
node.operator = this.next().value as ParseNode.RelationalExpression['operator'];
|
|
426
|
+
node.ShiftExpression = this.parseShiftExpression();
|
|
427
|
+
result = this.finishNode(node, 'RelationalExpression');
|
|
428
|
+
}
|
|
429
|
+
return result;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
parseShiftExpression(): ParseNode.ShiftExpressionOrHigher {
|
|
433
|
+
let result: ParseNode.ShiftExpressionOrHigher = this.parseAdditiveExpression();
|
|
434
|
+
const operators: readonly Token[] = [Token.SHL, Token.SAR, Token.SHR];
|
|
435
|
+
while (operators.includes(this.peek().type)) {
|
|
436
|
+
const node: ParseNode.Unfinished<ParseNode.ShiftExpression> = this.startNode(result);
|
|
437
|
+
node.ShiftExpression = result;
|
|
438
|
+
node.operator = this.next().value as ParseNode.ShiftExpression['operator'];
|
|
439
|
+
node.AdditiveExpression = this.parseAdditiveExpression();
|
|
440
|
+
result = this.finishNode(node, 'ShiftExpression');
|
|
441
|
+
}
|
|
442
|
+
return result;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
parseAdditiveExpression(): ParseNode.AdditiveExpressionOrHigher {
|
|
446
|
+
let result: ParseNode.AdditiveExpressionOrHigher = this.parseMultiplicativeExpression();
|
|
447
|
+
const operators: readonly Token[] = [Token.ADD, Token.SUB];
|
|
448
|
+
while (operators.includes(this.peek().type)) {
|
|
449
|
+
const node: ParseNode.Unfinished<ParseNode.AdditiveExpression> = this.startNode(result);
|
|
450
|
+
node.AdditiveExpression = result;
|
|
451
|
+
node.operator = this.next().value as ParseNode.AdditiveExpression['operator'];
|
|
452
|
+
node.MultiplicativeExpression = this.parseMultiplicativeExpression();
|
|
453
|
+
result = this.finishNode(node, 'AdditiveExpression');
|
|
454
|
+
}
|
|
455
|
+
return result;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
parseMultiplicativeExpression(): ParseNode.MultiplicativeExpressionOrHigher {
|
|
459
|
+
let result: ParseNode.MultiplicativeExpressionOrHigher = this.parseExponentiationExpression();
|
|
460
|
+
const operators: readonly Token[] = [Token.MUL, Token.DIV, Token.MOD];
|
|
461
|
+
while (operators.includes(this.peek().type)) {
|
|
462
|
+
const node: ParseNode.Unfinished<ParseNode.MultiplicativeExpression> = this.startNode(result);
|
|
463
|
+
node.MultiplicativeExpression = result;
|
|
464
|
+
node.MultiplicativeOperator = this.next().value as ParseNode.MultiplicativeOperator;
|
|
465
|
+
node.ExponentiationExpression = this.parseExponentiationExpression();
|
|
466
|
+
result = this.finishNode(node, 'MultiplicativeExpression');
|
|
467
|
+
}
|
|
468
|
+
return result;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
parseExponentiationExpression(): ParseNode.ExponentiationExpressionOrHigher {
|
|
472
|
+
const left = this.parseUnaryExpression();
|
|
473
|
+
if (!this.test(Token.EXP) || left.type === 'UnaryExpression' || left.type === 'AwaitExpression') return left;
|
|
474
|
+
this.next();
|
|
475
|
+
const node = this.startNode<ParseNode.ExponentiationExpression>(left);
|
|
476
|
+
node.UpdateExpression = left;
|
|
477
|
+
node.ExponentiationExpression = this.parseExponentiationExpression();
|
|
478
|
+
return this.finishNode(node, 'ExponentiationExpression');
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// UnaryExpression :
|
|
482
|
+
// UpdateExpression
|
|
483
|
+
// `delete` UnaryExpression
|
|
484
|
+
// `void` UnaryExpression
|
|
485
|
+
// `typeof` UnaryExpression
|
|
486
|
+
// `+` UnaryExpression
|
|
487
|
+
// `-` UnaryExpression
|
|
488
|
+
// `~` UnaryExpression
|
|
489
|
+
// `!` UnaryExpression
|
|
490
|
+
// [+Await] AwaitExpression
|
|
491
|
+
parseUnaryExpression(): ParseNode.UnaryExpressionOrHigher {
|
|
492
|
+
return this.scope.with({ in: true }, () => {
|
|
493
|
+
if (this.test(Token.AWAIT) && this.scope.hasAwait()) {
|
|
494
|
+
return this.parseAwaitExpression();
|
|
495
|
+
}
|
|
496
|
+
switch (this.peek().type) {
|
|
497
|
+
case Token.DELETE:
|
|
498
|
+
case Token.VOID:
|
|
499
|
+
case Token.TYPEOF:
|
|
500
|
+
case Token.ADD:
|
|
501
|
+
case Token.SUB:
|
|
502
|
+
case Token.BIT_NOT:
|
|
503
|
+
case Token.NOT: {
|
|
504
|
+
const node = this.startNode<ParseNode.UnaryExpression>();
|
|
505
|
+
node.operator = this.next().value as ParseNode.UnaryExpression['operator']; // NOTE: unsound cast
|
|
506
|
+
node.UnaryExpression = this.parseUnaryExpression();
|
|
507
|
+
if (node.operator === 'delete') {
|
|
508
|
+
let target: ParseNode.Expression = node.UnaryExpression;
|
|
509
|
+
while (target.type === 'ParenthesizedExpression') {
|
|
510
|
+
target = target.Expression;
|
|
511
|
+
}
|
|
512
|
+
if (this.isStrictMode() && target.type === 'IdentifierReference') {
|
|
513
|
+
this.addEarlyError(Throw.SyntaxError('Cannot delete an identifier in strict mode'), target);
|
|
514
|
+
}
|
|
515
|
+
if (target.type === 'MemberExpression' && target.PrivateIdentifier) {
|
|
516
|
+
this.addEarlyError(Throw.SyntaxError('Cannot delete private names'), target);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return this.finishNode(node, 'UnaryExpression');
|
|
520
|
+
}
|
|
521
|
+
default:
|
|
522
|
+
return this.parseUpdateExpression();
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// AwaitExpression : `await` UnaryExpression
|
|
528
|
+
parseAwaitExpression(): ParseNode.AwaitExpression {
|
|
529
|
+
if (this.scope.inParameters()) {
|
|
530
|
+
this.addEarlyError(Throw.SyntaxError('await cannot be used in formal parameters'));
|
|
531
|
+
} else if (this.scope.inClassStaticBlock()) {
|
|
532
|
+
this.addEarlyError(Throw.SyntaxError('await cannot be used in class static block'));
|
|
533
|
+
}
|
|
534
|
+
const node = this.startNode<ParseNode.AwaitExpression>();
|
|
535
|
+
this.expect(Token.AWAIT);
|
|
536
|
+
node.UnaryExpression = this.parseUnaryExpression();
|
|
537
|
+
if (this.isParsingArrowParameterCandidate()) {
|
|
538
|
+
this.scope.arrowInfo?.awaitExpressions.push(node as ParseNode.AwaitExpression);
|
|
539
|
+
}
|
|
540
|
+
if (!this.scope.hasReturn()) {
|
|
541
|
+
this.state.hasTopLevelAwait = true;
|
|
542
|
+
}
|
|
543
|
+
return this.finishNode(node, 'AwaitExpression');
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// UpdateExpression :
|
|
547
|
+
// LeftHandSideExpression
|
|
548
|
+
// LeftHandSideExpression [no LineTerminator here] `++`
|
|
549
|
+
// LeftHandSideExpression [no LineTerminator here] `--`
|
|
550
|
+
// `++` UnaryExpression
|
|
551
|
+
// `--` UnaryExpression
|
|
552
|
+
parseUpdateExpression(): ParseNode.UpdateExpressionOrHigher {
|
|
553
|
+
if (this.test(Token.INC) || this.test(Token.DEC)) {
|
|
554
|
+
const node = this.startNode<ParseNode.UpdateExpression>();
|
|
555
|
+
node.operator = this.next().value as ParseNode.UpdateExpression['operator']; // NOTE: unsound cast
|
|
556
|
+
node.LeftHandSideExpression = null;
|
|
557
|
+
node.UnaryExpression = this.parseUnaryExpression();
|
|
558
|
+
this.validateAssignmentTarget(node.UnaryExpression);
|
|
559
|
+
return this.finishNode(node, 'UpdateExpression');
|
|
560
|
+
}
|
|
561
|
+
const argument = this.parseLeftHandSideExpression();
|
|
562
|
+
if (!this.peek().hadLineTerminatorBefore) {
|
|
563
|
+
if (this.test(Token.INC) || this.test(Token.DEC)) {
|
|
564
|
+
this.validateAssignmentTarget(argument);
|
|
565
|
+
const node = this.startNode<ParseNode.UpdateExpression>(argument);
|
|
566
|
+
node.operator = this.next().value as ParseNode.UpdateExpression['operator']; // NOTE: unsound cast
|
|
567
|
+
node.LeftHandSideExpression = argument;
|
|
568
|
+
node.UnaryExpression = null;
|
|
569
|
+
return this.finishNode(node, 'UpdateExpression');
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return argument;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// LeftHandSideExpression
|
|
576
|
+
parseLeftHandSideExpression(allowCalls = true): ParseNode.LeftHandSideExpression {
|
|
577
|
+
let result: ParseNode.LeftHandSideExpression;
|
|
578
|
+
switch (this.peek().type) {
|
|
579
|
+
case Token.NEW:
|
|
580
|
+
result = this.parseNewExpression();
|
|
581
|
+
break;
|
|
582
|
+
case Token.SUPER: {
|
|
583
|
+
const node = this.startNode<ParseNode.SuperCall | ParseNode.SuperProperty>();
|
|
584
|
+
this.next();
|
|
585
|
+
if (this.test(Token.LPAREN)) {
|
|
586
|
+
if (!this.scope.hasSuperCall()) {
|
|
587
|
+
this.addEarlyError(Throw.SyntaxError('Invalid use of super'), node);
|
|
588
|
+
}
|
|
589
|
+
node.Arguments = this.parseArguments().Arguments;
|
|
590
|
+
result = this.finishNode(node, 'SuperCall');
|
|
591
|
+
} else {
|
|
592
|
+
if (!this.scope.hasSuperProperty()) {
|
|
593
|
+
this.addEarlyError(Throw.SyntaxError('Invalid use of super'), node);
|
|
594
|
+
}
|
|
595
|
+
if (this.eat(Token.LBRACK)) {
|
|
596
|
+
node.Expression = this.parseExpression();
|
|
597
|
+
this.expect(Token.RBRACK);
|
|
598
|
+
node.IdentifierName = null;
|
|
599
|
+
} else {
|
|
600
|
+
this.expect(Token.PERIOD);
|
|
601
|
+
node.Expression = null;
|
|
602
|
+
node.IdentifierName = this.parseIdentifierName();
|
|
603
|
+
}
|
|
604
|
+
result = this.finishNode(node, 'SuperProperty');
|
|
605
|
+
}
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
case Token.IMPORT: {
|
|
609
|
+
const node = this.startNode<ParseNode.ImportMeta | ParseNode.ImportCall>();
|
|
610
|
+
this.next();
|
|
611
|
+
if (this.eat(Token.PERIOD)) {
|
|
612
|
+
if (this.scope.hasImportMeta() && this.eat('meta')) {
|
|
613
|
+
result = this.finishNode(node, 'ImportMeta');
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
if (this.eat('source')) {
|
|
617
|
+
node.Phase = 'source';
|
|
618
|
+
} else if (this.eat('defer')) {
|
|
619
|
+
node.Phase = 'defer';
|
|
620
|
+
} else {
|
|
621
|
+
this.unexpected();
|
|
622
|
+
}
|
|
623
|
+
} else {
|
|
624
|
+
node.Phase = 'evaluation';
|
|
625
|
+
}
|
|
626
|
+
if (!allowCalls) {
|
|
627
|
+
this.unexpected();
|
|
628
|
+
}
|
|
629
|
+
this.expect(Token.LPAREN);
|
|
630
|
+
node.AssignmentExpression = this.parseAssignmentExpression();
|
|
631
|
+
if (this.eat(Token.COMMA) && !this.test(Token.RPAREN)) {
|
|
632
|
+
node.OptionsExpression = this.parseAssignmentExpression();
|
|
633
|
+
this.eat(Token.COMMA);
|
|
634
|
+
}
|
|
635
|
+
this.expect(Token.RPAREN);
|
|
636
|
+
result = this.finishNode(node, 'ImportCall');
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
default:
|
|
640
|
+
result = this.parsePrimaryExpression();
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const check = allowCalls ? isPropertyOrCall : isMember;
|
|
645
|
+
while (check(this.peek().type)) {
|
|
646
|
+
let finished: ParseNode.LeftHandSideExpression;
|
|
647
|
+
switch (this.peek().type) {
|
|
648
|
+
case Token.LBRACK: {
|
|
649
|
+
const node = this.startNode<ParseNode.MemberExpression>(result);
|
|
650
|
+
this.next();
|
|
651
|
+
node.MemberExpression = result;
|
|
652
|
+
node.IdentifierName = null;
|
|
653
|
+
node.Expression = this.parseExpression();
|
|
654
|
+
this.expect(Token.RBRACK);
|
|
655
|
+
finished = this.finishNode(node, 'MemberExpression');
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
case Token.PERIOD: {
|
|
659
|
+
const node = this.startNode<ParseNode.MemberExpression>(result);
|
|
660
|
+
this.next();
|
|
661
|
+
node.MemberExpression = result;
|
|
662
|
+
if (this.test(Token.PRIVATE_IDENTIFIER)) {
|
|
663
|
+
node.PrivateIdentifier = this.parsePrivateIdentifier();
|
|
664
|
+
this.scope.checkUndefinedPrivate(node.PrivateIdentifier);
|
|
665
|
+
node.IdentifierName = null;
|
|
666
|
+
} else {
|
|
667
|
+
node.IdentifierName = this.parseIdentifierName();
|
|
668
|
+
node.PrivateIdentifier = null;
|
|
669
|
+
}
|
|
670
|
+
node.Expression = null;
|
|
671
|
+
finished = this.finishNode(node, 'MemberExpression');
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
case Token.LPAREN: {
|
|
675
|
+
const node = this.startNode<ParseNode.CallExpression>(result);
|
|
676
|
+
// `async` [no LineTerminator here] `(`
|
|
677
|
+
const couldBeArrow = this.matches('async', this.currentToken)
|
|
678
|
+
&& result.type === 'IdentifierReference'
|
|
679
|
+
&& !this.peek().hadLineTerminatorBefore;
|
|
680
|
+
if (couldBeArrow) {
|
|
681
|
+
this.scope.pushArrowInfo(true);
|
|
682
|
+
this.scope.enterArrowParameterCandidate();
|
|
683
|
+
}
|
|
684
|
+
const { Arguments, trailingComma } = this.parseArguments();
|
|
685
|
+
node.CallExpression = result;
|
|
686
|
+
node.Arguments = Arguments;
|
|
687
|
+
if (couldBeArrow) {
|
|
688
|
+
this.scope.exitArrowParameterCandidate();
|
|
689
|
+
node.arrowInfo = this.scope.popArrowInfo();
|
|
690
|
+
node.arrowInfo.hasTrailingComma = trailingComma;
|
|
691
|
+
}
|
|
692
|
+
finished = this.finishNode(node, 'CallExpression');
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
case Token.OPTIONAL: {
|
|
696
|
+
if (result.type === 'NewExpression' && result.Arguments === null) {
|
|
697
|
+
this.raise(Throw.SyntaxError('Unexpected token'));
|
|
698
|
+
}
|
|
699
|
+
const node = this.startNode<ParseNode.OptionalExpression>(result);
|
|
700
|
+
node.MemberExpression = result;
|
|
701
|
+
node.OptionalChain = this.parseOptionalChain();
|
|
702
|
+
finished = this.finishNode(node, 'OptionalExpression');
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
case Token.TEMPLATE: {
|
|
706
|
+
const node = this.startNode<ParseNode.TaggedTemplateExpression>(result);
|
|
707
|
+
node.MemberExpression = result;
|
|
708
|
+
node.TemplateLiteral = this.parseTemplateLiteral(true);
|
|
709
|
+
finished = this.finishNode(node, 'TaggedTemplateExpression');
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
default:
|
|
713
|
+
this.unexpected();
|
|
714
|
+
}
|
|
715
|
+
// NOTE: unwinds ParseNode.Finish type alias to avoid circularity issues in type checker
|
|
716
|
+
result = finished as ParseNode.CallExpressionOrHigher | ParseNode.MemberExpressionOrHigher;
|
|
717
|
+
}
|
|
718
|
+
return result;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// OptionalChain
|
|
722
|
+
parseOptionalChain(): ParseNode.OptionalChain {
|
|
723
|
+
this.expect(Token.OPTIONAL);
|
|
724
|
+
const base = this.startNode<ParseNode.OptionalChain>();
|
|
725
|
+
base.OptionalChain = null;
|
|
726
|
+
if (this.test(Token.LPAREN)) {
|
|
727
|
+
base.Arguments = this.parseArguments().Arguments;
|
|
728
|
+
} else if (this.eat(Token.LBRACK)) {
|
|
729
|
+
base.Expression = this.parseExpression();
|
|
730
|
+
this.expect(Token.RBRACK);
|
|
731
|
+
} else if (this.test(Token.TEMPLATE)) {
|
|
732
|
+
this.raise(Throw.SyntaxError('Template in optional chain'));
|
|
733
|
+
} else if (this.test(Token.PRIVATE_IDENTIFIER)) {
|
|
734
|
+
base.PrivateIdentifier = this.parsePrivateIdentifier();
|
|
735
|
+
this.scope.checkUndefinedPrivate(base.PrivateIdentifier);
|
|
736
|
+
} else {
|
|
737
|
+
base.IdentifierName = this.parseIdentifierName();
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
let chain = this.finishNode(base, 'OptionalChain');
|
|
741
|
+
while (true) {
|
|
742
|
+
const node = this.startNode<ParseNode.OptionalChain>();
|
|
743
|
+
if (this.test(Token.LPAREN)) {
|
|
744
|
+
node.OptionalChain = chain;
|
|
745
|
+
node.Arguments = this.parseArguments().Arguments;
|
|
746
|
+
chain = this.finishNode(node, 'OptionalChain');
|
|
747
|
+
} else if (this.eat(Token.LBRACK)) {
|
|
748
|
+
node.OptionalChain = chain;
|
|
749
|
+
node.Expression = this.parseExpression();
|
|
750
|
+
this.expect(Token.RBRACK);
|
|
751
|
+
chain = this.finishNode(node, 'OptionalChain');
|
|
752
|
+
} else if (this.test(Token.TEMPLATE)) {
|
|
753
|
+
this.raise(Throw.SyntaxError('Template in optional chain'));
|
|
754
|
+
} else if (this.eat(Token.PERIOD)) {
|
|
755
|
+
node.OptionalChain = chain;
|
|
756
|
+
if (this.test(Token.PRIVATE_IDENTIFIER)) {
|
|
757
|
+
node.PrivateIdentifier = this.parsePrivateIdentifier();
|
|
758
|
+
this.scope.checkUndefinedPrivate(node.PrivateIdentifier);
|
|
759
|
+
} else {
|
|
760
|
+
node.IdentifierName = this.parseIdentifierName();
|
|
761
|
+
}
|
|
762
|
+
chain = this.finishNode(node, 'OptionalChain');
|
|
763
|
+
} else {
|
|
764
|
+
return chain;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// NewExpression
|
|
770
|
+
parseNewExpression(): ParseNode.NewExpressionOrHigher {
|
|
771
|
+
const node = this.startNode<ParseNode.NewTarget | ParseNode.NewExpression>();
|
|
772
|
+
this.expect(Token.NEW);
|
|
773
|
+
if (this.scope.hasNewTarget() && this.eat(Token.PERIOD)) {
|
|
774
|
+
this.expect('target');
|
|
775
|
+
return this.finishNode(node as ParseNode.NewTarget, 'NewTarget');
|
|
776
|
+
}
|
|
777
|
+
node.MemberExpression = this.parseLeftHandSideExpression(false);
|
|
778
|
+
if (node.MemberExpression.type === 'OptionalExpression') {
|
|
779
|
+
this.raise(Throw.SyntaxError('Unexpected token'));
|
|
780
|
+
}
|
|
781
|
+
if (this.test(Token.LPAREN)) {
|
|
782
|
+
node.Arguments = this.parseArguments().Arguments;
|
|
783
|
+
} else {
|
|
784
|
+
node.Arguments = null;
|
|
785
|
+
}
|
|
786
|
+
return this.finishNode(node as ParseNode.NewExpression, 'NewExpression');
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// PrimaryExpression :
|
|
790
|
+
// ...
|
|
791
|
+
parsePrimaryExpression(): ParseNode.PrimaryExpression {
|
|
792
|
+
switch (this.peek().type) {
|
|
793
|
+
case Token.IDENTIFIER:
|
|
794
|
+
case Token.ESCAPED_KEYWORD:
|
|
795
|
+
case Token.YIELD:
|
|
796
|
+
case Token.AWAIT:
|
|
797
|
+
// `async` [no LineTerminator here] `function`
|
|
798
|
+
if (this.test('async') && this.testAhead(Token.FUNCTION)
|
|
799
|
+
&& !this.peekAhead().hadLineTerminatorBefore) {
|
|
800
|
+
return this.parseFunctionExpression(FunctionKind.ASYNC);
|
|
801
|
+
}
|
|
802
|
+
return this.parseIdentifierReference();
|
|
803
|
+
case Token.THIS: {
|
|
804
|
+
const node = this.startNode<ParseNode.ThisExpression>();
|
|
805
|
+
this.next();
|
|
806
|
+
return this.finishNode(node, 'ThisExpression');
|
|
807
|
+
}
|
|
808
|
+
case Token.NUMBER:
|
|
809
|
+
case Token.BIGINT:
|
|
810
|
+
return this.parseNumericLiteral();
|
|
811
|
+
case Token.STRING:
|
|
812
|
+
return this.parseStringLiteral();
|
|
813
|
+
case Token.NULL: {
|
|
814
|
+
const node = this.startNode<ParseNode.NullLiteral>();
|
|
815
|
+
this.next();
|
|
816
|
+
return this.finishNode(node, 'NullLiteral');
|
|
817
|
+
}
|
|
818
|
+
case Token.TRUE:
|
|
819
|
+
case Token.FALSE:
|
|
820
|
+
return this.parseBooleanLiteral();
|
|
821
|
+
case Token.LBRACK:
|
|
822
|
+
return this.parseArrayLiteral();
|
|
823
|
+
case Token.LBRACE:
|
|
824
|
+
return this.parseObjectLiteral();
|
|
825
|
+
case Token.FUNCTION:
|
|
826
|
+
return this.parseFunctionExpression(FunctionKind.NORMAL);
|
|
827
|
+
case Token.AT:
|
|
828
|
+
return surroundingAgent.feature('decorators') ? this.parseClassExpression() : this.unexpected();
|
|
829
|
+
case Token.CLASS:
|
|
830
|
+
return this.parseClassExpression();
|
|
831
|
+
case Token.TEMPLATE:
|
|
832
|
+
return this.parseTemplateLiteral();
|
|
833
|
+
case Token.DIV:
|
|
834
|
+
case Token.ASSIGN_DIV:
|
|
835
|
+
return this.parseRegularExpressionLiteral();
|
|
836
|
+
case Token.LPAREN:
|
|
837
|
+
return this.parseCoverParenthesizedExpressionAndArrowParameterList();
|
|
838
|
+
default:
|
|
839
|
+
return this.unexpected();
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// NumericLiteral
|
|
844
|
+
parseNumericLiteral(): ParseNode.NumericLiteral {
|
|
845
|
+
const node = this.startNode<ParseNode.NumericLiteral>();
|
|
846
|
+
if (!this.test(Token.NUMBER) && !this.test(Token.BIGINT)) {
|
|
847
|
+
this.unexpected();
|
|
848
|
+
}
|
|
849
|
+
node.value = this.next().valueAsNumeric();
|
|
850
|
+
return this.finishNode(node, 'NumericLiteral');
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// StringLiteral
|
|
854
|
+
parseStringLiteral(): ParseNode.StringLiteral {
|
|
855
|
+
const node = this.startNode<ParseNode.StringLiteral>();
|
|
856
|
+
if (!this.test(Token.STRING)) {
|
|
857
|
+
this.unexpected();
|
|
858
|
+
}
|
|
859
|
+
node.value = this.next().valueAsString();
|
|
860
|
+
return this.finishNode(node, 'StringLiteral');
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// BooleanLiteral :
|
|
864
|
+
// `true`
|
|
865
|
+
// `false`
|
|
866
|
+
parseBooleanLiteral(): ParseNode.BooleanLiteral {
|
|
867
|
+
const node = this.startNode<ParseNode.BooleanLiteral>();
|
|
868
|
+
switch (this.peek().type) {
|
|
869
|
+
case Token.TRUE:
|
|
870
|
+
this.next();
|
|
871
|
+
node.value = true;
|
|
872
|
+
break;
|
|
873
|
+
case Token.FALSE:
|
|
874
|
+
this.next();
|
|
875
|
+
node.value = false;
|
|
876
|
+
break;
|
|
877
|
+
default:
|
|
878
|
+
this.unexpected();
|
|
879
|
+
}
|
|
880
|
+
return this.finishNode(node, 'BooleanLiteral');
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// ArrayLiteral :
|
|
884
|
+
// `[` `]`
|
|
885
|
+
// `[` Elision `]`
|
|
886
|
+
// `[` ElementList `]`
|
|
887
|
+
// `[` ElementList `,` `]`
|
|
888
|
+
// `[` ElementList `,` Elision `]`
|
|
889
|
+
parseArrayLiteral(): ParseNode.ArrayLiteral {
|
|
890
|
+
const node = this.startNode<ParseNode.ArrayLiteral>();
|
|
891
|
+
this.expect(Token.LBRACK);
|
|
892
|
+
const ElementList: Mutable<ParseNode.ElementList> = [];
|
|
893
|
+
node.ElementList = ElementList;
|
|
894
|
+
node.hasTrailingComma = false;
|
|
895
|
+
while (true) {
|
|
896
|
+
while (this.test(Token.COMMA)) {
|
|
897
|
+
const elision = this.startNode<ParseNode.Elision>();
|
|
898
|
+
this.next();
|
|
899
|
+
ElementList.push(this.finishNode(elision, 'Elision'));
|
|
900
|
+
}
|
|
901
|
+
if (this.eat(Token.RBRACK)) {
|
|
902
|
+
break;
|
|
903
|
+
}
|
|
904
|
+
if (this.test(Token.ELLIPSIS)) {
|
|
905
|
+
const spread = this.startNode<ParseNode.SpreadElement>();
|
|
906
|
+
this.next();
|
|
907
|
+
spread.AssignmentExpression = this.parseAssignmentExpression();
|
|
908
|
+
ElementList.push(this.finishNode(spread, 'SpreadElement'));
|
|
909
|
+
} else {
|
|
910
|
+
ElementList.push(this.parseAssignmentExpression());
|
|
911
|
+
}
|
|
912
|
+
if (this.eat(Token.RBRACK)) {
|
|
913
|
+
node.hasTrailingComma = false;
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
node.hasTrailingComma = true;
|
|
917
|
+
this.expect(Token.COMMA);
|
|
918
|
+
}
|
|
919
|
+
return this.finishNode(node, 'ArrayLiteral');
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// ObjectLiteral :
|
|
923
|
+
// `{` `}`
|
|
924
|
+
// `{` PropertyDefinitionList `}`
|
|
925
|
+
// `{` PropertyDefinitionList `,` `}`
|
|
926
|
+
parseObjectLiteral(): ParseNode.ObjectLiteral {
|
|
927
|
+
const node = this.startNode<ParseNode.ObjectLiteral>();
|
|
928
|
+
this.expect(Token.LBRACE);
|
|
929
|
+
const PropertyDefinitionList: Mutable<ParseNode.PropertyDefinitionList> = [];
|
|
930
|
+
node.PropertyDefinitionList = PropertyDefinitionList;
|
|
931
|
+
node.hasTrailingComma = false;
|
|
932
|
+
let hasProto = false;
|
|
933
|
+
while (true) {
|
|
934
|
+
if (this.eat(Token.RBRACE)) {
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
const PropertyDefinition = this.parsePropertyDefinition();
|
|
938
|
+
if (!this.state.json
|
|
939
|
+
&& PropertyDefinition.type === 'PropertyDefinition'
|
|
940
|
+
&& PropertyDefinition.PropertyName
|
|
941
|
+
&& !IsComputedPropertyKey(PropertyDefinition.PropertyName)
|
|
942
|
+
&& PropertyDefinition.PropertyName.type !== 'NumericLiteral'
|
|
943
|
+
&& StringValue(PropertyDefinition.PropertyName).stringValue() === '__proto__') {
|
|
944
|
+
if (hasProto) {
|
|
945
|
+
this.scope.registerObjectLiteralEarlyError(this.addEarlyError(Throw.SyntaxError('Duplicate __proto__ property'), PropertyDefinition.PropertyName));
|
|
946
|
+
} else {
|
|
947
|
+
hasProto = true;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
PropertyDefinitionList.push(PropertyDefinition);
|
|
951
|
+
if (this.eat(Token.RBRACE)) {
|
|
952
|
+
node.hasTrailingComma = false;
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
node.hasTrailingComma = true;
|
|
956
|
+
this.expect(Token.COMMA);
|
|
957
|
+
}
|
|
958
|
+
return this.finishNode(node, 'ObjectLiteral');
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
parsePropertyDefinition(): ParseNode.PropertyDefinitionLike {
|
|
962
|
+
return this.parseBracketedDefinition('property');
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
parseFunctionExpression(kind: FunctionKind): ParseNode.FunctionExpressionLike {
|
|
966
|
+
return this.parseFunction(true, kind) as ParseNode.FunctionExpressionLike;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
parseArguments(): { Arguments: ParseNode.Arguments, trailingComma: boolean } {
|
|
970
|
+
const location = this.getLocation();
|
|
971
|
+
this.expect(Token.LPAREN);
|
|
972
|
+
if (this.eat(Token.RPAREN)) {
|
|
973
|
+
return { Arguments: Object.assign([], this.markLocationEnd({ location })), trailingComma: false };
|
|
974
|
+
}
|
|
975
|
+
const Arguments: ParseNode.ArgumentListElement[] = [];
|
|
976
|
+
let trailingComma = false;
|
|
977
|
+
while (true) {
|
|
978
|
+
const node = this.startNode<ParseNode.AssignmentRestElement>();
|
|
979
|
+
if (this.eat(Token.ELLIPSIS)) {
|
|
980
|
+
node.AssignmentExpression = this.parseAssignmentExpression();
|
|
981
|
+
Arguments.push(this.finishNode(node, 'AssignmentRestElement'));
|
|
982
|
+
} else {
|
|
983
|
+
Arguments.push(this.parseAssignmentExpression());
|
|
984
|
+
}
|
|
985
|
+
if (this.eat(Token.RPAREN)) {
|
|
986
|
+
break;
|
|
987
|
+
}
|
|
988
|
+
this.expect(Token.COMMA);
|
|
989
|
+
if (this.eat(Token.RPAREN)) {
|
|
990
|
+
trailingComma = true;
|
|
991
|
+
break;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return { Arguments: Object.assign(Arguments, this.markLocationEnd({ location })), trailingComma };
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/** https://tc39.es/ecma262/#sec-class-definitions */
|
|
998
|
+
// ClassDeclaration :
|
|
999
|
+
// DecoratorList? `class` BindingIdentifier ClassTail
|
|
1000
|
+
// DecoratorList? [+Default] `class` ClassTail
|
|
1001
|
+
//
|
|
1002
|
+
// ClassExpression :
|
|
1003
|
+
// DecoratorList? `class` BindingIdentifier? ClassTail
|
|
1004
|
+
parseClass(decoratorsAttachedToClassDeclaration: null | readonly ParseNode.Decorator[], isExpression: boolean): ParseNode.ClassLike {
|
|
1005
|
+
const node = this.startNode<ParseNode.ClassLike>();
|
|
1006
|
+
|
|
1007
|
+
const decorators = decoratorsAttachedToClassDeclaration || this.parseDecorators();
|
|
1008
|
+
this.expect(Token.CLASS);
|
|
1009
|
+
|
|
1010
|
+
this.scope.with({ strict: true }, () => {
|
|
1011
|
+
if (!this.test(Token.LBRACE) && !this.test(Token.EXTENDS)) {
|
|
1012
|
+
node.BindingIdentifier = this.parseBindingIdentifier();
|
|
1013
|
+
if (!isExpression) {
|
|
1014
|
+
this.scope.declare(node.BindingIdentifier, 'lexical');
|
|
1015
|
+
}
|
|
1016
|
+
} else if (isExpression === false && !this.scope.isDefault()) {
|
|
1017
|
+
this.raise(Throw.SyntaxError('Class missing binding identifier'));
|
|
1018
|
+
} else {
|
|
1019
|
+
node.BindingIdentifier = null;
|
|
1020
|
+
}
|
|
1021
|
+
node.ClassTail = this.scope.with({ default: false }, () => this.parseClassTail());
|
|
1022
|
+
});
|
|
1023
|
+
node.Decorators = decorators;
|
|
1024
|
+
|
|
1025
|
+
return this.finishNode(node, isExpression ? 'ClassExpression' : 'ClassDeclaration');
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// ClassTail : ClassHeritage? `{` ClassBody? `}`
|
|
1029
|
+
// ClassHeritage : `extends` LeftHandSideExpression
|
|
1030
|
+
// ClassBody : ClassElementList
|
|
1031
|
+
parseClassTail(): ParseNode.ClassTail {
|
|
1032
|
+
const node = this.startNode<ParseNode.ClassTail>();
|
|
1033
|
+
|
|
1034
|
+
if (this.eat(Token.EXTENDS)) {
|
|
1035
|
+
node.ClassHeritage = this.parseLeftHandSideExpression();
|
|
1036
|
+
} else {
|
|
1037
|
+
node.ClassHeritage = null;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
this.expect(Token.LBRACE);
|
|
1041
|
+
if (this.eat(Token.RBRACE)) {
|
|
1042
|
+
node.ClassBody = null;
|
|
1043
|
+
} else {
|
|
1044
|
+
node.ClassBody = this.scope.with({
|
|
1045
|
+
superCall: !!node.ClassHeritage,
|
|
1046
|
+
private: true,
|
|
1047
|
+
}, () => {
|
|
1048
|
+
const ClassBody: Mutable<ParseNode.ClassElementList> = [];
|
|
1049
|
+
let hasConstructor = false;
|
|
1050
|
+
while (this.eat(Token.SEMICOLON)) {
|
|
1051
|
+
// nothing
|
|
1052
|
+
}
|
|
1053
|
+
const staticPrivates = new Set();
|
|
1054
|
+
const instancePrivates = new Set();
|
|
1055
|
+
while (!this.eat(Token.RBRACE)) {
|
|
1056
|
+
const m = this.parseClassElement();
|
|
1057
|
+
ClassBody.push(m);
|
|
1058
|
+
while (this.eat(Token.SEMICOLON)) {
|
|
1059
|
+
// nothing
|
|
1060
|
+
}
|
|
1061
|
+
if (m.type === 'ClassStaticBlock') {
|
|
1062
|
+
continue;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
if (m.ClassElementName?.type === 'PrivateIdentifier') {
|
|
1066
|
+
let type: 'field' | 'method' | 'set' | 'get';
|
|
1067
|
+
if (m.type === 'FieldDefinition') {
|
|
1068
|
+
type = 'field';
|
|
1069
|
+
} else if (m.UniqueFormalParameters) {
|
|
1070
|
+
type = 'method';
|
|
1071
|
+
} else if (m.PropertySetParameterList) {
|
|
1072
|
+
type = 'set';
|
|
1073
|
+
} else {
|
|
1074
|
+
type = 'get';
|
|
1075
|
+
}
|
|
1076
|
+
if (type === 'get' || type === 'set') {
|
|
1077
|
+
if (m.static) {
|
|
1078
|
+
if (instancePrivates.has(m.ClassElementName.name)) {
|
|
1079
|
+
this.addEarlyError(Throw.SyntaxError('A class cannot have static and instance private methods with the same name'), m);
|
|
1080
|
+
} else {
|
|
1081
|
+
staticPrivates.add(m.ClassElementName.name);
|
|
1082
|
+
}
|
|
1083
|
+
} else {
|
|
1084
|
+
if (staticPrivates.has(m.ClassElementName.name)) {
|
|
1085
|
+
this.addEarlyError(Throw.SyntaxError('A class cannot have static and instance private methods with the same name'), m);
|
|
1086
|
+
} else {
|
|
1087
|
+
instancePrivates.add(m.ClassElementName.name);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
this.scope.declare(m.ClassElementName, 'private', type);
|
|
1092
|
+
if (m.ClassElementName.name === 'constructor') {
|
|
1093
|
+
this.addEarlyError(Throw.SyntaxError('A class element cannot be named as "constructor"'), m);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
const name = PropName(m);
|
|
1098
|
+
const isActualConstructor = !m.static
|
|
1099
|
+
&& m.type === 'MethodDefinition'
|
|
1100
|
+
&& !!m.UniqueFormalParameters
|
|
1101
|
+
&& name === 'constructor';
|
|
1102
|
+
if (isActualConstructor) {
|
|
1103
|
+
if (hasConstructor) {
|
|
1104
|
+
this.addEarlyError(Throw.SyntaxError('Duplicate constructor'), m);
|
|
1105
|
+
} else {
|
|
1106
|
+
hasConstructor = true;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
if ((m.static && name === 'prototype')
|
|
1110
|
+
|| (!m.static && !isActualConstructor && name === 'constructor')) {
|
|
1111
|
+
this.addEarlyError(Throw.SyntaxError('A class element cannot be named as "prototype" or "constructor"'), m);
|
|
1112
|
+
}
|
|
1113
|
+
if (m.static && m.type === 'FieldDefinition' && name === 'constructor') {
|
|
1114
|
+
this.addEarlyError(Throw.SyntaxError('A class static field cannot be named as "constructor"'), m);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return ClassBody;
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
return this.finishNode(node, 'ClassTail');
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
parseClassElement(): ParseNode.ClassElement {
|
|
1125
|
+
let element;
|
|
1126
|
+
if (this.test('static') && this.testAhead(Token.LBRACE)) {
|
|
1127
|
+
const node = this.startNode<ParseNode.ClassStaticBlock>();
|
|
1128
|
+
this.expect('static');
|
|
1129
|
+
node.static = true;
|
|
1130
|
+
this.expect(Token.LBRACE);
|
|
1131
|
+
const ClassStaticBlockBody = this.startNode<ParseNode.ClassStaticBlockBody>();
|
|
1132
|
+
ClassStaticBlockBody.ClassStaticBlockStatementList = this.scope.with(
|
|
1133
|
+
{
|
|
1134
|
+
lexical: true,
|
|
1135
|
+
yield: false,
|
|
1136
|
+
await: true,
|
|
1137
|
+
return: false,
|
|
1138
|
+
superProperty: true,
|
|
1139
|
+
superCall: false,
|
|
1140
|
+
newTarget: true,
|
|
1141
|
+
label: 'boundary',
|
|
1142
|
+
classStaticBlock: true,
|
|
1143
|
+
},
|
|
1144
|
+
() => this.parseStatementList(Token.RBRACE),
|
|
1145
|
+
);
|
|
1146
|
+
node.ClassStaticBlockBody = this.finishNode(ClassStaticBlockBody, 'ClassStaticBlockBody');
|
|
1147
|
+
element = this.finishNode(node, 'ClassStaticBlock');
|
|
1148
|
+
} else {
|
|
1149
|
+
element = this.parseBracketedDefinition('class element');
|
|
1150
|
+
}
|
|
1151
|
+
return element;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
parseClassExpression(): ParseNode.ClassExpression {
|
|
1155
|
+
return this.parseClass(null, true) as ParseNode.ClassExpression;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
parseTemplateLiteral(tagged = false): ParseNode.TemplateLiteral {
|
|
1159
|
+
const node = this.startNode<ParseNode.TemplateLiteral>();
|
|
1160
|
+
const TemplateSpanList: string[] = [];
|
|
1161
|
+
const ExpressionList: ParseNode.Expression[] = [];
|
|
1162
|
+
let buffer = '';
|
|
1163
|
+
while (true) {
|
|
1164
|
+
if (this.position >= this.source.length) {
|
|
1165
|
+
this.raise(Throw.SyntaxError('Unterminated template literal'), this.position);
|
|
1166
|
+
}
|
|
1167
|
+
const c = this.source[this.position];
|
|
1168
|
+
switch (c) {
|
|
1169
|
+
case '`':
|
|
1170
|
+
this.position += 1;
|
|
1171
|
+
TemplateSpanList.push(buffer);
|
|
1172
|
+
this.next();
|
|
1173
|
+
if (!tagged) {
|
|
1174
|
+
TemplateSpanList.forEach((s) => {
|
|
1175
|
+
if (TV(s) === undefined) {
|
|
1176
|
+
this.raise(Throw.SyntaxError('Invalid template escape'), this.position);
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
node.TemplateSpanList = TemplateSpanList;
|
|
1181
|
+
node.ExpressionList = ExpressionList;
|
|
1182
|
+
return this.finishNode(node, 'TemplateLiteral');
|
|
1183
|
+
case '$':
|
|
1184
|
+
this.position += 1;
|
|
1185
|
+
if (this.source[this.position] === '{') {
|
|
1186
|
+
this.position += 1;
|
|
1187
|
+
TemplateSpanList.push(buffer);
|
|
1188
|
+
buffer = '';
|
|
1189
|
+
this.next();
|
|
1190
|
+
ExpressionList.push(this.parseExpression());
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
buffer += c;
|
|
1194
|
+
break;
|
|
1195
|
+
default: {
|
|
1196
|
+
if (c === '\\') {
|
|
1197
|
+
buffer += c;
|
|
1198
|
+
this.position += 1;
|
|
1199
|
+
}
|
|
1200
|
+
const l = this.source[this.position];
|
|
1201
|
+
this.position += 1;
|
|
1202
|
+
if (isLineTerminator(l)) {
|
|
1203
|
+
if (l === '\r' && this.source[this.position] === '\n') {
|
|
1204
|
+
this.position += 1;
|
|
1205
|
+
}
|
|
1206
|
+
if (l === '\u{2028}' || l === '\u{2029}') {
|
|
1207
|
+
buffer += l;
|
|
1208
|
+
} else {
|
|
1209
|
+
buffer += '\n';
|
|
1210
|
+
}
|
|
1211
|
+
this.line += 1;
|
|
1212
|
+
this.columnOffset = this.position;
|
|
1213
|
+
} else {
|
|
1214
|
+
buffer += l;
|
|
1215
|
+
}
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// RegularExpressionLiteral :
|
|
1223
|
+
// `/` RegularExpressionBody `/` RegularExpressionFlags
|
|
1224
|
+
parseRegularExpressionLiteral(): ParseNode.RegularExpressionLiteral {
|
|
1225
|
+
const node = this.startNode<ParseNode.RegularExpressionLiteral>();
|
|
1226
|
+
this.scanRegularExpressionBody();
|
|
1227
|
+
const body = this.scannedValue as string; // NOTE: unsound cast
|
|
1228
|
+
node.RegularExpressionBody = body;
|
|
1229
|
+
const flagPosition = this.position;
|
|
1230
|
+
this.scanRegularExpressionFlags();
|
|
1231
|
+
node.RegularExpressionFlags = this.scannedValue as string; // NOTE: unsound cast
|
|
1232
|
+
if (node.RegularExpressionFlags.includes('v') && node.RegularExpressionFlags.includes('u')) {
|
|
1233
|
+
this.raise(Throw.SyntaxError('u and v cannot be used together'), flagPosition);
|
|
1234
|
+
}
|
|
1235
|
+
const parse = (flags: RegExpParserContext) => {
|
|
1236
|
+
const p = new RegExpParser(body, (error, position) => {
|
|
1237
|
+
this.decorateSyntaxError(error, node.location.startIndex + position + 1);
|
|
1238
|
+
});
|
|
1239
|
+
return p.scope(flags, () => p.parsePattern());
|
|
1240
|
+
};
|
|
1241
|
+
if (node.RegularExpressionFlags.includes('u')) {
|
|
1242
|
+
parse({ UnicodeMode: true, NamedCaptureGroups: true });
|
|
1243
|
+
} else if (node.RegularExpressionFlags.includes('v')) {
|
|
1244
|
+
parse({ UnicodeMode: true, UnicodeSetsMode: true, NamedCaptureGroups: true });
|
|
1245
|
+
} else {
|
|
1246
|
+
// NOTE: this part is modified by Annex B (but we're not applying it for now)
|
|
1247
|
+
// NamedCaptureGroups: false breaks for RegExp /\k<a>(?<a>b)/
|
|
1248
|
+
parse({ NamedCaptureGroups: true });
|
|
1249
|
+
}
|
|
1250
|
+
const fakeToken = {
|
|
1251
|
+
endIndex: this.position - 1,
|
|
1252
|
+
line: this.line - 1,
|
|
1253
|
+
column: this.position - this.columnOffset,
|
|
1254
|
+
} as TokenData; // NOTE: unsound cast
|
|
1255
|
+
this.next();
|
|
1256
|
+
this.currentToken = fakeToken;
|
|
1257
|
+
return this.finishNode(node, 'RegularExpressionLiteral');
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
// CoverParenthesizedExpressionAndArrowParameterList :
|
|
1261
|
+
// `(` Expression `)`
|
|
1262
|
+
// `(` Expression `,` `)`
|
|
1263
|
+
// `(` `)`
|
|
1264
|
+
// `(` `...` BindingIdentifier `)`
|
|
1265
|
+
// `(` `...` BindingPattern `)`
|
|
1266
|
+
// `(` Expression `,` `...` BindingIdentifier `)`
|
|
1267
|
+
// `(` Expression `.` `...` BindingPattern `)`
|
|
1268
|
+
parseCoverParenthesizedExpressionAndArrowParameterList(): ParseNode.CoverParenthesizedExpressionAndArrowParameterList | ParseNode.ParenthesizedExpression {
|
|
1269
|
+
const node = this.startNode<ParseNode.CoverParenthesizedExpressionAndArrowParameterList | ParseNode.ParenthesizedExpression>();
|
|
1270
|
+
const commaOp = this.startNode<ParseNode.CommaOperator>();
|
|
1271
|
+
this.expect(Token.LPAREN);
|
|
1272
|
+
if (this.test(Token.RPAREN)) {
|
|
1273
|
+
if (!this.testAhead(Token.ARROW) || this.peekAhead().hadLineTerminatorBefore) {
|
|
1274
|
+
this.unexpected();
|
|
1275
|
+
}
|
|
1276
|
+
this.next();
|
|
1277
|
+
node.Arguments = [];
|
|
1278
|
+
return this.finishNode(node, 'CoverParenthesizedExpressionAndArrowParameterList');
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
this.scope.pushArrowInfo();
|
|
1282
|
+
this.scope.pushAssignmentInfo('arrow');
|
|
1283
|
+
|
|
1284
|
+
const expressions: (ParseNode.ArgumentListElement | ParseNode.BindingRestElement)[] = [];
|
|
1285
|
+
let rparenAfterComma;
|
|
1286
|
+
while (true) {
|
|
1287
|
+
if (this.test(Token.ELLIPSIS)) {
|
|
1288
|
+
const inner = this.startNode<ParseNode.BindingRestElement>();
|
|
1289
|
+
this.next();
|
|
1290
|
+
switch (this.peek().type) {
|
|
1291
|
+
case Token.LBRACE:
|
|
1292
|
+
case Token.LBRACK:
|
|
1293
|
+
inner.BindingPattern = this.parseBindingPattern();
|
|
1294
|
+
break;
|
|
1295
|
+
default:
|
|
1296
|
+
inner.BindingIdentifier = this.parseBindingIdentifier();
|
|
1297
|
+
break;
|
|
1298
|
+
}
|
|
1299
|
+
expressions.push(this.finishNode(inner, 'BindingRestElement'));
|
|
1300
|
+
this.expect(Token.RPAREN);
|
|
1301
|
+
break;
|
|
1302
|
+
}
|
|
1303
|
+
expressions.push(this.parseAssignmentExpression());
|
|
1304
|
+
if (this.eat(Token.COMMA)) {
|
|
1305
|
+
if (this.eat(Token.RPAREN)) {
|
|
1306
|
+
rparenAfterComma = this.currentToken;
|
|
1307
|
+
break;
|
|
1308
|
+
}
|
|
1309
|
+
} else {
|
|
1310
|
+
this.expect(Token.RPAREN);
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
const arrowInfo = this.scope.popArrowInfo();
|
|
1316
|
+
const assignmentInfo = this.scope.popAssignmentInfo();
|
|
1317
|
+
|
|
1318
|
+
// ArrowParameters :
|
|
1319
|
+
// CoverParenthesizedExpressionAndArrowParameterList
|
|
1320
|
+
if (this.test(Token.ARROW) && !this.peek().hadLineTerminatorBefore) {
|
|
1321
|
+
node.Arguments = expressions;
|
|
1322
|
+
node.arrowInfo = arrowInfo;
|
|
1323
|
+
assignmentInfo.clear();
|
|
1324
|
+
return this.finishNode(node, 'CoverParenthesizedExpressionAndArrowParameterList');
|
|
1325
|
+
} else {
|
|
1326
|
+
this.scope.arrowInfo?.merge(arrowInfo);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// ParenthesizedExpression :
|
|
1330
|
+
// `(` Expression `)`
|
|
1331
|
+
if (expressions[expressions.length - 1].type === 'BindingRestElement') {
|
|
1332
|
+
this.unexpected(expressions[expressions.length - 1]);
|
|
1333
|
+
}
|
|
1334
|
+
if (rparenAfterComma) {
|
|
1335
|
+
this.unexpected(rparenAfterComma);
|
|
1336
|
+
}
|
|
1337
|
+
if (expressions.length === 1) {
|
|
1338
|
+
node.Expression = expressions[0] as ParseNode.Expression; // NOTE: unsound cast due to potential BindingRestElement
|
|
1339
|
+
} else {
|
|
1340
|
+
commaOp.ExpressionList = expressions as ParseNode.AssignmentExpressionOrHigher[]; // NOTE: unsound cast
|
|
1341
|
+
node.Expression = this.finishNode(commaOp, 'CommaOperator');
|
|
1342
|
+
}
|
|
1343
|
+
return this.finishNode(node, 'ParenthesizedExpression');
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// PropertyName :
|
|
1347
|
+
// LiteralPropertyName
|
|
1348
|
+
// ComputedPropertyName
|
|
1349
|
+
// LiteralPropertyName :
|
|
1350
|
+
// IdentifierName
|
|
1351
|
+
// StringLiteral
|
|
1352
|
+
// NumericLiteral
|
|
1353
|
+
// ComputedPropertyName :
|
|
1354
|
+
// `[` AssignmentExpression `]`
|
|
1355
|
+
parsePropertyName(): ParseNode.PropertyNameLike {
|
|
1356
|
+
if (this.test(Token.LBRACK)) {
|
|
1357
|
+
const node = this.startNode<ParseNode.PropertyName>();
|
|
1358
|
+
this.next();
|
|
1359
|
+
node.ComputedPropertyName = this.parseAssignmentExpression();
|
|
1360
|
+
this.expect(Token.RBRACK);
|
|
1361
|
+
return this.finishNode(node, 'PropertyName');
|
|
1362
|
+
}
|
|
1363
|
+
if (this.test(Token.STRING)) {
|
|
1364
|
+
return this.parseStringLiteral();
|
|
1365
|
+
}
|
|
1366
|
+
if (this.test(Token.NUMBER) || this.test(Token.BIGINT)) {
|
|
1367
|
+
return this.parseNumericLiteral();
|
|
1368
|
+
}
|
|
1369
|
+
return this.parseIdentifierName();
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
private tokenIsPropertyName(token: Token): boolean {
|
|
1373
|
+
switch (token) {
|
|
1374
|
+
case Token.IDENTIFIER:
|
|
1375
|
+
case Token.YIELD:
|
|
1376
|
+
case Token.AWAIT:
|
|
1377
|
+
case Token.STRING:
|
|
1378
|
+
case Token.NUMBER:
|
|
1379
|
+
case Token.BIGINT:
|
|
1380
|
+
case Token.LBRACK:
|
|
1381
|
+
case Token.PRIVATE_IDENTIFIER:
|
|
1382
|
+
return true;
|
|
1383
|
+
default:
|
|
1384
|
+
return isKeyword(token);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
// ClassElementName :
|
|
1389
|
+
// PropertyName
|
|
1390
|
+
// PrivateIdentifier
|
|
1391
|
+
parseClassElementName(): ParseNode.ClassElementName {
|
|
1392
|
+
if (this.test(Token.PRIVATE_IDENTIFIER)) {
|
|
1393
|
+
return this.parsePrivateIdentifier();
|
|
1394
|
+
}
|
|
1395
|
+
return this.parsePropertyName();
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
// PropertyDefinition :
|
|
1399
|
+
// IdentifierReference
|
|
1400
|
+
// CoverInitializedName
|
|
1401
|
+
// PropertyName `:` AssignmentExpression
|
|
1402
|
+
// MethodDefinition
|
|
1403
|
+
// `...` AssignmentExpression
|
|
1404
|
+
// MethodDefinition :
|
|
1405
|
+
// ClassElementName `(` UniqueFormalParameters `)` `{` FunctionBody `}`
|
|
1406
|
+
// GeneratorMethod
|
|
1407
|
+
// AsyncMethod
|
|
1408
|
+
// AsyncGeneratorMethod
|
|
1409
|
+
// `get` ClassElementName `(` `)` `{` FunctionBody `}`
|
|
1410
|
+
// `set` ClassElementName `(` PropertySetParameterList `)` `{` FunctionBody `}`
|
|
1411
|
+
// GeneratorMethod :
|
|
1412
|
+
// `*` ClassElementName `(` UniqueFormalParameters `)` `{` GeneratorBody `}`
|
|
1413
|
+
// AsyncMethod :
|
|
1414
|
+
// `async` [no LineTerminator here] ClassElementName `(` UniqueFormalParameters `)` `{` AsyncBody `}`
|
|
1415
|
+
// AsyncGeneratorMethod :
|
|
1416
|
+
// `async` [no LineTerminator here] `*` ClassElementName `(` UniqueFormalParameters `)` `{` AsyncGeneratorBody `}`
|
|
1417
|
+
parseBracketedDefinition(type: 'class element'): ParseNode.ClassElement;
|
|
1418
|
+
|
|
1419
|
+
parseBracketedDefinition(type: 'property'): ParseNode.PropertyDefinitionLike;
|
|
1420
|
+
|
|
1421
|
+
parseBracketedDefinition(type: 'property' | 'class element'): ParseNode.PropertyDefinitionLike | ParseNode.ClassElement;
|
|
1422
|
+
|
|
1423
|
+
parseBracketedDefinition(type: 'property' | 'class element'): ParseNode.PropertyDefinitionLike | ParseNode.ClassElement {
|
|
1424
|
+
const node = this.startNode<ParseNode.PropertyDefinitionLike | ParseNode.ClassElement>();
|
|
1425
|
+
|
|
1426
|
+
if (type === 'property' && this.eat(Token.ELLIPSIS)) {
|
|
1427
|
+
node.PropertyName = null;
|
|
1428
|
+
node.AssignmentExpression = this.parseAssignmentExpression();
|
|
1429
|
+
return this.finishNode(node, 'PropertyDefinition');
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
let staticOrAccessorButNotKeyword;
|
|
1433
|
+
let isAccessorField = false;
|
|
1434
|
+
if (type === 'class element') {
|
|
1435
|
+
node.Decorators = this.parseDecorators();
|
|
1436
|
+
const staticId = this.test('static') ? this.parseIdentifierName() : null;
|
|
1437
|
+
let isStaticField = true;
|
|
1438
|
+
if (staticId && (this.test(Token.ASSIGN)
|
|
1439
|
+
|| this.test(Token.SEMICOLON)
|
|
1440
|
+
|| this.peek().hadLineTerminatorBefore
|
|
1441
|
+
|| isAutomaticSemicolon(this.peek().type))) {
|
|
1442
|
+
isStaticField = false;
|
|
1443
|
+
}
|
|
1444
|
+
node.static = !!staticId && isStaticField;
|
|
1445
|
+
|
|
1446
|
+
if (staticId) {
|
|
1447
|
+
if (isStaticField) {
|
|
1448
|
+
node.static = true;
|
|
1449
|
+
} else {
|
|
1450
|
+
node.static = false;
|
|
1451
|
+
staticOrAccessorButNotKeyword = staticId;
|
|
1452
|
+
this.markNodeStart(node);
|
|
1453
|
+
}
|
|
1454
|
+
} else node.static = false;
|
|
1455
|
+
|
|
1456
|
+
if (!staticOrAccessorButNotKeyword) {
|
|
1457
|
+
const accessor = surroundingAgent.feature('decorators') && this.test('accessor') ? this.parseIdentifierName() : null;
|
|
1458
|
+
const next = this.peek();
|
|
1459
|
+
if (accessor && !next.hadLineTerminatorBefore && this.tokenIsPropertyName(next.type)) {
|
|
1460
|
+
isAccessorField = true;
|
|
1461
|
+
} else isAccessorField = false;
|
|
1462
|
+
|
|
1463
|
+
if (accessor) {
|
|
1464
|
+
if (isAccessorField) {
|
|
1465
|
+
node.accessor = true;
|
|
1466
|
+
} else {
|
|
1467
|
+
node.accessor = false;
|
|
1468
|
+
staticOrAccessorButNotKeyword = accessor;
|
|
1469
|
+
this.markNodeStart(node);
|
|
1470
|
+
}
|
|
1471
|
+
} else node.accessor = false;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
if (!staticOrAccessorButNotKeyword) {
|
|
1476
|
+
this.markNodeStart(node);
|
|
1477
|
+
}
|
|
1478
|
+
let isGenerator = this.eat(Token.MUL);
|
|
1479
|
+
let isGetter = false;
|
|
1480
|
+
let isSetter = false;
|
|
1481
|
+
let isAsync = false;
|
|
1482
|
+
if (!isGenerator && !isAccessorField) {
|
|
1483
|
+
if (this.test('get') && this.tokenIsPropertyName(this.peekAhead().type)) {
|
|
1484
|
+
isGetter = true;
|
|
1485
|
+
} else if (this.test('set') && this.tokenIsPropertyName(this.peekAhead().type)) {
|
|
1486
|
+
isSetter = true;
|
|
1487
|
+
} else if (this.test('async') && !this.peekAhead().hadLineTerminatorBefore) {
|
|
1488
|
+
isAsync = true;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
const firstName = staticOrAccessorButNotKeyword || (type === 'property'
|
|
1493
|
+
? this.parsePropertyName()
|
|
1494
|
+
: this.parseClassElementName());
|
|
1495
|
+
|
|
1496
|
+
if (!isGenerator && isAsync) {
|
|
1497
|
+
isGenerator = this.eat(Token.MUL);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
const isAsyncShorthandProperty = type === 'property'
|
|
1501
|
+
&& isAsync
|
|
1502
|
+
&& firstName.type === 'IdentifierName'
|
|
1503
|
+
&& firstName.name === 'async'
|
|
1504
|
+
&& !this.test(Token.LPAREN)
|
|
1505
|
+
&& (this.test(Token.COMMA)
|
|
1506
|
+
|| this.test(Token.RBRACE)
|
|
1507
|
+
|| this.test(Token.COLON)
|
|
1508
|
+
|| this.test(Token.ASSIGN));
|
|
1509
|
+
const isSpecialMethod = isGenerator
|
|
1510
|
+
|| ((isSetter || isGetter || isAsync) && !this.test(Token.LPAREN) && !isAsyncShorthandProperty);
|
|
1511
|
+
|
|
1512
|
+
if (!isGenerator) {
|
|
1513
|
+
if (type === 'property' && this.eat(Token.COLON)) {
|
|
1514
|
+
node.PropertyName = firstName as ParseNode.PropertyName; // NOTE: unsound cast
|
|
1515
|
+
node.AssignmentExpression = this.parseAssignmentExpression();
|
|
1516
|
+
return this.finishNode(node, 'PropertyDefinition');
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
if (type === 'class element' && (
|
|
1520
|
+
this.test(Token.ASSIGN)
|
|
1521
|
+
|| this.test(Token.SEMICOLON)
|
|
1522
|
+
|| this.peek().hadLineTerminatorBefore
|
|
1523
|
+
|| isAutomaticSemicolon(this.peek().type)
|
|
1524
|
+
)) {
|
|
1525
|
+
node.accessor = isAccessorField;
|
|
1526
|
+
node.ClassElementName = firstName;
|
|
1527
|
+
node.Initializer = this.scope.with({ superProperty: true, await: false, yield: false }, () => this.parseInitializerOpt());
|
|
1528
|
+
const argumentNode = node.Initializer && ContainsArguments(node.Initializer);
|
|
1529
|
+
if (argumentNode) {
|
|
1530
|
+
this.addEarlyError(Throw.SyntaxError('Invalid use of arguments'), argumentNode);
|
|
1531
|
+
}
|
|
1532
|
+
const finished = this.finishNode(node, 'FieldDefinition');
|
|
1533
|
+
this.semicolon();
|
|
1534
|
+
return finished;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
if (type === 'property' && this.scope.assignmentInfoStack.length > 0 && this.test(Token.ASSIGN)) {
|
|
1538
|
+
// NOTE: The next line is unsafe because firstName could be something other than IdentifierName
|
|
1539
|
+
node.IdentifierReference = this.repurpose(firstName, 'IdentifierReference');
|
|
1540
|
+
node.Initializer = this.parseInitializerOpt();
|
|
1541
|
+
const finished = this.finishNode(node, 'CoverInitializedName');
|
|
1542
|
+
this.scope.registerObjectLiteralEarlyError(this.addEarlyError(Throw.SyntaxError('Invalid assignment target'), finished));
|
|
1543
|
+
return finished;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
if (type === 'property'
|
|
1547
|
+
&& !isSpecialMethod
|
|
1548
|
+
&& firstName.type === 'IdentifierName'
|
|
1549
|
+
&& !this.test(Token.LPAREN)
|
|
1550
|
+
&& (!isKeywordRaw(firstName.name)
|
|
1551
|
+
|| (firstName.name === 'yield' && !this.scope.hasYield())
|
|
1552
|
+
|| (firstName.name === 'await' && !this.scope.hasAwait()))) {
|
|
1553
|
+
const IdentifierReference = this.repurpose(firstName, 'IdentifierReference');
|
|
1554
|
+
this.validateIdentifierReference(firstName.name, firstName);
|
|
1555
|
+
return IdentifierReference;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
if (isSpecialMethod && (!isGenerator || isAsync)) {
|
|
1560
|
+
if (type === 'property') {
|
|
1561
|
+
node.ClassElementName = this.parsePropertyName();
|
|
1562
|
+
} else {
|
|
1563
|
+
node.ClassElementName = this.parseClassElementName();
|
|
1564
|
+
}
|
|
1565
|
+
} else {
|
|
1566
|
+
node.ClassElementName = firstName;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
this.scope.with({
|
|
1570
|
+
lexical: true,
|
|
1571
|
+
variable: true,
|
|
1572
|
+
superProperty: true,
|
|
1573
|
+
newTarget: true,
|
|
1574
|
+
await: isAsync,
|
|
1575
|
+
yield: isGenerator,
|
|
1576
|
+
classStaticBlock: false,
|
|
1577
|
+
}, () => {
|
|
1578
|
+
if (isSpecialMethod && isGetter) {
|
|
1579
|
+
this.expect(Token.LPAREN);
|
|
1580
|
+
this.expect(Token.RPAREN);
|
|
1581
|
+
node.PropertySetParameterList = null;
|
|
1582
|
+
node.UniqueFormalParameters = null;
|
|
1583
|
+
} else if (isSpecialMethod && isSetter) {
|
|
1584
|
+
this.expect(Token.LPAREN);
|
|
1585
|
+
node.PropertySetParameterList = [this.parseFormalParameter()];
|
|
1586
|
+
this.expect(Token.RPAREN);
|
|
1587
|
+
node.UniqueFormalParameters = null;
|
|
1588
|
+
} else {
|
|
1589
|
+
node.PropertySetParameterList = null;
|
|
1590
|
+
node.UniqueFormalParameters = this.parseUniqueFormalParameters();
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
this.scope.with({
|
|
1594
|
+
superCall: !isSpecialMethod
|
|
1595
|
+
&& !node.static
|
|
1596
|
+
&& node.ClassElementName
|
|
1597
|
+
&& ((node.ClassElementName.type === 'IdentifierName' && node.ClassElementName.name === 'constructor')
|
|
1598
|
+
|| (node.ClassElementName.type === 'StringLiteral' && node.ClassElementName.value === 'constructor'))
|
|
1599
|
+
&& this.scope.hasSuperCall(),
|
|
1600
|
+
}, () => {
|
|
1601
|
+
const body = this.parseFunctionBody(isAsync, isGenerator, false);
|
|
1602
|
+
// Unsafe cast below
|
|
1603
|
+
if (!isAsync && !isGenerator) {
|
|
1604
|
+
(node as ParseNode.Unfinished<ParseNode.MethodDefinition>).FunctionBody = body as ParseNode.FunctionBody;
|
|
1605
|
+
} else if (isAsync && !isGenerator) {
|
|
1606
|
+
(node as ParseNode.Unfinished<ParseNode.AsyncMethod>).AsyncBody = body as ParseNode.AsyncBody;
|
|
1607
|
+
} else if (!isAsync && isGenerator) {
|
|
1608
|
+
(node as ParseNode.Unfinished<ParseNode.GeneratorMethod>).GeneratorBody = body as ParseNode.GeneratorBody;
|
|
1609
|
+
} else if (isAsync && isGenerator) {
|
|
1610
|
+
(node as ParseNode.Unfinished<ParseNode.AsyncGeneratorMethod>).AsyncGeneratorBody = body as ParseNode.AsyncGeneratorBody;
|
|
1611
|
+
}
|
|
1612
|
+
if (node.UniqueFormalParameters || node.PropertySetParameterList) {
|
|
1613
|
+
this.validateFormalParameters(node.UniqueFormalParameters || node.PropertySetParameterList!, body, true);
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
});
|
|
1617
|
+
|
|
1618
|
+
let name: ParseNode.MethodDefinitionLike['type'];
|
|
1619
|
+
if (isAsync) {
|
|
1620
|
+
name = isGenerator ? 'AsyncGeneratorMethod' : 'AsyncMethod';
|
|
1621
|
+
} else {
|
|
1622
|
+
name = isGenerator ? 'GeneratorMethod' : 'MethodDefinition';
|
|
1623
|
+
}
|
|
1624
|
+
return this.finishNode(node, name);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
parseDecorators(): ParseNode.Decorator[] | null {
|
|
1628
|
+
if (!surroundingAgent.feature('decorators')) {
|
|
1629
|
+
return null;
|
|
1630
|
+
}
|
|
1631
|
+
const Decorators: ParseNode.Decorator[] = [];
|
|
1632
|
+
while (true) {
|
|
1633
|
+
const decorator = this.parseDecorator();
|
|
1634
|
+
if (!decorator) {
|
|
1635
|
+
return Decorators.length ? Decorators : null;
|
|
1636
|
+
}
|
|
1637
|
+
Decorators.push(decorator);
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
parseDecorator(): ParseNode.Decorator | undefined {
|
|
1642
|
+
if (!this.eat(Token.AT)) {
|
|
1643
|
+
return undefined;
|
|
1644
|
+
}
|
|
1645
|
+
// @ DecoratorParenthesizedExpression : `(` Expression[+In] `)`
|
|
1646
|
+
if (this.eat(Token.LPAREN)) {
|
|
1647
|
+
const node = this.startNode<ParseNode.Decorator_ParenthesizedExpression>();
|
|
1648
|
+
node.subtype = 'ParenthesizedExpression';
|
|
1649
|
+
node.ParenthesizedExpression = this.scope.with({ in: true }, () => this.parseExpression());
|
|
1650
|
+
this.expect(Token.RPAREN);
|
|
1651
|
+
return this.finishNode(node, 'Decorator');
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
let result: ParseNode.MemberExpression | ParseNode.IdentifierReference = this.parseIdentifierReference();
|
|
1655
|
+
|
|
1656
|
+
let next = this.peek().type;
|
|
1657
|
+
while (next === Token.PERIOD || next === Token.LPAREN) {
|
|
1658
|
+
let finished: ParseNode.MemberExpression | ParseNode.CallExpression;
|
|
1659
|
+
if (next === Token.PERIOD) {
|
|
1660
|
+
const node = this.startNode<ParseNode.MemberExpression>(result);
|
|
1661
|
+
this.next();
|
|
1662
|
+
node.MemberExpression = result;
|
|
1663
|
+
if (this.test(Token.PRIVATE_IDENTIFIER)) {
|
|
1664
|
+
node.PrivateIdentifier = this.parsePrivateIdentifier();
|
|
1665
|
+
this.scope.checkUndefinedPrivate(node.PrivateIdentifier);
|
|
1666
|
+
node.IdentifierName = null;
|
|
1667
|
+
} else {
|
|
1668
|
+
node.IdentifierName = this.parseIdentifierName();
|
|
1669
|
+
node.PrivateIdentifier = null;
|
|
1670
|
+
}
|
|
1671
|
+
node.Expression = null;
|
|
1672
|
+
finished = this.finishNode(node, 'MemberExpression');
|
|
1673
|
+
} else if (next === Token.LPAREN) {
|
|
1674
|
+
const node = this.startNode<ParseNode.CallExpression>(result);
|
|
1675
|
+
const { Arguments } = this.parseArguments();
|
|
1676
|
+
node.CallExpression = result;
|
|
1677
|
+
node.Arguments = Arguments;
|
|
1678
|
+
finished = this.finishNode(node, 'CallExpression');
|
|
1679
|
+
const finishedNode = finished;
|
|
1680
|
+
|
|
1681
|
+
const outerNode = this.startNode<ParseNode.Decorator_CallExpression>(finishedNode);
|
|
1682
|
+
outerNode.subtype = 'CallExpression';
|
|
1683
|
+
outerNode.CallExpression = finishedNode;
|
|
1684
|
+
return this.finishNode(outerNode, 'Decorator');
|
|
1685
|
+
} else {
|
|
1686
|
+
return this.finishNode(this.startNode<ParseNode.Decorator_MemberExpression>(result), 'Decorator');
|
|
1687
|
+
}
|
|
1688
|
+
// NOTE: unwinds ParseNode.Finish type alias to avoid circularity issues in type checker
|
|
1689
|
+
result = finished as ParseNode.MemberExpression;
|
|
1690
|
+
next = this.peek().type;
|
|
1691
|
+
}
|
|
1692
|
+
const outerNode = this.startNode<ParseNode.Decorator_MemberExpression>(result);
|
|
1693
|
+
outerNode.subtype = 'MemberExpression';
|
|
1694
|
+
outerNode.MemberExpression = result;
|
|
1695
|
+
return this.finishNode(outerNode, 'Decorator');
|
|
1696
|
+
}
|
|
1697
|
+
}
|