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