diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c23e734082f..237f4c9cc3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,8 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/install@56f291b2a0d9e3bce72634356ae949b1e054b9f8 + - uses: actions/checkout@v3 + - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae name: 'nvm install lts/* && npm ci' with: node-version: lts/* diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1ac78552b0b..424c2d3f974 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,8 +12,8 @@ jobs: if: ${{ github.repository == 'tc39/ecma262' }} steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/install@56f291b2a0d9e3bce72634356ae949b1e054b9f8 + - uses: actions/checkout@v3 + - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae name: 'nvm install lts/* && npm ci' with: node-version: lts/* diff --git a/.github/workflows/enforce-format.yml b/.github/workflows/enforce-format.yml index 4e24a3c74bc..d2358e0e477 100644 --- a/.github/workflows/enforce-format.yml +++ b/.github/workflows/enforce-format.yml @@ -8,8 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/install@56f291b2a0d9e3bce72634356ae949b1e054b9f8 + - uses: actions/checkout@v3 + - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae name: 'nvm install lts/* && npm ci' with: node-version: lts/* diff --git a/.github/workflows/esmeta-typecheck.yml b/.github/workflows/esmeta-typecheck.yml index 6b646e2719d..5a0c236a67d 100644 --- a/.github/workflows/esmeta-typecheck.yml +++ b/.github/workflows/esmeta-typecheck.yml @@ -24,7 +24,7 @@ jobs: cd "${ESMETA_HOME}" git init git remote add origin https://github.com/es-meta/esmeta.git - git fetch --depth 1 origin 688f6241f1a82259504775bcec790bde467b2be9 ;# v0.1.0 + git fetch --depth 1 origin 38ca7770e6c64861735c6a02c902cf58f533bc73 ;# v0.3.3 git checkout FETCH_HEAD - name: build esmeta run: | diff --git a/.github/workflows/ipr.yml b/.github/workflows/ipr.yml index cfc7a3c0679..608b514867c 100644 --- a/.github/workflows/ipr.yml +++ b/.github/workflows/ipr.yml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/install@56f291b2a0d9e3bce72634356ae949b1e054b9f8 + - uses: actions/checkout@v3 + - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae name: 'nvm install lts/* && npm ci' with: node-version: lts/* diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index c180e21f879..d2dd361ea53 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -8,8 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/install@56f291b2a0d9e3bce72634356ae949b1e054b9f8 + - uses: actions/checkout@v3 + - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae name: 'nvm install lts/* && npm ci' with: node-version: lts/* @@ -17,7 +17,7 @@ jobs: - run: npm run build-only - run: node scripts/insert_snapshot_warning - run: echo ${{ github.event.number }} > out/pr.txt - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: out path: out/ diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 0e737392ae6..c3ab4f7f835 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -18,8 +18,8 @@ jobs: }} steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/install@56f291b2a0d9e3bce72634356ae949b1e054b9f8 + - uses: actions/checkout@v3 + - uses: ljharb/actions/node/install@d9f477827ed71a259056764107f74afc29febcae name: 'nvm install lts/* && npm ci' with: node-version: lts/* diff --git a/.github/workflows/publish-biblio.yml b/.github/workflows/publish-biblio.yml index 1f6f2bea74e..dad842ff86b 100644 --- a/.github/workflows/publish-biblio.yml +++ b/.github/workflows/publish-biblio.yml @@ -13,12 +13,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 'lts/*' registry-url: 'https://registry.npmjs.org' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d6e9daec5f..9fbc383dd7a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ Feature requests for future versions of ECMAScript should not be made in this re ##### Creating a new proposal -To make a feature request, document the problem and a sketch of the solution with others in the community, including TC39 members. One place to do this is the [TC39 Discourse](https://es.discourse.group/); another is the [Matrix chat room][]). +To make a feature request, document the problem and a sketch of the solution with others in the community, including TC39 members. One place to do this is the [TC39 Discourse](https://es.discourse.group/); another is the [Matrix chat room][]. Your goal will be to convince others that your proposal is a useful addition to the language and recruit TC39 members to help turn your request into a proposal and shepherd it into the language. Once a proposal is introduced to the committee, new features are considered by the committee according to the [TC39 process document](https://tc39.es/process-document/). diff --git a/LICENSE.md b/LICENSE.md index 69359e7124c..6e6b6a47420 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,5 @@ This repository is licensed according to Ecma International TC39's [Intellectual Property Policy](https://github.com/tc39/how-we-work/blob/HEAD/ip.md). In particular: -- Natural language text is licensed under the "Alternative copyright notice" of the [Ecma text copyright policy](https://www.ecma-international.org/memento/Ecma%20copyright%20faq.htm). + +- Natural language text is licensed under the [Alternative copyright notice of the Ecma text copyright policy](https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy/#alternative-copyright-notice). - Source code is licensed under Ecma's MIT-style [Ecma International Policy on Submission, Inclusion and Licensing of Software](https://www.ecma-international.org/memento/Policies/Ecma_Policy_on_Submission_Inclusion_and_Licensing_of_Software.htm). - Contributions are only accepted from either representatives of Ecma members or signatories of TC39's [Contributor Form](https://tc39.github.io/agreements/contributor/). diff --git a/esmeta-ignore.json b/esmeta-ignore.json index 71c6b122d81..63a4c5bf388 100644 --- a/esmeta-ignore.json +++ b/esmeta-ignore.json @@ -11,31 +11,21 @@ "ArrayAssignmentPattern[2,3].DestructuringAssignmentEvaluation", "ArrayCreate", "AsyncGeneratorBody[0,0].EvaluateAsyncGeneratorBody", - "AsyncGeneratorUnwrapYieldResumption", "BindingPattern[1,0].BindingInitialization", "BoundFunctionCreate", "Catch[0,0].CatchClauseEvaluation", "Catch[1,0].CatchClauseEvaluation", "ClassStaticBlockBody[0,0].EvaluateClassStaticBlockBody", - "CreateArrayIterator", "CreateBuiltinFunction", - "CreateIterResultObject", - "ECMAScriptFunctionObject.Call", - "ECMAScriptFunctionObject.Construct", "FlattenIntoArray", "ForIn/OfBodyEvaluation", "FunctionBody[0,0].EvaluateFunctionBody", "GeneratorBody[0,0].EvaluateGeneratorBody", - "GeneratorValidate", "GetGlobalObject", "GetMethod", "GetPromiseResolve", - "GetPrototypeFromConstructor", "GetThisValue", - "HostEnqueuePromiseJob", - "INTRINSICS.DefaultTimeZone", "InnerModuleEvaluation", - "IntegerIndexedObjectCreate", "LabelledItem[1,0].LabelledEvaluation", "LengthOfArrayLike", "MethodDefinition[0,0].DefineMethod", @@ -43,15 +33,15 @@ "ModuleNamespaceExoticObject.OwnPropertyKeys", "OrdinaryObject.OwnPropertyKeys", "ProxyCreate", + "ScriptEvaluation", "SerializeJSONObject", - "SetDefaultGlobalBindings", "SetFunctionLength", - "SortIndexedProperties", "SourceTextModuleRecord.ExecuteModule", "SourceTextModuleRecord.ResolveExport", "SpeciesConstructor", "Statement[0,0].LabelledEvaluation", "Statement[1,0].LabelledEvaluation", "Statement[2,0].LabelledEvaluation", - "StringCreate" + "StringCreate", + "StringPad" ] diff --git a/figure-2.uxf b/figure-2.uxf deleted file mode 100644 index fb439526d98..00000000000 --- a/figure-2.uxf +++ /dev/null @@ -1,468 +0,0 @@ - - - 10 - - UMLClass - - 390 - 70 - 160 - 30 - - Object.prototype -bg=#cceecc - - - - UMLNote - - 390 - 0 - 160 - 50 - - [[Prototype]] of -Object.prototype is null -bg=#ffeeee - - - - UMLClass - - 390 - 140 - 160 - 100 - - Function.prototype --- -@@hasInstance() -apply() -bind() -call() -bg=#cceecc - - - - Relation - - 480 - 90 - 30 - 70 - - lt=<<- - 10.0;10.0;10.0;50.0 - - - UMLClass - - 390 - 270 - 160 - 60 - - %Generator% --- -@@toStringTag = - "GeneratorFunction" - -bg=#cceecc - - - - Relation - - 480 - 230 - 30 - 60 - - lt=<<- - 10.0;10.0;10.0;40.0 - - - UMLClass - - 390 - 420 - 160 - 50 - - <<callable>> -function *g1() { yield; } - - - - Relation - - 480 - 320 - 30 - 120 - - lt=<<- - 10.0;10.0;10.0;100.0 - - - UMLClass - - 40 - 180 - 160 - 60 - - <<constructor>> -<<callable>> -Function - -bg=#cceecc - - - - Relation - - 130 - 150 - 280 - 50 - - lt=<<- - 260.0;10.0;10.0;10.0;10.0;30.0 - - - UMLClass - - 40 - 270 - 160 - 60 - - <<constructor>> -<<callable>> -%GeneratorFunction% - -bg=#cceecc - - - - Relation - - 130 - 230 - 30 - 60 - - lt=<<- - 10.0;10.0;10.0;40.0 - - - Relation - - 190 - 300 - 220 - 40 - - lt=<-> -m2=constructor -m1=prototype - 10.0;10.0;200.0;10.0 - - - UMLClass - - 740 - 190 - 160 - 50 - - %IteratorPrototype% --- -@@iterator() : object -bg=#cceecc - - - - UMLClass - - 740 - 270 - 160 - 120 - - %GeneratorPrototype% --- -@@toStringTag = - "Generator" --- -next() : object -return() -throw() -bg=#cceecc - - - - Relation - - 540 - 70 - 300 - 140 - - lt=<<- - 10.0;10.0;280.0;10.0;280.0;120.0 - - - UMLClass - - 740 - 420 - 160 - 30 - - g1.prototype - - - - UMLClass - - 740 - 500 - 160 - 30 - - g1() - - - - Relation - - 810 - 230 - 30 - 60 - - lt=<<- - 10.0;10.0;10.0;40.0 - - - Relation - - 810 - 380 - 30 - 60 - - lt=<<- - 10.0;10.0;10.0;40.0 - - - Relation - - 810 - 440 - 30 - 80 - - lt=<<- - 10.0;10.0;10.0;60.0 - - - Relation - - 540 - 430 - 220 - 40 - - lt=-> -m1=prototype - 10.0;10.0;200.0;10.0 - - - Relation - - 540 - 450 - 220 - 70 - - lt=<. - - 10.0;10.0;200.0;50.0 - - - Relation - - 190 - 310 - 220 - 130 - - lt=<. - - 10.0;10.0;200.0;110.0 - - - UMLNote - - 570 - 200 - 150 - 90 - - %Generator% is an -ordinary object that -serves as the abstract -constructor of -Generator instances. -bg=#ffeeee - - - - Relation - - 540 - 230 - 50 - 60 - - lt=. - 10.0;40.0;30.0;10.0 - - - Relation - - 480 - 40 - 30 - 50 - - lt=. - 10.0;30.0;10.0;10.0 - - - Relation - - 540 - 300 - 220 - 40 - - lt=<-> -m2=constructor -m1=prototype - 10.0;10.0;200.0;10.0 - - - UMLNote - - 230 - 430 - 140 - 60 - - A typical generator -function. It is not a -constructor. -bg=#ffeeee - - - - Relation - - 360 - 440 - 50 - 30 - - lt=. - 10.0;10.0;30.0;10.0 - - - UMLNote - - 40 - 350 - 180 - 190 - - %GeneratorFunction% -and %Generator% do not -have global names. - -%GeneratorFunction% is -essentially a subclass of -Function and is structured -as if it were declared as: - - class extends Function { } -bg=#ffeeeee - - - - Relation - - 130 - 320 - 30 - 50 - - lt=. - 10.0;10.0;10.0;30.0 - - - UMLNote - - 340 - 500 - 380 - 120 - - Each Generator Function has an associated prototype -that does not have a constructor property. Hence a -generator instance does not expose access to its generator -function. - -But the prototype may be used to add additional -behavior to its generator function's instances. -bg=#ffeeee - - - - Relation - - 710 - 510 - 50 - 30 - - lt=. - 10.0;10.0;30.0;10.0 - - - Text - - 350 - 380 - 90 - 30 - - instanceof -style=wordwrap - - - - Text - - 670 - 470 - 90 - 30 - - instanceof -style=wordwrap - - - diff --git a/img/figure-1.png b/img/figure-1.png deleted file mode 100644 index 412f6751d41..00000000000 Binary files a/img/figure-1.png and /dev/null differ diff --git a/img/figure-2.png b/img/figure-2.png deleted file mode 100644 index 6ee5f64348e..00000000000 Binary files a/img/figure-2.png and /dev/null differ diff --git a/img/figure-2.svg b/img/figure-2.svg new file mode 100644 index 00000000000..fe1ac95e653 --- /dev/null +++ b/img/figure-2.svg @@ -0,0 +1,301 @@ + + + + + + + + + + + + Object.prototype + + + + + + + + Function.prototype + + + @@hasInstance() + apply() + bind() + call() + + + + + + + + %GeneratorFunction.prototype% + + + @@toStringTag = + "GeneratorFunction" + + + + + + + «constructor» + «callable» + Function + + + + + + + «constructor» + «callable» + %GeneratorFunction% + + + + + + + + %IteratorPrototype% + + + @@iterator() : object + + + + + + + + + %GeneratorPrototype% + + + @@toStringTag = "Generator" + + + next() : object + return() + throw() + + + + + + + + + «callable» + function *g1() { yield; } + + + + + + + g1.prototype + + + + + + + g1() + + + + + + + + + [[Prototype]] of + Object.prototype is null + + + + + + + %GeneratorFunction.prototype% + is an ordinary object that serves + as the abstract constructor of + Generator instances. + + + + + + + %GeneratorFunction% and + %GeneratorFunction.prototype% + do not have global names. + %GeneratorFunction% is + essentially a subclass of + Function and is structured as + if it were declared as: + class extends Function { } + + + + + + + A typical generator + function. It is not a + constructor. + + + + + + + Each Generator Function has an associated + prototype that does not have a constructor + property. Hence a generator instance does not + expose access to its generator function. + But the prototype may be used to add additional + behavior to its generator function's instances. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + constructor + prototype + + + constructor + prototype + + + prototype + + + + + instanceof + + + instanceof + + + + + + + + + + + + + diff --git a/package-lock.json b/package-lock.json index 09329864ff6..5dceaad343f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "SEE LICENSE IN https://tc39.es/ecma262/#sec-copyright-and-software-license", "dependencies": { - "ecmarkup": "^15.0.4" + "ecmarkup": "^18.1.3" }, "devDependencies": { "glob": "^7.1.6", @@ -716,23 +716,23 @@ } }, "node_modules/ecmarkdown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-7.2.0.tgz", - "integrity": "sha512-p0C4SJCvnvtm0y9gPhXBb5DlNbHsNS44ihVKBw3MXviZG2QQpZNH4z/3PbkpgECOjKOeZI+m84ISHVV9WLECFQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-8.1.0.tgz", + "integrity": "sha512-dx6cM6RFjzAXkWr2KQRikED4gy70NFQ0vTI4XUQM/LWcjUYRJUbGdd7nd++trXi5az1JSe49TeeCIVMKDXOtcQ==", "dependencies": { "escape-html": "^1.0.1" } }, "node_modules/ecmarkup": { - "version": "15.0.4", - "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-15.0.4.tgz", - "integrity": "sha512-ZNq+8lZCFwX2dgcRS9xwQfVjFwlF83zzoEQk1l9LHiyxBCG9QtMm8ZwJnONsMlehuoFJKq+nC4vStIbELYDDFg==", + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-18.1.3.tgz", + "integrity": "sha512-grvHr/9NlFnOJQ9rL2+AlD1Q/IGT4siTdl1nsSi6gZVrOxIma6sBR9WStlr9s2TxtKXx7ouM18HsZ+RF9OJlHA==", "dependencies": { "chalk": "^4.1.2", "command-line-args": "^5.2.0", "command-line-usage": "^6.1.1", "dedent-js": "^1.0.1", - "ecmarkdown": "^7.2.0", + "ecmarkdown": "^8.1.0", "eslint-formatter-codeframe": "^7.32.1", "fast-glob": "^3.2.7", "grammarkdown": "^3.2.0", @@ -2932,23 +2932,23 @@ } }, "ecmarkdown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-7.2.0.tgz", - "integrity": "sha512-p0C4SJCvnvtm0y9gPhXBb5DlNbHsNS44ihVKBw3MXviZG2QQpZNH4z/3PbkpgECOjKOeZI+m84ISHVV9WLECFQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/ecmarkdown/-/ecmarkdown-8.1.0.tgz", + "integrity": "sha512-dx6cM6RFjzAXkWr2KQRikED4gy70NFQ0vTI4XUQM/LWcjUYRJUbGdd7nd++trXi5az1JSe49TeeCIVMKDXOtcQ==", "requires": { "escape-html": "^1.0.1" } }, "ecmarkup": { - "version": "15.0.4", - "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-15.0.4.tgz", - "integrity": "sha512-ZNq+8lZCFwX2dgcRS9xwQfVjFwlF83zzoEQk1l9LHiyxBCG9QtMm8ZwJnONsMlehuoFJKq+nC4vStIbELYDDFg==", + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/ecmarkup/-/ecmarkup-18.1.3.tgz", + "integrity": "sha512-grvHr/9NlFnOJQ9rL2+AlD1Q/IGT4siTdl1nsSi6gZVrOxIma6sBR9WStlr9s2TxtKXx7ouM18HsZ+RF9OJlHA==", "requires": { "chalk": "^4.1.2", "command-line-args": "^5.2.0", "command-line-usage": "^6.1.1", "dedent-js": "^1.0.1", - "ecmarkdown": "^7.2.0", + "ecmarkdown": "^8.1.0", "eslint-formatter-codeframe": "^7.32.1", "fast-glob": "^3.2.7", "grammarkdown": "^3.2.0", diff --git a/package.json b/package.json index e6100ca391b..5b4aa5d191c 100644 --- a/package.json +++ b/package.json @@ -5,15 +5,11 @@ "description": "The ECMAScript specification", "scripts": { "ipr-check": "node scripts/check-form tc39/ecma262 HEAD --all", - "prebuild-spec": "git remote rm travis-origin 2>/dev/null ; git remote add travis-origin \"git@github.com:${TRAVIS_REPO_SLUG:-tc39/ecma262}.git\" && git fetch --quiet travis-origin", - "build-spec": "YEAR=2022 && git checkout --quiet \"es${YEAR}\" && mkdir -p \"out/${YEAR}\" && cp -R img \"out/${YEAR}\" && ecmarkup --verbose spec.html \"out/${YEAR}/index.html\" --css \"out/${YEAR}/ecmarkup.css\" --js \"out/${YEAR}/ecmarkup.js\" && git checkout --quiet travis-origin/test-travis", - "postbuild-spec": "git remote rm travis-origin", "build-head": "npm run build-only -- --lint-spec --strict", "prebuild-only": "npm run clean && mkdir out && cp -R img out", "build-only": "ecmarkup --verbose spec.html --multipage out", "build": "npm run build-head", "build-for-pdf": "npm run build-head -- --old-toc", - "build-travis": "npm run build-head && npm run build-spec", "prebuild-snapshot": "npm run clean", "build-snapshot": "npm run build-head && node scripts/insert_snapshot_warning.js", "clean": "rm -rf out", @@ -27,7 +23,7 @@ "license": "SEE LICENSE IN https://tc39.es/ecma262/#sec-copyright-and-software-license", "homepage": "https://tc39.es/ecma262/", "dependencies": { - "ecmarkup": "^15.0.4" + "ecmarkup": "^18.1.3" }, "devDependencies": { "glob": "^7.1.6", diff --git a/scripts/check-form.js b/scripts/check-form.js index 9eeef02c83d..2282f625400 100644 --- a/scripts/check-form.js +++ b/scripts/check-form.js @@ -76,18 +76,65 @@ const initial = '11db17a21add028b8d12930a8b047af1df2d3194'; // git rev-list --ma const perPage = 100; +const legacyCommitsWithUnknownAuthors = new Set([ + '6e2f689b1bcecaf59f5e7c76e544443ffe4ed299', + 'a103b287cd19bdc51c7a3d8d7c1431b1506a74e2', + '2527be4344c78e5ed56aef8e08463160f5bb2154', + '5c9f191c9e6ccfc909817510bf74fd64ea145ac4', + '8710d2b2a8906d0d41e90cfcb9f47573d8d573fb', + '0b89915d3ccbf372e8114d823688d74e7778bfdb', + '4374762005846b779d1cc4f03aeababe41af0e79', + '676dae0955b072a31b05eafdab17dfcd8f7b4975', + '2724be0f9aeb6265c60935334a3bdc293b2c4b4e', + '1c6fb24ef7b29558593ce6fd4310c3bc4fe67d82', + 'dcc9584e642b55b8a99df91f2e80d065e3d2451c', + 'daef7b05b2625caf06ab546acd6eb654e9777d16', + 'eb0615ea028000d84f3d5dcd9d94a74558d3a206', + '50ec9b4195df6caf4da2352e0edb19024b515f2d', + '8d7995d6f7538534f2a54af4811c939ac8614676', + '1046a423adf3ea9c5460cdbdf3a9c156f52f1632', + 'cdf5865b7da09cce276581f134349e24d2b6c199', + 'b7d01876c19751e4c75d9910ce4fb2e0d1dc45fa', + 'cc46cc38b9374d13f958cc6992daaec73d5fbecd', + 'f424bf075fe582ed8acc36e8a420ee713a21561a', // https://github.com/tc39/ecma262/pull/3142 + 'bea8d0d682fcf2be2a29564bd2ae66ab9dcce21c', // https://github.com/tc39/ecma262/pull/612, user deleted their github + '329069469609d8f05ad64c328e2295c171050ce4', // https://github.com/tc39/ecma262/pull/3249, commit email doesn't point to the github user +]); + +function getAuthorFromCommit(commitObj) { + if (!commitObj) { + return false; + } + const { author } = commitObj; + if (!author) { + return Symbol(commitObj.sha); + } + return author.login; +} + async function getAllCommits(page = 1) { const commitsURL = `https://api.github.com/repos/${slug}/commits?anon=1&per_page=${perPage}&page=${page}&sha=${sha}`; const commits = await request(commitsURL).then((json) => JSON.parse(json)); return [...new Set([].concat( - commits.flatMap(x => x?.author?.login || []), + commits.flatMap(x => getAuthorFromCommit(x) || []), commits.length < perPage ? [] : await getAllCommits(page + 1), ))]; } const authors = getAllCommits().then((authors) => { - console.log(`Found ${authors.length} authors: ${authors.join(',')}\n`); - return authors; + const knowns = authors.filter(x => typeof x === 'string'); + const unknowns = authors.filter(x => typeof x === 'symbol' && !legacyCommitsWithUnknownAuthors.has(x.description)); + console.log(`Found ${knowns.length} authors: ${knowns.join(',')}\n`); + if (unknowns.length > 0) { + console.log(`${unknowns.length} commits have an unknown author: ${unknowns.map(x => x.description).join(',')}\n`); + } + if (legacyCommitsWithUnknownAuthors.size > 0) { + console.log(`${legacyCommitsWithUnknownAuthors.size} commits with an unknown author are legacy: ${[...legacyCommitsWithUnknownAuthors].join(',')}\n`); + } + if (unknowns.length > 0) { + throw unknowns; + } + return knowns; }); const teamURL = (team) => `https://api.github.com/orgs/tc39/teams/${team}`; @@ -107,12 +154,12 @@ function getMembers(teamID, page = 1) { const aliases = new Map([ ['bmeck', 'bfarias-godaddy'], - ['PeterJensen', 'P-Jensen'], + ['PeterJensen', 'P-Jensen'].map(x => x.toLowerCase()), ]); function handler(kind) { return (data) => { - const names = new Set(data.map(x => x.login)); + const names = new Set(data.map(x => x.login.toLowerCase())); aliases.forEach((alias, main) => { if (names.has(main)) { names.add(alias); @@ -138,9 +185,9 @@ const usernames = request(sheetData).then((json) => JSON.parse(json)).then(data const usernames = new Set( data.values .flat(1) - .map(x => x.replace(/^(https?:\/\/)?github\.com\//, '').replace(/^@/, '')) + .map(x => x.replace(/^(https?:\/\/)?github\.com\//, '').replace(/^@/, '').toLowerCase()) .filter(x => /^[a-z0-9_-]{1,39}$/gi.test(x)) - .sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())) + .sort((a, b) => a.localeCompare(b)) ); console.log(`Found ${usernames.size} usernames: ` + [...usernames].join(',') + '\n'); return usernames; @@ -156,7 +203,7 @@ const exceptions = new Set([ 'GeorgNeis', 'natashenka', // Google employee 'IgorMinar', // former Google employee -]); +].map(x => x.toLowerCase())); // TODO: remove these as they sign the form const legacy = new Set([ @@ -166,17 +213,14 @@ const legacy = new Set([ 'ivan-pan', 'szuend', 'chrikrah', - 'daemon1024', 'viktmv', 'bathos', 'johnnyrainbow', 'Kriyszig', 'Tomy8s', - 'targos', 'ahungry', 'divmain', 'RReverser', - 'charmander', 'him2him2', 'jungshik', 'tmerr', @@ -193,16 +237,17 @@ const legacy = new Set([ 'prayagverma', 'UltCombo', 'ReadmeCritic', - 'DavidBruant', 'dslomov', 'DmitrySoshnikov', 'jsreeram', 'antony-jeong', -]); + 'bojavou', +].map(x => x.toLowerCase())); Promise.all([usernames, authors, delegates, emeriti]).then(([usernames, authors, delegates, emeriti]) => { let legacyCount = legacy.size; - const missing = authors.filter(a => { + const missing = authors.filter(author => { + const a = author.toLowerCase(); const signed = usernames.has(a) || delegates.has(a) || emeriti.has(a) diff --git a/scripts/insert_snapshot_warning.js b/scripts/insert_snapshot_warning.js index b6e7aedf17b..e2d02e6bfc1 100644 --- a/scripts/insert_snapshot_warning.js +++ b/scripts/insert_snapshot_warning.js @@ -5,7 +5,7 @@ const path = require('path'); const { JSDOM } = require('jsdom'); const { execSync } = require('child_process'); -const COMMIT = String(execSync('git rev-parse --verify HEAD')); +const COMMIT = String(execSync('git rev-parse --verify HEAD')).trim(); const WARNING_HTML = fs.readFileSync(path.join(__dirname, 'snapshot_warning.html'), 'utf8') .replace(/{COMMIT}/g, COMMIT); diff --git a/spec.html b/spec.html index 45c21ae6371..0ce2ac31376 100644 --- a/spec.html +++ b/spec.html @@ -40,25 +40,15 @@ width: 100%; font-size: 80%; } - - .module-overflow { - overflow-y: scroll; - display: block; - } - - .module-overflow-note { - overflow-y: scroll; - } -
-  title: ECMAScript® 2023 Language Specification
+  title: ECMAScript® 2025 Language Specification
   shortname: ECMA-262
   status: draft
   location: https://tc39.es/ecma262/
   markEffects: true
 
-

+

About this Specification

The document at https://tc39.es/ecma262/ is the most accurate and up-to-date ECMAScript specification. It contains the content of the most recent yearly snapshot plus any finished proposals (those that have reached Stage 4 in the proposal process and thus are implemented in several implementations and will be in the next practical revision) since that snapshot was taken.

@@ -92,7 +82,7 @@

Contributing to this Specification

Introduction

-

This Ecma Standard defines the ECMAScript 2023 Language. It is the fourteenth edition of the ECMAScript Language Specification. Since publication of the first edition in 1997, ECMAScript has grown to be one of the world's most widely used general-purpose programming languages. It is best known as the language embedded in web browsers but has also been widely adopted for server and embedded applications.

+

This Ecma Standard defines the ECMAScript 2025 Language. It is the sixteenth edition of the ECMAScript Language Specification. Since publication of the first edition in 1997, ECMAScript has grown to be one of the world's most widely used general-purpose programming languages. It is best known as the language embedded in web browsers but has also been widely adopted for server and embedded applications.

ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company's Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with Internet Explorer 3.0.

The development of the ECMAScript Language Specification started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997.

That Ecma Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved as international standard ISO/IEC 16262, in April 1998. The Ecma General Assembly of June 1998 approved the second edition of ECMA-262 to keep it fully aligned with ISO/IEC 16262. Changes between the first and the second edition are editorial in nature.

@@ -105,9 +95,11 @@

Introduction

ECMAScript 2017 introduced Async Functions, Shared Memory, and Atomics along with smaller language and library enhancements, bug fixes, and editorial updates. Async functions improve the asynchronous programming experience by providing syntax for promise-returning functions. Shared Memory and Atomics introduce a new memory model that allows multi-agent programs to communicate using atomic operations that ensure a well-defined execution order even on parallel CPUs. It also included new static methods on Object: `Object.values`, `Object.entries`, and `Object.getOwnPropertyDescriptors`.

ECMAScript 2018 introduced support for asynchronous iteration via the AsyncIterator protocol and async generators. It also included four new regular expression features: the `dotAll` flag, named capture groups, Unicode property escapes, and look-behind assertions. Lastly it included object rest and spread properties.

ECMAScript 2019 introduced a few new built-in functions: `flat` and `flatMap` on `Array.prototype` for flattening arrays, `Object.fromEntries` for directly turning the return value of `Object.entries` into a new Object, and `trimStart` and `trimEnd` on `String.prototype` as better-named alternatives to the widely implemented but non-standard `String.prototype.trimLeft` and `trimRight` built-ins. In addition, it included a few minor updates to syntax and semantics. Updated syntax included optional catch binding parameters and allowing U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) in string literals to align with JSON. Other updates included requiring that `Array.prototype.sort` be a stable sort, requiring that `JSON.stringify` return well-formed UTF-8 regardless of input, and clarifying `Function.prototype.toString` by requiring that it either return the corresponding original source text or a standard placeholder.

-

ECMAScript 2020, the 11th edition, introduced the `matchAll` method for Strings, to produce an iterator for all match objects generated by a global regular expression; `import()`, a syntax to asynchronously import Modules with a dynamic specifier; `BigInt`, a new number primitive for working with arbitrary precision integers; `Promise.allSettled`, a new Promise combinator that does not short-circuit; `globalThis`, a universal way to access the global `this` value; dedicated `export * as ns from 'module'` syntax for use within modules; increased standardization of `for-in` enumeration order; `import.meta`, a host-populated object available in Modules that may contain contextual information about the Module; as well as adding two new syntax features to improve working with “nullish” values (*null* or *undefined*): nullish coalescing, a value selection operator; and optional chaining, a property access and function invocation operator that short-circuits if the value to access/invoke is nullish.

+

ECMAScript 2020, the 11th edition, introduced the `matchAll` method for Strings, to produce an iterator for all match objects generated by a global regular expression; `import()`, a syntax to asynchronously import Modules with a dynamic specifier; `BigInt`, a new number primitive for working with arbitrary precision integers; `Promise.allSettled`, a new Promise combinator that does not short-circuit; `globalThis`, a universal way to access the global `this` value; dedicated `export * as ns from 'module'` syntax for use within modules; increased standardization of `for-in` enumeration order; `import.meta`, a host-populated object available in Modules that may contain contextual information about the Module; as well as adding two new syntax features to improve working with “nullish” values (*undefined* or *null*): nullish coalescing, a value selection operator; and optional chaining, a property access and function invocation operator that short-circuits if the value to access/invoke is nullish.

ECMAScript 2021, the 12th edition, introduced the `replaceAll` method for Strings; `Promise.any`, a Promise combinator that short-circuits when an input value is fulfilled; `AggregateError`, a new Error type to represent multiple errors at once; logical assignment operators (`??=`, `&&=`, `||=`); `WeakRef`, for referring to a target object without preserving it from garbage collection, and `FinalizationRegistry`, to manage registration and unregistration of cleanup operations performed when target objects are garbage collected; separators for numeric literals (`1_000`); and `Array.prototype.sort` was made more precise, reducing the amount of cases that result in an implementation-defined sort order.

ECMAScript 2022, the 13th edition, introduced top-level `await`, allowing the keyword to be used at the top level of modules; new class elements: public and private instance fields, public and private static fields, private instance methods and accessors, and private static methods and accessors; static blocks inside classes, to perform per-class evaluation initialization; the `#x in obj` syntax, to test for presence of private fields on objects; regular expression match indices via the `/d` flag, which provides start and end indices for matched substrings; the `cause` property on `Error` objects, which can be used to record a causation chain in errors; the `at` method for Strings, Arrays, and TypedArrays, which allows relative indexing; and `Object.hasOwn`, a convenient alternative to `Object.prototype.hasOwnProperty`.

+

ECMAScript 2023, the 14th edition, introduced the `toSorted`, `toReversed`, `with`, `findLast`, and `findLastIndex` methods on `Array.prototype` and `TypedArray.prototype`, as well as the `toSpliced` method on `Array.prototype`; added support for `#!` comments at the beginning of files to better facilitate executable ECMAScript files; and allowed the use of most Symbols as keys in weak collections.

+

ECMAScript 2024, the 15th edition, added facilities for resizing and transferring ArrayBuffers and SharedArrayBuffers; added a new RegExp `/v` flag for creating RegExps with more advanced features for working with sets of strings; and introduced the `Promise.withResolvers` convenience method for constructing Promises, the `Object.groupBy` and `Map.groupBy` methods for aggregating data, the `Atomics.waitAsync` method for asynchronously waiting for a change to shared memory, and the `String.prototype.isWellFormed` and `String.prototype.toWellFormed` methods for checking and ensuring that strings contain only well-formed Unicode.

Dozens of individuals representing many organizations have made very significant contributions within Ecma TC39 to the development of this edition and to the prior editions. In addition, a vibrant community has emerged supporting TC39's ECMAScript efforts. This community has reviewed numerous drafts, filed thousands of bug reports, performed implementation experiments, contributed test suites, and educated the world-wide developer community about ECMAScript. Unfortunately, it is impossible to identify and acknowledge every person and organization who has contributed to this effort.

Allen Wirfs-Brock
@@ -121,11 +113,23 @@

Introduction

Jordan Harband
ECMA-262, Project Editor, 10th through 12th Editions

+

+ Shu-yu Guo
+ ECMA-262, Project Editor, 12th through 15th Editions +

+

+ Michael Ficarra
+ ECMA-262, Project Editor, 12th through 15th Editions +

+

+ Kevin Gibbons
+ ECMA-262, Project Editor, 12th through 15th Editions +

Scope

-

This Standard defines the ECMAScript 2023 general-purpose programming language.

+

This Standard defines the ECMAScript 2025 general-purpose programming language.

@@ -159,14 +163,19 @@

Example Legacy Normative Optional Clause Heading

Normative References

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

-

ISO/IEC 10646 Information Technology — Universal Multiple-Octet Coded Character Set (UCS) plus Amendment 1:2005, Amendment 2:2006, Amendment 3:2008, and Amendment 4:2008, plus additional amendments and corrigenda, or successor

+

IEEE 754-2019, IEEE Standard for Floating-Point Arithmetic.

- ECMA-402, ECMAScript 2015 Internationalization API Specification.
- https://ecma-international.org/publications/standards/Ecma-402.htm + The Unicode Standard.
+ https://unicode.org/versions/latest +

+

ISO/IEC 10646, Information Technology — Universal Multiple-Octet Coded Character Set (UCS) plus Amendment 1:2005, Amendment 2:2006, Amendment 3:2008, Amendment 4:2008, and additional amendments and corrigenda, or successor.

+

+ ECMA-402, ECMAScript Internationalization API Specification, specifically the annual edition corresponding to this edition of this specification.
+ https://www.ecma-international.org/publications-and-standards/standards/ecma-402/

ECMA-404, The JSON Data Interchange Format.
- https://ecma-international.org/publications/standards/Ecma-404.htm + https://www.ecma-international.org/publications-and-standards/standards/ecma-404/

@@ -217,7 +226,7 @@

Objects

Even though ECMAScript includes syntax for class definitions, ECMAScript objects are not fundamentally class-based such as those in C++, Smalltalk, or Java. Instead objects may be created in various ways including via a literal notation or via constructors which create objects and then execute code that initializes all or part of them by assigning initial values to their properties. Each constructor is a function that has a property named *"prototype"* that is used to implement prototype-based inheritance and shared properties. Objects are created by using constructors in new expressions; for example, `new Date(2009, 11)` creates a new Date object. Invoking a constructor without using new has consequences that depend on the constructor. For example, `Date()` produces a string representation of the current date and time rather than an object.

Every object created by a constructor has an implicit reference (called the object's prototype) to the value of its constructor's *"prototype"* property. Furthermore, a prototype may have a non-*null* implicit reference to its prototype, and so on; this is called the prototype chain. When a reference is made to a property in an object, that reference is to the property of that name in the first object in the prototype chain that contains a property of that name. In other words, first the object mentioned directly is examined for such a property; if that object contains the named property, that is the property to which the reference refers; if that object does not contain the named property, the prototype for that object is examined next; and so on.

- An image of lots of boxes and arrows. + An image of lots of boxes and arrows.

In a class-based object-oriented language, in general, state is carried by instances, methods are carried by classes, and inheritance is only of structure and behaviour. In ECMAScript, the state and methods are carried by objects, while structure, behaviour, and state are all inherited.

All objects that do not directly contain a particular property that their prototype contains share that property and its value. Figure 1 illustrates this:

@@ -315,7 +324,7 @@

standard object

built-in object

object specified and supplied by an ECMAScript implementation

-

Standard built-in objects are defined in this specification. An ECMAScript implementation may specify and supply additional kinds of built-in objects. A built-in constructor is a built-in object that is also a constructor.

+

Standard built-in objects are defined in this specification. An ECMAScript implementation may specify and supply additional kinds of built-in objects.

@@ -458,6 +467,14 @@

built-in function

+ +

built-in constructor

+

built-in function that is a constructor

+ +

Examples of built-in constructors include `Object` and `Function`. A host or implementation may provide additional built-in constructors that are not described in this specification.

+
+
+

property

part of an object that associates a key (either a String value or a Symbol value) and a value

@@ -1047,7 +1064,7 @@

Mathematical Operations

@@ -1063,11 +1080,11 @@

Mathematical Operations

The notation “_x_ modulo _y_” (_y_ must be finite and non-zero) computes a value _k_ of the same sign as _y_ (or zero) such that abs(_k_) < abs(_y_) and _x_ - _k_ = _q_ × _y_ for some integer _q_.

The phrase "the result of clamping _x_ between _lower_ and _upper_" (where _x_ is an extended mathematical value and _lower_ and _upper_ are mathematical values such that _lower_ ≤ _upper_) produces _lower_ if _x_ < _lower_, produces _upper_ if _x_ > _upper_, and otherwise produces _x_.

The mathematical function floor(_x_) produces the largest integer (closest to +∞) that is not larger than _x_.

-

The mathematical function truncate(_x_) removes the fractional part of _x_ by rounding towards zero, producing -floor(-_x_) if _x_ < 0 and otherwise producing floor(_x_).

-

Mathematical functions min, max, abs, floor, and truncate are not defined for Numbers and BigInts, and any usage of those methods that have non-mathematical value arguments would be an editorial error in this specification.

floor(_x_) = _x_ - (_x_ modulo 1).

+

The mathematical function truncate(_x_) removes the fractional part of _x_ by rounding towards zero, producing -floor(-_x_) if _x_ < 0 and otherwise producing floor(_x_).

+

Mathematical functions min, max, abs, floor, and truncate are not defined for Numbers and BigInts, and any usage of those methods that have non-mathematical value arguments would be an editorial error in this specification.

An interval from lower bound _a_ to upper bound _b_ is a possibly-infinite, possibly-empty set of numeric values of the same numeric type. Each bound will be described as either inclusive or exclusive, but not both. There are four kinds of intervals, as follows:

@@ -17486,7 +17785,7 @@

Static Semantics: SV ( ): a String

The SV of NonEscapeCharacter :: SourceCharacter but not one of EscapeCharacter or LineTerminator is the result of performing UTF16EncodeCodePoint on the code point matched by |SourceCharacter|.
  • - The SV of EscapeSequence :: LegacyOctalEscapeSequence is the String value consisting of the code unit whose value is the MV of |LegacyOctalEscapeSequence|. + The SV of EscapeSequence :: LegacyOctalEscapeSequence is the String value consisting of the code unit whose numeric value is the MV of |LegacyOctalEscapeSequence|.
  • The SV of NonOctalDecimalEscapeSequence :: `8` is the String value consisting of the code unit 0x0038 (DIGIT EIGHT). @@ -17495,10 +17794,10 @@

    Static Semantics: SV ( ): a String

    The SV of NonOctalDecimalEscapeSequence :: `9` is the String value consisting of the code unit 0x0039 (DIGIT NINE).
  • - The SV of HexEscapeSequence :: `x` HexDigit HexDigit is the String value consisting of the code unit whose value is the MV of |HexEscapeSequence|. + The SV of HexEscapeSequence :: `x` HexDigit HexDigit is the String value consisting of the code unit whose numeric value is the MV of |HexEscapeSequence|.
  • - The SV of Hex4Digits :: HexDigit HexDigit HexDigit HexDigit is the String value consisting of the code unit whose value is the MV of |Hex4Digits|. + The SV of Hex4Digits :: HexDigit HexDigit HexDigit HexDigit is the String value consisting of the code unit whose numeric value is the MV of |Hex4Digits|.
  • The SV of UnicodeEscapeSequence :: `u{` CodePoint `}` is the result of performing UTF16EncodeCodePoint on the MV of |CodePoint|. @@ -17714,7 +18013,7 @@

    Static Semantics: TV ( ): a String or *undefined*

    The TV of TemplateTail :: `}` ``` is the empty String.
  • - The TV of TemplateCharacters :: TemplateCharacter TemplateCharacters is *undefined* if either the TV of |TemplateCharacter| is *undefined* or the TV of |TemplateCharacters| is *undefined*. Otherwise, it is the string-concatenation of the TV of |TemplateCharacter| and the TV of |TemplateCharacters|. + The TV of TemplateCharacters :: TemplateCharacter TemplateCharacters is *undefined* if the TV of |TemplateCharacter| is *undefined* or the TV of |TemplateCharacters| is *undefined*. Otherwise, it is the string-concatenation of the TV of |TemplateCharacter| and the TV of |TemplateCharacters|.
  • The TV of TemplateCharacter :: SourceCharacter but not one of ``` or `\` or `$` or LineTerminator is the result of performing UTF16EncodeCodePoint on the code point matched by |SourceCharacter|. @@ -17895,6 +18194,9 @@

    Rules of Automatic Semicolon Insertion

    LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] `++` LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] `--` + UsingDeclaration[In, Yield, Await] : + `using` [no LineTerminator here] BindingList[?In, ?Yield, ?Await, ~Pattern] `;` + ContinueStatement[Yield, Await] : `continue` `;` `continue` [no LineTerminator here] LabelIdentifier[?Yield, ?Await] `;` @@ -17950,6 +18252,9 @@

    Rules of Automatic Semicolon Insertion

  • When a `++` or `--` token is encountered where the parser would treat it as a postfix operator, and at least one |LineTerminator| occurred between the preceding token and the `++` or `--` token, then a semicolon is automatically inserted before the `++` or `--` token.
  • +
  • + When a `using` token is encountered and a |LineTerminator| is encountered before an |IdentifierName| token, a semicolon is automatically inserted after the `using` token. +
  • When a `continue`, `break`, `return`, `throw`, or `yield` token is encountered and a |LineTerminator| is encountered before the next token, a semicolon is automatically inserted after the `continue`, `break`, `return`, `throw`, or `yield` token.
  • @@ -17968,6 +18273,9 @@

    Rules of Automatic Semicolon Insertion

  • A postfix `++` or `--` operator should be on the same line as its operand.
  • +
  • + A |BindingList| in a `using` declaration should start on the same line as the `using` token. +
  • An |Expression| in a `return` or `throw` statement or an |AssignmentExpression| in a `yield` expression should start on the same line as the `return`, `throw`, or `yield` token.
  • @@ -18131,7 +18439,7 @@

    Static Semantics: Early Errors

    BindingIdentifier : Identifier
    • - It is a Syntax Error if the source text matched by this production is contained in strict mode code and the StringValue of |Identifier| is *"arguments"* or *"eval"*. + It is a Syntax Error if the source text matched by this production is contained in strict mode code and the StringValue of |Identifier| is either *"arguments"* or *"eval"*.
    @@ -18192,13 +18500,13 @@

    Static Semantics: Early Errors

    Identifier : IdentifierName but not ReservedWord
    • - It is a Syntax Error if this phrase is contained in strict mode code and the StringValue of |IdentifierName| is: *"implements"*, *"interface"*, *"let"*, *"package"*, *"private"*, *"protected"*, *"public"*, *"static"*, or *"yield"*. + It is a Syntax Error if this phrase is contained in strict mode code and the StringValue of |IdentifierName| is one of *"implements"*, *"interface"*, *"let"*, *"package"*, *"private"*, *"protected"*, *"public"*, *"static"*, or *"yield"*.
    • It is a Syntax Error if the goal symbol of the syntactic grammar is |Module| and the StringValue of |IdentifierName| is *"await"*.
    • - It is a Syntax Error if StringValue of |IdentifierName| is the same String value as the StringValue of any |ReservedWord| except for `yield` or `await`. + It is a Syntax Error if the StringValue of |IdentifierName| is the StringValue of any |ReservedWord| except for `yield` or `await`.
    @@ -18410,7 +18718,7 @@

    1. Let _len_ be _nextIndex_ + 1. 1. Perform ? Set(_array_, *"length"*, 𝔽(_len_), *true*). - 1. NOTE: The above step throws if _len_ exceeds 232-1. + 1. NOTE: The above step throws if _len_ exceeds 232 - 1. 1. Return _len_. Elision : Elision `,` @@ -18453,12 +18761,11 @@

    1. Let _spreadRef_ be ? Evaluation of |AssignmentExpression|. 1. Let _spreadObj_ be ? GetValue(_spreadRef_). - 1. Let _iteratorRecord_ be ? GetIterator(_spreadObj_). + 1. Let _iteratorRecord_ be ? GetIterator(_spreadObj_, ~sync~). 1. Repeat, - 1. Let _next_ be ? IteratorStep(_iteratorRecord_). - 1. If _next_ is *false*, return _nextIndex_. - 1. Let _nextValue_ be ? IteratorValue(_next_). - 1. Perform ! CreateDataPropertyOrThrow(_array_, ! ToString(𝔽(_nextIndex_)), _nextValue_). + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, return _nextIndex_. + 1. Perform ! CreateDataPropertyOrThrow(_array_, ! ToString(𝔽(_nextIndex_)), _next_). 1. Set _nextIndex_ to _nextIndex_ + 1. @@ -18682,7 +18989,7 @@

    1. Let _propKey_ be ? Evaluation of |PropertyName|. 1. If this |PropertyDefinition| is contained within a |Script| that is being evaluated for JSON.parse (see step of JSON.parse), then 1. Let _isProtoSetter_ be *false*. - 1. Else if _propKey_ is the String value *"__proto__"* and if IsComputedPropertyKey of |PropertyName| is *false*, then + 1. Else if _propKey_ is *"__proto__"* and IsComputedPropertyKey of |PropertyName| is *false*, then 1. Let _isProtoSetter_ be *true*. 1. Else, 1. Let _isProtoSetter_ be *false*. @@ -18742,13 +19049,15 @@

    It determines if its argument is a valid regular expression literal.
    - 1. If FlagText of _literal_ contains any code points other than `d`, `g`, `i`, `m`, `s`, `u`, or `y`, or if it contains the same code point more than once, return *false*. + 1. Let _flags_ be FlagText of _literal_. + 1. If _flags_ contains any code points other than `d`, `g`, `i`, `m`, `s`, `u`, `v`, or `y`, or if _flags_ contains any code point more than once, return *false*. + 1. If _flags_ contains `u`, let _u_ be *true*; else let _u_ be *false*. + 1. If _flags_ contains `v`, let _v_ be *true*; else let _v_ be *false*. 1. Let _patternText_ be BodyText of _literal_. - 1. If FlagText of _literal_ contains `u`, let _u_ be *true*; else let _u_ be *false*. - 1. If _u_ is *false*, then + 1. If _u_ is *false* and _v_ is *false*, then 1. Let _stringValue_ be CodePointsToString(_patternText_). 1. Set _patternText_ to the sequence of code points resulting from interpreting each of the 16-bit elements of _stringValue_ as a Unicode BMP code point. UTF-16 decoding is not applied to the elements. - 1. Let _parseResult_ be ParsePattern(_patternText_, _u_). + 1. Let _parseResult_ be ParsePattern(_patternText_, _u_, _v_). 1. If _parseResult_ is a Parse Node, return *true*; else return *false*. @@ -18800,7 +19109,7 @@

    Static Semantics: Early Errors

    • - It is a Syntax Error if the number of elements in the result of TemplateStrings of |TemplateLiteral| with argument *false* is greater than 232 - 1. + It is a Syntax Error if the number of elements in the result of TemplateStrings of |TemplateLiteral| with argument *false* is greater than or equal to 232.
    @@ -18838,7 +19147,7 @@

    Static Semantics: Early Errors

    Static Semantics: TemplateStrings ( _raw_: a Boolean, - ): a List of Strings + ): a List of either Strings or *undefined*

    @@ -18879,7 +19188,7 @@

    Static Semantics: TemplateString ( _templateToken_: a |NoSubstitutionTemplate| Parse Node, a |TemplateHead| Parse Node, a |TemplateMiddle| Parse Node, or a |TemplateTail| Parse Node, _raw_: a Boolean, - ): a String + ): a String or *undefined*

    @@ -18890,6 +19199,9 @@

    1. Let _string_ be the TV of _templateToken_. 1. Return _string_. + +

    This operation returns *undefined* if _raw_ is *false* and _templateToken_ contains a |NotEscapeSequence|. In all other cases, it returns a String.

    +
    @@ -18907,6 +19219,7 @@

    1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then 1. Return _e_.[[Array]]. 1. Let _rawStrings_ be TemplateStrings of _templateLiteral_ with argument *true*. + 1. Assert: _rawStrings_ is a List of Strings. 1. Let _cookedStrings_ be TemplateStrings of _templateLiteral_ with argument *false*. 1. Let _count_ be the number of elements in the List _cookedStrings_. 1. Assert: _count_ ≤ 232 - 1. @@ -18923,7 +19236,7 @@

    1. Perform ! SetIntegrityLevel(_rawObj_, ~frozen~). 1. Perform ! DefinePropertyOrThrow(_template_, *"raw"*, PropertyDescriptor { [[Value]]: _rawObj_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). 1. Perform ! SetIntegrityLevel(_template_, ~frozen~). - 1. Append the Record { [[Site]]: _templateLiteral_, [[Array]]: _template_ } to _templateRegistry_. + 1. Append the Record { [[Site]]: _templateLiteral_, [[Array]]: _template_ } to _realm_.[[TemplateMap]]. 1. Return _template_. @@ -19265,7 +19578,7 @@

    Runtime Semantics: Evaluation

    EvaluatePropertyAccessWithExpressionKey ( _baseValue_: an ECMAScript language value, - _expression_: a Parse Node, + _expression_: an |Expression| Parse Node, _strict_: a Boolean, ): either a normal completion containing a Reference Record or an abrupt completion

    @@ -19321,7 +19634,8 @@

    1. Let _ref_ be ? Evaluation of _constructExpr_. 1. Let _constructor_ be ? GetValue(_ref_). - 1. If _arguments_ is ~empty~, let _argList_ be a new empty List. + 1. If _arguments_ is ~empty~, then + 1. Let _argList_ be a new empty List. 1. Else, 1. Let _argList_ be ? ArgumentListEvaluation of _arguments_. 1. If IsConstructor(_constructor_) is *false*, throw a *TypeError* exception. @@ -19493,12 +19807,11 @@

    Runtime Semantics: ArgumentListEvaluation ( ): either a normal completion co 1. Let _list_ be a new empty List. 1. Let _spreadRef_ be ? Evaluation of |AssignmentExpression|. 1. Let _spreadObj_ be ? GetValue(_spreadRef_). - 1. Let _iteratorRecord_ be ? GetIterator(_spreadObj_). + 1. Let _iteratorRecord_ be ? GetIterator(_spreadObj_, ~sync~). 1. Repeat, - 1. Let _next_ be ? IteratorStep(_iteratorRecord_). - 1. If _next_ is *false*, return _list_. - 1. Let _nextArg_ be ? IteratorValue(_next_). - 1. Append _nextArg_ to _list_. + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, return _list_. + 1. Append _next_ to _list_. ArgumentList : ArgumentList `,` AssignmentExpression @@ -19511,12 +19824,11 @@

    Runtime Semantics: ArgumentListEvaluation ( ): either a normal completion co 1. Let _precedingArgs_ be ? ArgumentListEvaluation of |ArgumentList|. 1. Let _spreadRef_ be ? Evaluation of |AssignmentExpression|. - 1. Let _iteratorRecord_ be ? GetIterator(? GetValue(_spreadRef_)). + 1. Let _iteratorRecord_ be ? GetIterator(? GetValue(_spreadRef_), ~sync~). 1. Repeat, - 1. Let _next_ be ? IteratorStep(_iteratorRecord_). - 1. If _next_ is *false*, return _precedingArgs_. - 1. Let _nextArg_ be ? IteratorValue(_next_). - 1. Append _nextArg_ to _precedingArgs_. + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, return _precedingArgs_. + 1. Append _next_ to _precedingArgs_. TemplateLiteral : NoSubstitutionTemplate @@ -19555,7 +19867,7 @@

    Runtime Semantics: Evaluation

    1. Let _baseReference_ be ? Evaluation of |MemberExpression|. 1. Let _baseValue_ be ? GetValue(_baseReference_). - 1. If _baseValue_ is *undefined* or *null*, then + 1. If _baseValue_ is either *undefined* or *null*, then 1. Return *undefined*. 1. Return ? ChainEvaluation of |OptionalChain| with arguments _baseValue_ and _baseReference_. @@ -19566,7 +19878,7 @@

    Runtime Semantics: Evaluation

    1. Let _baseReference_ be ? Evaluation of |CallExpression|. 1. Let _baseValue_ be ? GetValue(_baseReference_). - 1. If _baseValue_ is *undefined* or *null*, then + 1. If _baseValue_ is either *undefined* or *null*, then 1. Return *undefined*. 1. Return ? ChainEvaluation of |OptionalChain| with arguments _baseValue_ and _baseReference_. @@ -19577,7 +19889,7 @@

    Runtime Semantics: Evaluation

    1. Let _baseReference_ be ? Evaluation of |OptionalExpression|. 1. Let _baseValue_ be ? GetValue(_baseReference_). - 1. If _baseValue_ is *undefined* or *null*, then + 1. If _baseValue_ is either *undefined* or *null*, then 1. Return *undefined*. 1. Return ? ChainEvaluation of |OptionalChain| with arguments _baseValue_ and _baseReference_. @@ -19776,13 +20088,6 @@

    It allows hosts to provide property keys and values for the object returned from `import.meta`.
    -

    An implementation of HostGetImportMetaProperties must conform to the following requirements:

    -
      -
    • It must return a List whose values are all Records with two fields, [[Key]] and [[Value]].
    • -
    • Each such Record's [[Key]] field must be a property key, i.e., IsPropertyKey must return *true* when applied to it.
    • -
    • Each such Record's [[Value]] field must be an ECMAScript language value.
    • -
    -

    The default implementation of HostGetImportMetaProperties is to return a new empty List.

    @@ -19800,11 +20105,6 @@

    Most hosts will be able to simply define HostGetImportMetaProperties, and leave HostFinalizeImportMeta with its default behaviour. However, HostFinalizeImportMeta provides an "escape hatch" for hosts which need to directly manipulate the object before it is exposed to ECMAScript code.

    -

    An implementation of HostFinalizeImportMeta must conform to the following requirements:

    -
      -
    • It must return ~unused~.
    • -
    -

    The default implementation of HostFinalizeImportMeta is to return ~unused~.

    @@ -20060,7 +20360,7 @@

    Runtime Semantics: Evaluation

    Unary `-` Operator

    -

    The unary `-` operator converts its operand to Number type and then negates it. Negating *+0*𝔽 produces *-0*𝔽, and negating *-0*𝔽 produces *+0*𝔽.

    +

    The unary `-` operator converts its operand to a numeric value and then negates it. Negating *+0*𝔽 produces *-0*𝔽, and negating *-0*𝔽 produces *+0*𝔽.

    @@ -20308,7 +20608,7 @@

    Runtime Semantics: Evaluation

    1. Let _rref_ be ? Evaluation of |ShiftExpression|. 1. Let _rval_ be ? GetValue(_rref_). 1. Let _r_ be ? IsLessThan(_rval_, _lval_, *false*). - 1. If _r_ is *true* or *undefined*, return *false*. Otherwise, return *true*. + 1. If _r_ is either *true* or *undefined*, return *false*. Otherwise, return *true*.
    RelationalExpression : RelationalExpression `>=` ShiftExpression @@ -20317,7 +20617,7 @@

    Runtime Semantics: Evaluation

    1. Let _rref_ be ? Evaluation of |ShiftExpression|. 1. Let _rval_ be ? GetValue(_rref_). 1. Let _r_ be ? IsLessThan(_lval_, _rval_, *true*). - 1. If _r_ is *true* or *undefined*, return *false*. Otherwise, return *true*. + 1. If _r_ is either *true* or *undefined*, return *false*. Otherwise, return *true*.
    RelationalExpression : RelationalExpression `instanceof` ShiftExpression @@ -20552,10 +20852,11 @@

    Runtime Semantics: Evaluation

    1. Let _lref_ be ? Evaluation of |CoalesceExpressionHead|. 1. Let _lval_ be ? GetValue(_lref_). - 1. If _lval_ is *undefined* or *null*, then + 1. If _lval_ is either *undefined* or *null*, then 1. Let _rref_ be ? Evaluation of |BitwiseORExpression|. 1. Return ? GetValue(_rref_). - 1. Otherwise, return _lval_. + 1. Else, + 1. Return _lval_. @@ -20611,16 +20912,12 @@

    Syntax

    Static Semantics: Early Errors

    AssignmentExpression : LeftHandSideExpression `=` AssignmentExpression -

    If |LeftHandSideExpression| is an |ObjectLiteral| or an |ArrayLiteral|, the following Early Error rules are applied:

    • - |LeftHandSideExpression| must cover an |AssignmentPattern|. + If |LeftHandSideExpression| is either an |ObjectLiteral| or an |ArrayLiteral|, |LeftHandSideExpression| must cover an |AssignmentPattern|.
    • -
    -

    If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, the following Early Error rule is applied:

    -
    • - It is a Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~. + If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, it is a Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~.
    @@ -20755,7 +21052,7 @@

    1. NOTE: At this point, it must be a numeric operation. 1. Let _lnum_ be ? ToNumeric(_lval_). 1. Let _rnum_ be ? ToNumeric(_rval_). - 1. If Type(_lnum_) is different from Type(_rnum_), throw a *TypeError* exception. + 1. If Type(_lnum_) is not Type(_rnum_), throw a *TypeError* exception. 1. If _lnum_ is a BigInt, then 1. If _opText_ is `**`, return ? BigInt::exponentiate(_lnum_, _rnum_). 1. If _opText_ is `/`, return ? BigInt::divide(_lnum_, _rnum_). @@ -20880,20 +21177,16 @@

    Static Semantics: Early Errors

    AssignmentRestProperty : `...` DestructuringAssignmentTarget
    • - It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|. + It is a Syntax Error if |DestructuringAssignmentTarget| is either an |ArrayLiteral| or an |ObjectLiteral|.
    DestructuringAssignmentTarget : LeftHandSideExpression -

    If |LeftHandSideExpression| is an |ObjectLiteral| or an |ArrayLiteral|, the following Early Error rules are applied:

    • - |LeftHandSideExpression| must cover an |AssignmentPattern|. + If |LeftHandSideExpression| is either an |ObjectLiteral| or an |ArrayLiteral|, |LeftHandSideExpression| must cover an |AssignmentPattern|.
    • -
    -

    If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, the following Early Error rule is applied:

    -
    • - It is a Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~. + If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, it is a Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~.
    @@ -20935,19 +21228,19 @@

    ArrayAssignmentPattern : `[` `]` - 1. Let _iteratorRecord_ be ? GetIterator(_value_). + 1. Let _iteratorRecord_ be ? GetIterator(_value_, ~sync~). 1. Return ? IteratorClose(_iteratorRecord_, NormalCompletion(~unused~)). ArrayAssignmentPattern : `[` Elision `]` - 1. Let _iteratorRecord_ be ? GetIterator(_value_). + 1. Let _iteratorRecord_ be ? GetIterator(_value_, ~sync~). 1. Let _result_ be Completion(IteratorDestructuringAssignmentEvaluation of |Elision| with argument _iteratorRecord_). 1. If _iteratorRecord_.[[Done]] is *false*, return ? IteratorClose(_iteratorRecord_, _result_). 1. Return _result_. ArrayAssignmentPattern : `[` Elision? AssignmentRestElement `]` - 1. Let _iteratorRecord_ be ? GetIterator(_value_). + 1. Let _iteratorRecord_ be ? GetIterator(_value_, ~sync~). 1. If |Elision| is present, then 1. Let _status_ be Completion(IteratorDestructuringAssignmentEvaluation of |Elision| with argument _iteratorRecord_). 1. If _status_ is an abrupt completion, then @@ -20959,14 +21252,14 @@

    ArrayAssignmentPattern : `[` AssignmentElementList `]` - 1. Let _iteratorRecord_ be ? GetIterator(_value_). + 1. Let _iteratorRecord_ be ? GetIterator(_value_, ~sync~). 1. Let _result_ be Completion(IteratorDestructuringAssignmentEvaluation of |AssignmentElementList| with argument _iteratorRecord_). 1. If _iteratorRecord_.[[Done]] is *false*, return ? IteratorClose(_iteratorRecord_, _result_). 1. Return _result_. ArrayAssignmentPattern : `[` AssignmentElementList `,` Elision? AssignmentRestElement? `]` - 1. Let _iteratorRecord_ be ? GetIterator(_value_). + 1. Let _iteratorRecord_ be ? GetIterator(_value_, ~sync~). 1. Let _status_ be Completion(IteratorDestructuringAssignmentEvaluation of |AssignmentElementList| with argument _iteratorRecord_). 1. If _status_ is an abrupt completion, then 1. If _iteratorRecord_.[[Done]] is *false*, return ? IteratorClose(_iteratorRecord_, _status_). @@ -21005,7 +21298,7 @@

    1. Let _P_ be StringValue of |IdentifierReference|. 1. Let _lref_ be ? ResolveBinding(_P_). 1. Let _v_ be ? GetV(_value_, _P_). - 1. If |Initializer?| is present and _v_ is *undefined*, then + 1. If |Initializer| is present and _v_ is *undefined*, then 1. If IsAnonymousFunctionDefinition(|Initializer|) is *true*, then 1. Set _v_ to ? NamedEvaluation of |Initializer| with argument _P_. 1. Else, @@ -21090,24 +21383,20 @@

    1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then 1. Let _lref_ be ? Evaluation of |DestructuringAssignmentTarget|. + 1. Let _value_ be *undefined*. 1. If _iteratorRecord_.[[Done]] is *false*, then - 1. Let _next_ be Completion(IteratorStep(_iteratorRecord_)). - 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_next_). - 1. If _next_ is *false*, set _iteratorRecord_.[[Done]] to *true*. - 1. Else, - 1. Let _value_ be Completion(IteratorValue(_next_)). - 1. If _value_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_value_). - 1. If _iteratorRecord_.[[Done]] is *true*, let _value_ be *undefined*. + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is not ~done~, then + 1. Set _value_ to _next_. 1. If |Initializer| is present and _value_ is *undefined*, then 1. If IsAnonymousFunctionDefinition(|Initializer|) is *true* and IsIdentifierRef of |DestructuringAssignmentTarget| is *true*, then 1. Let _v_ be ? NamedEvaluation of |Initializer| with argument _lref_.[[ReferencedName]]. 1. Else, 1. Let _defaultValue_ be ? Evaluation of |Initializer|. 1. Let _v_ be ? GetValue(_defaultValue_). - 1. Else, let _v_ be _value_. - 1. If |DestructuringAssignmentTarget| is an |ObjectLiteral| or an |ArrayLiteral|, then + 1. Else, + 1. Let _v_ be _value_. + 1. If |DestructuringAssignmentTarget| is either an |ObjectLiteral| or an |ArrayLiteral|, then 1. Let _nestedAssignmentPattern_ be the |AssignmentPattern| that is covered by |DestructuringAssignmentTarget|. 1. Return ? DestructuringAssignmentEvaluation of _nestedAssignmentPattern_ with argument _v_. 1. Return ? PutValue(_lref_, _v_). @@ -21122,15 +21411,9 @@

    1. Let _A_ be ! ArrayCreate(0). 1. Let _n_ be 0. 1. Repeat, while _iteratorRecord_.[[Done]] is *false*, - 1. Let _next_ be Completion(IteratorStep(_iteratorRecord_)). - 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_next_). - 1. If _next_ is *false*, set _iteratorRecord_.[[Done]] to *true*. - 1. Else, - 1. Let _nextValue_ be Completion(IteratorValue(_next_)). - 1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_nextValue_). - 1. Perform ! CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_n_)), _nextValue_). + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is not ~done~, then + 1. Perform ! CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_n_)), _next_). 1. Set _n_ to _n_ + 1. 1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then 1. Return ? PutValue(_lref_, _A_). @@ -21159,8 +21442,9 @@

    1. Else, 1. Let _defaultValue_ be ? Evaluation of |Initializer|. 1. Let _rhsValue_ be ? GetValue(_defaultValue_). - 1. Else, let _rhsValue_ be _v_. - 1. If |DestructuringAssignmentTarget| is an |ObjectLiteral| or an |ArrayLiteral|, then + 1. Else, + 1. Let _rhsValue_ be _v_. + 1. If |DestructuringAssignmentTarget| is either an |ObjectLiteral| or an |ArrayLiteral|, then 1. Let _assignmentPattern_ be the |AssignmentPattern| that is covered by |DestructuringAssignmentTarget|. 1. Return ? DestructuringAssignmentEvaluation of _assignmentPattern_ with argument _rhsValue_. 1. Return ? PutValue(_lref_, _rhsValue_). @@ -21359,7 +21643,7 @@

    1. Perform ! _env_.CreateImmutableBinding(_dn_, *true*). 1. Else, 1. [id="step-blockdeclarationinstantiation-createmutablebinding"] Perform ! _env_.CreateMutableBinding(_dn_, *false*). NOTE: This step is replaced in section . - 1. If _d_ is a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then + 1. If _d_ is either a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then 1. Let _fn_ be the sole element of the BoundNames of _d_. 1. Let _fo_ be InstantiateFunctionObject of _d_ with arguments _env_ and _privateEnv_. 1. [id="step-blockdeclarationinstantiation-initializebinding"] Perform ! _env_.InitializeBinding(_fn_, _fo_, ~normal~). NOTE: This step is replaced in section . @@ -21379,7 +21663,7 @@

    Let, Const, and Using Declarations

    Syntax

    LexicalDeclaration[In, Yield, Await] : - LetOrConst BindingList[?In, ?Yield, ?Await] `;` + LetOrConst BindingList[?In, ?Yield, ?Await, +Pattern] `;` UsingDeclaration[?In, ?Yield, ?Await] LetOrConst : @@ -21387,16 +21671,16 @@

    Syntax

    `const` UsingDeclaration[In, Yield, Await] : - `using` [no LineTerminator here] [lookahead != `await`] BindingList[?In, ?Yield, ?Await] `;` - [+Await] `using` [no LineTerminator here] `await` [no LineTerminator here] BindingList[?In, ?Yield, +Await] `;` + `using` [no LineTerminator here] BindingList[?In, ?Yield, ?Await, ~Pattern] `;` + [+Await] `using` [no LineTerminator here] `await` [no LineTerminator here] BindingList[?In, ?Yield, +Await, ~Pattern] `;` - BindingList[In, Yield, Await] : - LexicalBinding[?In, ?Yield, ?Await] - BindingList[?In, ?Yield, ?Await] `,` LexicalBinding[?In, ?Yield, ?Await] + BindingList[In, Yield, Await, Pattern] : + LexicalBinding[?In, ?Yield, ?Await, ?Pattern] + BindingList[?In, ?Yield, ?Await, ?Pattern] `,` LexicalBinding[?In, ?Yield, ?Await, ?Pattern] - LexicalBinding[In, Yield, Await] : + LexicalBinding[In, Yield, Await, Pattern] : BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]? - BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await] + [+Pattern] BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
    @@ -21417,7 +21701,7 @@

    Static Semantics: Early Errors

    • - It is a Syntax Error if the BoundNames of |BindingList| contains *"let"* or *"await"*. + It is a Syntax Error if the BoundNames of |BindingList| contains *"let"*.
    • It is a Syntax Error if the BoundNames of |BindingList| contains any duplicate entries. @@ -21432,12 +21716,6 @@

      Static Semantics: Early Errors

      It is a Syntax Error if |Initializer| is not present and IsConstantDeclaration of the |LexicalDeclaration| containing this |LexicalBinding| is *true*.
    - LexicalBinding : BindingPattern Initializer -
      -
    • - It is a Syntax Error if IsUsingDeclaration of the |LexicalDeclaration| containing this |LexicalBinding| is *true*. -
    • -
    @@ -21824,10 +22102,10 @@

    - 1. If _completion_.[[Type]] is ~normal~, return *true*. - 1. If _completion_.[[Type]] is not ~continue~, return *false*. + 1. If _completion_ is a normal completion, return *true*. + 1. If _completion_ is not a continue completion, return *false*. 1. If _completion_.[[Target]] is ~empty~, return *true*. - 1. If _completion_.[[Target]] is an element of _labelSet_, return *true*. + 1. If _labelSet_ contains _completion_.[[Target]], return *true*. 1. Return *false*. @@ -22095,23 +22373,23 @@

    Syntax

    ForInOfStatement[Yield, Await, Return] : `for` `(` [lookahead != `let` `[`] LeftHandSideExpression[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` `var` ForBinding[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` `var` ForBinding[?Yield, ?Await, +Pattern] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` ForDeclaration[?Yield, ?Await, ~Using] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead ∉ { `let`, `async` `of` }] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` `var` ForBinding[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` `var` ForBinding[?Yield, ?Await, +Pattern] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead != `using` `of`] ForDeclaration[?Yield, ?Await, +Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] [+Await] `for` `await` `(` [lookahead != `let`] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - [+Await] `for` `await` `(` `var` ForBinding[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + [+Await] `for` `await` `(` `var` ForBinding[?Yield, ?Await, +Pattern] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] [+Await] `for` `await` `(` [lookahead != `using` `of`] ForDeclaration[?Yield, ?Await, +Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] ForDeclaration[Yield, Await, Using] : - LetOrConst ForBinding[?Yield, ?Await] - [+Using] `using` [no LineTerminator here] [lookahead != `await`] ForBinding[?Yield, ?Await] - [+Using, +Await] `using` [no LineTerminator here] `await` [no LineTerminator here] ForBinding[?Yield, +Await] + LetOrConst ForBinding[?Yield, ?Await, +Pattern] + [+Using] `using` [no LineTerminator here] [lookahead != `await`] ForBinding[?Yield, ?Await, +Pattern] + [+Using, +Await] `using` [no LineTerminator here] `await` [no LineTerminator here] ForBinding[?Yield, +Await, +Pattern] - ForBinding[Yield, Await] : + ForBinding[Yield, Await, Pattern] : BindingIdentifier[?Yield, ?Await] - BindingPattern[?Yield, ?Await] + [+Pattern] BindingPattern[?Yield, ?Await]

    This section is extended by Annex .

    @@ -22145,16 +22423,12 @@

    Static Semantics: Early Errors

    `for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement `for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement -

    If |LeftHandSideExpression| is either an |ObjectLiteral| or an |ArrayLiteral|, the following Early Error rules are applied:

    • - |LeftHandSideExpression| must cover an |AssignmentPattern|. + If |LeftHandSideExpression| is either an |ObjectLiteral| or an |ArrayLiteral|, |LeftHandSideExpression| must cover an |AssignmentPattern|.
    • -
    -

    If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, the following Early Error rule is applied:

    -
    • - It is a Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~. + If |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral|, it is a Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~.
    @@ -22174,12 +22448,6 @@

    Static Semantics: Early Errors

    It is a Syntax Error if the BoundNames of |ForDeclaration| contains any duplicate entries. - ForBinding : BindingPattern -
      -
    • - It is a Syntax Error if this |ForBinding| is contained within a |ForDeclaration| and IsUsingDeclaration of that |ForDeclaration| is *true*. -
    • -
    @@ -22291,12 +22559,12 @@

    ForInOfStatement : `for` `(` `var` ForBinding `in` Expression `)` Statement 1. Let _keyResult_ be ? ForIn/OfHeadEvaluation(« », |Expression|, ~enumerate~). - 1. Return ? ForIn/OfBodyEvaluation(|ForBinding|, |Statement|, _keyResult_, ~enumerate~, ~varBinding~, _labelSet_). + 1. Return ? ForIn/OfBodyEvaluation(|ForBinding|, |Statement|, _keyResult_, ~enumerate~, ~var-binding~, _labelSet_). ForInOfStatement : `for` `(` ForDeclaration `in` Expression `)` Statement 1. Let _keyResult_ be ? ForIn/OfHeadEvaluation(BoundNames of |ForDeclaration|, |Expression|, ~enumerate~). - 1. Return ? ForIn/OfBodyEvaluation(|ForDeclaration|, |Statement|, _keyResult_, ~enumerate~, ~lexicalBinding~, _labelSet_). + 1. Return ? ForIn/OfBodyEvaluation(|ForDeclaration|, |Statement|, _keyResult_, ~enumerate~, ~lexical-binding~, _labelSet_). ForInOfStatement : `for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement @@ -22306,12 +22574,12 @@

    ForInOfStatement : `for` `(` `var` ForBinding `of` AssignmentExpression `)` Statement 1. Let _keyResult_ be ? ForIn/OfHeadEvaluation(« », |AssignmentExpression|, ~iterate~). - 1. Return ? ForIn/OfBodyEvaluation(|ForBinding|, |Statement|, _keyResult_, ~iterate~, ~varBinding~, _labelSet_). + 1. Return ? ForIn/OfBodyEvaluation(|ForBinding|, |Statement|, _keyResult_, ~iterate~, ~var-binding~, _labelSet_). ForInOfStatement : `for` `(` ForDeclaration `of` AssignmentExpression `)` Statement 1. Let _keyResult_ be ? ForIn/OfHeadEvaluation(BoundNames of |ForDeclaration|, |AssignmentExpression|, ~iterate~). - 1. Return ? ForIn/OfBodyEvaluation(|ForDeclaration|, |Statement|, _keyResult_, ~iterate~, ~lexicalBinding~, _labelSet_). + 1. Return ? ForIn/OfBodyEvaluation(|ForDeclaration|, |Statement|, _keyResult_, ~iterate~, ~lexical-binding~, _labelSet_). ForInOfStatement : `for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement @@ -22325,14 +22593,14 @@

    1. Let _keyResult_ be ? ForIn/OfHeadEvaluation(« », |AssignmentExpression|, ~async-iterate~). - 1. Return ? ForIn/OfBodyEvaluation(|ForBinding|, |Statement|, _keyResult_, ~iterate~, ~varBinding~, _labelSet_, ~async~). + 1. Return ? ForIn/OfBodyEvaluation(|ForBinding|, |Statement|, _keyResult_, ~iterate~, ~var-binding~, _labelSet_, ~async~). ForInOfStatement : `for` `await` `(` ForDeclaration `of` AssignmentExpression `)` Statement 1. Let _keyResult_ be ? ForIn/OfHeadEvaluation(BoundNames of |ForDeclaration|, |AssignmentExpression|, ~async-iterate~). - 1. Return ? ForIn/OfBodyEvaluation(|ForDeclaration|, |Statement|, _keyResult_, ~iterate~, ~lexicalBinding~, _labelSet_, ~async~). + 1. Return ? ForIn/OfBodyEvaluation(|ForDeclaration|, |Statement|, _keyResult_, ~iterate~, ~lexical-binding~, _labelSet_, ~async~).

    This section is extended by Annex .

    @@ -22361,17 +22629,17 @@

    1. Set the running execution context's LexicalEnvironment to _oldEnv_. 1. Let _exprValue_ be ? GetValue(? _exprRef_). 1. If _iterationKind_ is ~enumerate~, then - 1. If _exprValue_ is *undefined* or *null*, then + 1. If _exprValue_ is either *undefined* or *null*, then 1. Return Completion Record { [[Type]]: ~break~, [[Value]]: ~empty~, [[Target]]: ~empty~ }. 1. Let _obj_ be ! ToObject(_exprValue_). 1. Let _iterator_ be EnumerateObjectProperties(_obj_). 1. Let _nextMethod_ be ! GetV(_iterator_, *"next"*). 1. Return the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }. 1. Else, - 1. Assert: _iterationKind_ is ~iterate~ or ~async-iterate~. - 1. If _iterationKind_ is ~async-iterate~, let _iteratorHint_ be ~async~. - 1. Else, let _iteratorHint_ be ~sync~. - 1. Return ? GetIterator(_exprValue_, _iteratorHint_). + 1. Assert: _iterationKind_ is either ~iterate~ or ~async-iterate~. + 1. If _iterationKind_ is ~async-iterate~, let _iteratorKind_ be ~async~. + 1. Else, let _iteratorKind_ be ~sync~. + 1. Return ? GetIterator(_exprValue_, _iteratorKind_). @@ -22382,7 +22650,7 @@

    _stmt_: a |Statement| Parse Node, _iteratorRecord_: an Iterator Record, _iterationKind_: ~enumerate~ or ~iterate~, - _lhsKind_: ~assignment~, ~varBinding~, or ~lexicalBinding~, + _lhsKind_: ~assignment~, ~var-binding~, or ~lexical-binding~, _labelSet_: a List of Strings, optional _iteratorKind_: ~sync~ or ~async~, ): either a normal completion containing an ECMAScript language value or an abrupt completion @@ -22400,7 +22668,7 @@

    1. Else, 1. Let _hint_ be ~normal~. 1. Let _destructuring_ be IsDestructuring of _lhs_. - 1. If _destructuring_ is *true* and if _lhsKind_ is ~assignment~, then + 1. If _destructuring_ is *true* and _lhsKind_ is ~assignment~, then 1. Assert: _lhs_ is a |LeftHandSideExpression|. 1. Let _assignmentPattern_ be the |AssignmentPattern| that is covered by _lhs_. 1. Repeat, @@ -22410,12 +22678,12 @@

    1. Let _done_ be ? IteratorComplete(_nextResult_). 1. If _done_ is *true*, return _V_. 1. Let _nextValue_ be ? IteratorValue(_nextResult_). - 1. If _lhsKind_ is either ~assignment~ or ~varBinding~, then + 1. If _lhsKind_ is either ~assignment~ or ~var-binding~, then 1. If _destructuring_ is *true*, then 1. If _lhsKind_ is ~assignment~, then 1. Let _status_ be Completion(DestructuringAssignmentEvaluation of _assignmentPattern_ with argument _nextValue_). 1. Else, - 1. Assert: _lhsKind_ is ~varBinding~. + 1. Assert: _lhsKind_ is ~var-binding~. 1. Assert: _lhs_ is a |ForBinding|. 1. Let _status_ be Completion(BindingInitialization of _lhs_ with arguments _nextValue_ and *undefined*). 1. Else, @@ -22426,7 +22694,7 @@

    1. Let _status_ be Completion(PutValue(_lhsRef_.[[Value]], _nextValue_)). 1. Let _iterationEnv_ be *undefined*. 1. Else, - 1. Assert: _lhsKind_ is ~lexicalBinding~. + 1. Assert: _lhsKind_ is ~lexical-binding~. 1. Assert: _lhs_ is a |ForDeclaration|. 1. Let _iterationEnv_ be NewDeclarativeEnvironment(_oldEnv_). 1. Perform ForDeclarationBindingInstantiation of _lhs_ with argument _iterationEnv_. @@ -22492,7 +22760,7 @@

    The iterator's `throw` and `return` methods are *null* and are never invoked. The iterator's `next` method processes object properties to determine whether the property key should be returned as an iterator value. Returned property keys do not include keys that are Symbols. Properties of the target object may be deleted during enumeration. A property that is deleted before it is processed by the iterator's `next` method is ignored. If new properties are added to the target object during enumeration, the newly added properties are not guaranteed to be processed in the active enumeration. A property name will be returned by the iterator's `next` method at most once in any enumeration.

    Enumerating the properties of the target object includes enumerating properties of its prototype, and the prototype of the prototype, and so on, recursively; but a property of a prototype is not processed if it has the same name as a property that has already been processed by the iterator's `next` method. The values of [[Enumerable]] attributes are not considered when determining if a property of a prototype object has already been processed. The enumerable property names of prototype objects must be obtained by invoking EnumerateObjectProperties passing the prototype object as the argument. EnumerateObjectProperties must obtain the own property keys of the target object by calling its [[OwnPropertyKeys]] internal method. Property attributes of the target object must be obtained by calling its [[GetOwnProperty]] internal method.

    -

    In addition, if neither _O_ nor any object in its prototype chain is a Proxy exotic object, Integer-Indexed exotic object, module namespace exotic object, or implementation provided exotic object, then the iterator must behave as would the iterator given by CreateForInIterator(_O_) until one of the following occurs:

    +

    In addition, if neither _O_ nor any object in its prototype chain is a Proxy exotic object, TypedArray, module namespace exotic object, or implementation provided exotic object, then the iterator must behave as would the iterator given by CreateForInIterator(_O_) until one of the following occurs:

    • the value of the [[Prototype]] internal slot of _O_ or an object in its prototype chain changes,
    • a property is removed from _O_ or an object in its prototype chain,
    • @@ -22569,22 +22837,20 @@

      %ForInIteratorPrototype%.next ( )

      1. Assert: _O_ is an Object. 1. Assert: _O_ has all of the internal slots of a For-In Iterator Instance (). 1. Let _object_ be _O_.[[Object]]. - 1. Let _visited_ be _O_.[[VisitedKeys]]. - 1. Let _remaining_ be _O_.[[RemainingKeys]]. 1. Repeat, 1. If _O_.[[ObjectWasVisited]] is *false*, then 1. Let _keys_ be ? _object_.[[OwnPropertyKeys]](). 1. For each element _key_ of _keys_, do 1. If _key_ is a String, then - 1. Append _key_ to _remaining_. + 1. Append _key_ to _O_.[[RemainingKeys]]. 1. Set _O_.[[ObjectWasVisited]] to *true*. - 1. Repeat, while _remaining_ is not empty, - 1. Let _r_ be the first element of _remaining_. - 1. Remove the first element from _remaining_. - 1. If there does not exist an element _v_ of _visited_ such that SameValue(_r_, _v_) is *true*, then + 1. Repeat, while _O_.[[RemainingKeys]] is not empty, + 1. Let _r_ be the first element of _O_.[[RemainingKeys]]. + 1. Remove the first element from _O_.[[RemainingKeys]]. + 1. If _O_.[[VisitedKeys]] does not contain _r_, then 1. Let _desc_ be ? _object_.[[GetOwnProperty]](_r_). 1. If _desc_ is not *undefined*, then - 1. Append _r_ to _visited_. + 1. Append _r_ to _O_.[[VisitedKeys]]. 1. If _desc_.[[Enumerable]] is *true*, return CreateIterResultObject(_r_, *false*). 1. Set _object_ to ? _object_.[[GetPrototypeOf]](). 1. Set _O_.[[Object]] to _object_. @@ -22899,9 +23165,9 @@

      1. If _R_.[[Value]] is not ~empty~, set _V_ to _R_.[[Value]]. 1. If _R_ is an abrupt completion, return ? UpdateEmpty(_R_, _V_). 1. If _foundInB_ is *true*, return _V_. - 1. Let _R_ be Completion(Evaluation of |DefaultClause|). - 1. If _R_.[[Value]] is not ~empty~, set _V_ to _R_.[[Value]]. - 1. If _R_ is an abrupt completion, return ? UpdateEmpty(_R_, _V_). + 1. Let _defaultR_ be Completion(Evaluation of |DefaultClause|). + 1. If _defaultR_.[[Value]] is not ~empty~, set _V_ to _defaultR_.[[Value]]. + 1. If _defaultR_ is an abrupt completion, return ? UpdateEmpty(_defaultR_, _V_). 1. NOTE: The following is another complete iteration of the second |CaseClauses|. 1. For each |CaseClause| _C_ of _B_, do 1. Let _R_ be Completion(Evaluation of |CaseClause| _C_). @@ -23035,7 +23301,7 @@

      BreakableStatement : IterationStatement 1. Let _stmtResult_ be Completion(LoopEvaluation of |IterationStatement| with argument _labelSet_). - 1. If _stmtResult_.[[Type]] is ~break~, then + 1. If _stmtResult_ is a break completion, then 1. If _stmtResult_.[[Target]] is ~empty~, then 1. If _stmtResult_.[[Value]] is ~empty~, set _stmtResult_ to NormalCompletion(*undefined*). 1. Else, set _stmtResult_ to NormalCompletion(_stmtResult_.[[Value]]). @@ -23044,7 +23310,7 @@

      BreakableStatement : SwitchStatement 1. Let _stmtResult_ be Completion(Evaluation of |SwitchStatement|). - 1. If _stmtResult_.[[Type]] is ~break~, then + 1. If _stmtResult_ is a break completion, then 1. If _stmtResult_.[[Target]] is ~empty~, then 1. If _stmtResult_.[[Value]] is ~empty~, set _stmtResult_ to NormalCompletion(*undefined*). 1. Else, set _stmtResult_ to NormalCompletion(_stmtResult_.[[Value]]). @@ -23058,7 +23324,7 @@

      1. Let _label_ be the StringValue of |LabelIdentifier|. 1. Let _newLabelSet_ be the list-concatenation of _labelSet_ and « _label_ ». 1. Let _stmtResult_ be Completion(LabelledEvaluation of |LabelledItem| with argument _newLabelSet_). - 1. If _stmtResult_.[[Type]] is ~break~ and SameValue(_stmtResult_.[[Target]], _label_) is *true*, then + 1. If _stmtResult_ is a break completion and _stmtResult_.[[Target]] is _label_, then 1. Set _stmtResult_ to NormalCompletion(_stmtResult_.[[Value]]). 1. Return ? _stmtResult_. @@ -23189,7 +23455,7 @@

      Runtime Semantics: Evaluation

      TryStatement : `try` Block Catch 1. Let _B_ be Completion(Evaluation of |Block|). - 1. If _B_.[[Type]] is ~throw~, let _C_ be Completion(CatchClauseEvaluation of |Catch| with argument _B_.[[Value]]). + 1. If _B_ is a throw completion, let _C_ be Completion(CatchClauseEvaluation of |Catch| with argument _B_.[[Value]]). 1. Else, let _C_ be _B_. 1. Return ? UpdateEmpty(_C_, *undefined*). @@ -23197,16 +23463,16 @@

      Runtime Semantics: Evaluation

      1. Let _B_ be Completion(Evaluation of |Block|). 1. Let _F_ be Completion(Evaluation of |Finally|). - 1. If _F_.[[Type]] is ~normal~, set _F_ to _B_. + 1. If _F_ is a normal completion, set _F_ to _B_. 1. Return ? UpdateEmpty(_F_, *undefined*). TryStatement : `try` Block Catch Finally 1. Let _B_ be Completion(Evaluation of |Block|). - 1. If _B_.[[Type]] is ~throw~, let _C_ be Completion(CatchClauseEvaluation of |Catch| with argument _B_.[[Value]]). + 1. If _B_ is a throw completion, let _C_ be Completion(CatchClauseEvaluation of |Catch| with argument _B_.[[Value]]). 1. Else, let _C_ be _B_. 1. Let _F_ be Completion(Evaluation of |Finally|). - 1. If _F_.[[Type]] is ~normal~, set _F_ to _C_. + 1. If _F_ is a normal completion, set _F_ to _C_. 1. Return ? UpdateEmpty(_F_, *undefined*). @@ -23572,7 +23838,7 @@

      Static Semantics: Early Errors

      If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
    • - If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is *"eval"* or *"arguments"*. + If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
    • It is a Syntax Error if FunctionBodyContainsUseStrict of |FunctionBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*. @@ -23629,7 +23895,7 @@

      Static Semantics: FunctionBodyContainsUseStrict ( ): a Boolean

      Runtime Semantics: EvaluateFunctionBody ( - _functionObject_: a function object, + _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, ): either a normal completion containing an ECMAScript language value or an abrupt completion

      @@ -23649,7 +23915,7 @@

      Runtime Semantics: InstantiateOrdinaryFunctionObject ( _env_: an Environment Record, _privateEnv_: a PrivateEnvironment Record or *null*, - ): a function object + ): an ECMAScript function object

      @@ -23679,7 +23945,7 @@

      Runtime Semantics: InstantiateOrdinaryFunctionExpression ( optional _name_: a property key or a Private Name, - ): a function object + ): an ECMAScript function object

      @@ -23814,7 +24080,7 @@

      Static Semantics: ConciseBodyContainsUseStrict ( ): a Boolean

      Runtime Semantics: EvaluateConciseBody ( - _functionObject_: a function object, + _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, ): either a normal completion containing an ECMAScript language value or an abrupt completion

      @@ -23831,7 +24097,7 @@

      Runtime Semantics: InstantiateArrowFunctionExpression ( optional _name_: a property key or a Private Name, - ): a function object + ): an ECMAScript function object

      @@ -23969,7 +24235,7 @@

      Runtime Semantics: DefineMethod ( _object_: an Object, optional _functionPrototype_: an Object, - ): either a normal completion containing a Record with fields [[Key]] (a property key) and [[Closure]] (a function object) or an abrupt completion + ): either a normal completion containing a Record with fields [[Key]] (a property key) and [[Closure]] (an ECMAScript function object) or an abrupt completion

      @@ -24002,7 +24268,7 @@

      1. Let _methodDef_ be ? DefineMethod of |MethodDefinition| with argument _object_. 1. Perform SetFunctionName(_methodDef_.[[Closure]], _methodDef_.[[Key]]). - 1. Return DefineMethodProperty(_object_, _methodDef_.[[Key]], _methodDef_.[[Closure]], _enumerable_). + 1. Return ? DefineMethodProperty(_object_, _methodDef_.[[Key]], _methodDef_.[[Closure]], _enumerable_). MethodDefinition : `get` ClassElementName `(` `)` `{` FunctionBody `}` @@ -24048,7 +24314,7 @@

      1. Perform SetFunctionName(_closure_, _propKey_). 1. Let _prototype_ be OrdinaryObjectCreate(%GeneratorFunction.prototype.prototype%). 1. Perform ! DefinePropertyOrThrow(_closure_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Return DefineMethodProperty(_object_, _propKey_, _closure_, _enumerable_). + 1. Return ? DefineMethodProperty(_object_, _propKey_, _closure_, _enumerable_). AsyncGeneratorMethod : `async` `*` ClassElementName `(` UniqueFormalParameters `)` `{` AsyncGeneratorBody `}` @@ -24063,7 +24329,7 @@

      1. Perform SetFunctionName(_closure_, _propKey_). 1. Let _prototype_ be OrdinaryObjectCreate(%AsyncGeneratorFunction.prototype.prototype%). 1. Perform ! DefinePropertyOrThrow(_closure_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Return DefineMethodProperty(_object_, _propKey_, _closure_, _enumerable_). + 1. Return ? DefineMethodProperty(_object_, _propKey_, _closure_, _enumerable_). AsyncMethod : `async` ClassElementName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}` @@ -24076,7 +24342,7 @@

      1. Let _closure_ be OrdinaryFunctionCreate(%AsyncFunction.prototype%, _sourceText_, |UniqueFormalParameters|, |AsyncFunctionBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform MakeMethod(_closure_, _object_). 1. Perform SetFunctionName(_closure_, _propKey_). - 1. Return DefineMethodProperty(_object_, _propKey_, _closure_, _enumerable_). + 1. Return ? DefineMethodProperty(_object_, _propKey_, _closure_, _enumerable_). @@ -24143,7 +24409,7 @@

      Static Semantics: Early Errors

      If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.

    • - If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is *"eval"* or *"arguments"*. + If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
    • It is a Syntax Error if FunctionBodyContainsUseStrict of |GeneratorBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*. @@ -24172,7 +24438,7 @@

      Static Semantics: Early Errors

      Runtime Semantics: EvaluateGeneratorBody ( - _functionObject_: a function object, + _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, ): a throw completion or a return completion

      @@ -24193,7 +24459,7 @@

      Runtime Semantics: InstantiateGeneratorFunctionObject ( _env_: an Environment Record, _privateEnv_: a PrivateEnvironment Record or *null*, - ): a function object + ): an ECMAScript function object

      @@ -24225,7 +24491,7 @@

      Runtime Semantics: InstantiateGeneratorFunctionExpression ( optional _name_: a property key or a Private Name, - ): a function object + ): an ECMAScript function object

      @@ -24289,7 +24555,7 @@

      Runtime Semantics: Evaluation

      1. Let _iterator_ be _iteratorRecord_.[[Iterator]]. 1. Let _received_ be NormalCompletion(*undefined*). 1. Repeat, - 1. If _received_.[[Type]] is ~normal~, then + 1. If _received_ is a normal completion, then 1. Let _innerResult_ be ? Call(_iteratorRecord_.[[NextMethod]], _iteratorRecord_.[[Iterator]], « _received_.[[Value]] »). 1. If _generatorKind_ is ~async~, set _innerResult_ to ? Await(_innerResult_). 1. If _innerResult_ is not an Object, throw a *TypeError* exception. @@ -24298,7 +24564,7 @@

      Runtime Semantics: Evaluation

      1. Return ? IteratorValue(_innerResult_). 1. If _generatorKind_ is ~async~, set _received_ to Completion(AsyncGeneratorYield(? IteratorValue(_innerResult_))). 1. Else, set _received_ to Completion(GeneratorYield(_innerResult_)). - 1. Else if _received_.[[Type]] is ~throw~, then + 1. Else if _received_ is a throw completion, then 1. Let _throw_ be ? GetMethod(_iterator_, *"throw"*). 1. If _throw_ is not *undefined*, then 1. Let _innerResult_ be ? Call(_throw_, _iterator_, « _received_.[[Value]] »). @@ -24318,10 +24584,10 @@

      Runtime Semantics: Evaluation

      1. NOTE: The next step throws a *TypeError* to indicate that there was a `yield*` protocol violation: _iterator_ does not have a `throw` method. 1. Throw a *TypeError* exception. 1. Else, - 1. Assert: _received_.[[Type]] is ~return~. + 1. Assert: _received_ is a return completion. 1. Let _return_ be ? GetMethod(_iterator_, *"return"*). 1. If _return_ is *undefined*, then - 1. Let _value_ be _received_.[[Value]]. + 1. Set _value_ to _received_.[[Value]]. 1. If _generatorKind_ is ~async~, then 1. Set _value_ to ? Await(_value_). 1. Return Completion Record { [[Type]]: ~return~, [[Value]]: _value_, [[Target]]: ~empty~ }. @@ -24330,7 +24596,7 @@

      Runtime Semantics: Evaluation

      1. If _innerReturnResult_ is not an Object, throw a *TypeError* exception. 1. Let _done_ be ? IteratorComplete(_innerReturnResult_). 1. If _done_ is *true*, then - 1. Let _value_ be ? IteratorValue(_innerReturnResult_). + 1. Set _value_ to ? IteratorValue(_innerReturnResult_). 1. Return Completion Record { [[Type]]: ~return~, [[Value]]: _value_, [[Target]]: ~empty~ }. 1. If _generatorKind_ is ~async~, set _received_ to Completion(AsyncGeneratorYield(? IteratorValue(_innerReturnResult_))). 1. Else, set _received_ to Completion(GeneratorYield(_innerReturnResult_)). @@ -24382,7 +24648,7 @@

      Static Semantics: Early Errors

      • If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
      • -
      • If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is *"eval"* or *"arguments"*.
      • +
      • If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
      • It is a Syntax Error if FunctionBodyContainsUseStrict of |AsyncGeneratorBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*.
      • It is a Syntax Error if any element of the BoundNames of |FormalParameters| also occurs in the LexicallyDeclaredNames of |AsyncGeneratorBody|.
      • It is a Syntax Error if |FormalParameters| Contains |YieldExpression| is *true*.
      • @@ -24397,7 +24663,7 @@

        Static Semantics: Early Errors

        Runtime Semantics: EvaluateAsyncGeneratorBody ( - _functionObject_: a function object, + _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, ): a throw completion or a return completion

        @@ -24420,7 +24686,7 @@

        Runtime Semantics: InstantiateAsyncGeneratorFunctionObject ( _env_: an Environment Record, _privateEnv_: a PrivateEnvironment Record or *null*, - ): a function object + ): an ECMAScript function object

        @@ -24456,7 +24722,7 @@

        Runtime Semantics: InstantiateAsyncGeneratorFunctionExpression ( optional _name_: a property key or a Private Name, - ): a function object + ): an ECMAScript function object

        @@ -24609,7 +24875,7 @@

        Static Semantics: Early Errors

        ClassElement : `static` FieldDefinition `;`
        • - It is a Syntax Error if PropName of |FieldDefinition| is *"prototype"* or *"constructor"*. + It is a Syntax Error if PropName of |FieldDefinition| is either *"prototype"* or *"constructor"*.
        @@ -24657,13 +24923,13 @@

        Static Semantics: Early Errors

        -

        Static Semantics: ClassElementKind ( ): ~ConstructorMethod~, ~NonConstructorMethod~, or ~empty~

        +

        Static Semantics: ClassElementKind ( ): ~constructor-method~, ~non-constructor-method~, or ~empty~

        ClassElement : MethodDefinition - 1. If PropName of |MethodDefinition| is *"constructor"*, return ~ConstructorMethod~. - 1. Return ~NonConstructorMethod~. + 1. If PropName of |MethodDefinition| is *"constructor"*, return ~constructor-method~. + 1. Return ~non-constructor-method~. ClassElement : @@ -24672,11 +24938,11 @@

        Static Semantics: ClassElementKind ( ): ~ConstructorMethod~, ~NonConstructor `static` FieldDefinition `;` - 1. Return ~NonConstructorMethod~. + 1. Return ~non-constructor-method~. ClassElement : ClassStaticBlock - 1. Return ~NonConstructorMethod~. + 1. Return ~non-constructor-method~. ClassElement : `;` @@ -24690,14 +24956,14 @@

        Static Semantics: ConstructorMethod ( ): a |ClassElement| Parse Node or ~emp ClassElementList : ClassElement - 1. If ClassElementKind of |ClassElement| is ~ConstructorMethod~, return |ClassElement|. + 1. If ClassElementKind of |ClassElement| is ~constructor-method~, return |ClassElement|. 1. Return ~empty~. ClassElementList : ClassElementList ClassElement 1. Let _head_ be ConstructorMethod of |ClassElementList|. 1. If _head_ is not ~empty~, return _head_. - 1. If ClassElementKind of |ClassElement| is ~ConstructorMethod~, return |ClassElement|. + 1. If ClassElementKind of |ClassElement| is ~constructor-method~, return |ClassElement|. 1. Return ~empty~. @@ -24741,14 +25007,14 @@

        Static Semantics: NonConstructorElements ( ): a List of |ClassElement| Parse ClassElementList : ClassElement - 1. If ClassElementKind of |ClassElement| is ~NonConstructorMethod~, then + 1. If ClassElementKind of |ClassElement| is ~non-constructor-method~, then 1. Return « |ClassElement| ». 1. Return a new empty List. ClassElementList : ClassElementList ClassElement 1. Let _list_ be NonConstructorElements of |ClassElementList|. - 1. If ClassElementKind of |ClassElement| is ~NonConstructorMethod~, then + 1. If ClassElementKind of |ClassElement| is ~non-constructor-method~, then 1. Append |ClassElement| to the end of _list_. 1. Return _list_. @@ -24978,7 +25244,7 @@

        1. Let _name_ be ? Evaluation of |ClassElementName|. - 1. If |Initializer?| is present, then + 1. If |Initializer| is present, then 1. Let _formalParameterList_ be an instance of the production FormalParameters : [empty]. 1. Let _env_ be the LexicalEnvironment of the running execution context. 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. @@ -25009,7 +25275,7 @@

        1. Let _privateEnv_ be the running execution context's PrivateEnvironment. 1. Let _sourceText_ be the empty sequence of Unicode code points. 1. Let _formalParameters_ be an instance of the production FormalParameters : [empty]. - 1. Let _bodyFunction_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameters_, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateEnv_). + 1. [id="step-synthetic-class-static-block-fn"] Let _bodyFunction_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameters_, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateEnv_). 1. Perform MakeMethod(_bodyFunction_, _homeObject_). 1. Return the ClassStaticBlockDefinition Record { [[BodyFunction]]: _bodyFunction_ }. @@ -25019,14 +25285,15 @@

        Runtime Semantics: EvaluateClassStaticBlockBody ( - _functionObject_: a function object, + _functionObject_: an ECMAScript function object, ): either a normal completion containing an ECMAScript language value or an abrupt completion

        ClassStaticBlockBody : ClassStaticBlockStatementList - 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, « »). + 1. Assert: _functionObject_ is a synthetic function created by ClassStaticBlockDefinitionEvaluation step . + 1. Perform ! FunctionDeclarationInstantiation(_functionObject_, « »). 1. Let _result_ be Completion(Evaluation of |ClassStaticBlockStatementList|). 1. Let _env_ be the running execution context's LexicalEnvironment. 1. Return ? DisposeResources(_env_.[[DisposeCapability]], _result_). @@ -25095,14 +25362,14 @@

        1. Perform ! _classEnv_.CreateImmutableBinding(_classBinding_, *true*). 1. Let _outerPrivateEnvironment_ be the running execution context's PrivateEnvironment. 1. Let _classPrivateEnvironment_ be NewPrivateEnvironment(_outerPrivateEnvironment_). - 1. If |ClassBody?| is present, then - 1. For each String _dn_ of the PrivateBoundIdentifiers of |ClassBody?|, do - 1. If _classPrivateEnvironment_.[[Names]] contains a Private Name whose [[Description]] is _dn_, then + 1. If |ClassBody| is present, then + 1. For each String _dn_ of the PrivateBoundIdentifiers of |ClassBody|, do + 1. If _classPrivateEnvironment_.[[Names]] contains a Private Name _pn_ such that _pn_.[[Description]] is _dn_, then 1. Assert: This is only possible for getter/setter pairs. 1. Else, - 1. Let _name_ be a new Private Name whose [[Description]] value is _dn_. + 1. Let _name_ be a new Private Name whose [[Description]] is _dn_. 1. Append _name_ to _classPrivateEnvironment_.[[Names]]. - 1. If |ClassHeritage?| is not present, then + 1. If |ClassHeritage| is not present, then 1. Let _protoParent_ be %Object.prototype%. 1. Let _constructorParent_ be %Function.prototype%. 1. Else, @@ -25114,13 +25381,14 @@

        1. If _superclass_ is *null*, then 1. Let _protoParent_ be *null*. 1. Let _constructorParent_ be %Function.prototype%. - 1. Else if IsConstructor(_superclass_) is *false*, throw a *TypeError* exception. + 1. Else if IsConstructor(_superclass_) is *false*, then + 1. Throw a *TypeError* exception. 1. Else, 1. Let _protoParent_ be ? Get(_superclass_, *"prototype"*). 1. If _protoParent_ is not an Object and _protoParent_ is not *null*, throw a *TypeError* exception. 1. Let _constructorParent_ be _superclass_. 1. Let _proto_ be OrdinaryObjectCreate(_protoParent_). - 1. If |ClassBody?| is not present, let _constructor_ be ~empty~. + 1. If |ClassBody| is not present, let _constructor_ be ~empty~. 1. Else, let _constructor_ be ConstructorMethod of |ClassBody|. 1. Set the running execution context's LexicalEnvironment to _classEnv_. 1. Set the running execution context's PrivateEnvironment to _classPrivateEnvironment_. @@ -25146,9 +25414,9 @@

        1. Perform MakeClassConstructor(_F_). 1. Perform SetFunctionName(_F_, _className_). 1. Perform MakeConstructor(_F_, *false*, _proto_). - 1. If |ClassHeritage?| is present, set _F_.[[ConstructorKind]] to ~derived~. - 1. Perform CreateMethodProperty(_proto_, *"constructor"*, _F_). - 1. If |ClassBody?| is not present, let _elements_ be a new empty List. + 1. If |ClassHeritage| is present, set _F_.[[ConstructorKind]] to ~derived~. + 1. Perform ! DefineMethodProperty(_proto_, *"constructor"*, _F_, *false*). + 1. If |ClassBody| is not present, let _elements_ be a new empty List. 1. Else, let _elements_ be NonConstructorElements of |ClassBody|. 1. Let _instancePrivateMethods_ be a new empty List. 1. Let _staticPrivateMethods_ be a new empty List. @@ -25163,19 +25431,18 @@

        1. Set the running execution context's LexicalEnvironment to _env_. 1. Set the running execution context's PrivateEnvironment to _outerPrivateEnvironment_. 1. Return ? _element_. - 1. Set _element_ to _element_.[[Value]]. + 1. Set _element_ to ! _element_. 1. If _element_ is a PrivateElement, then 1. Assert: _element_.[[Kind]] is either ~method~ or ~accessor~. 1. If IsStatic of _e_ is *false*, let _container_ be _instancePrivateMethods_. 1. Else, let _container_ be _staticPrivateMethods_. - 1. If _container_ contains a PrivateElement whose [[Key]] is _element_.[[Key]], then - 1. Let _existing_ be that PrivateElement. - 1. Assert: _element_.[[Kind]] and _existing_.[[Kind]] are both ~accessor~. + 1. If _container_ contains a PrivateElement _pe_ such that _pe_.[[Key]] is _element_.[[Key]], then + 1. Assert: _element_.[[Kind]] and _pe_.[[Kind]] are both ~accessor~. 1. If _element_.[[Get]] is *undefined*, then - 1. Let _combined_ be PrivateElement { [[Key]]: _element_.[[Key]], [[Kind]]: ~accessor~, [[Get]]: _existing_.[[Get]], [[Set]]: _element_.[[Set]] }. + 1. Let _combined_ be PrivateElement { [[Key]]: _element_.[[Key]], [[Kind]]: ~accessor~, [[Get]]: _pe_.[[Get]], [[Set]]: _element_.[[Set]] }. 1. Else, - 1. Let _combined_ be PrivateElement { [[Key]]: _element_.[[Key]], [[Kind]]: ~accessor~, [[Get]]: _element_.[[Get]], [[Set]]: _existing_.[[Set]] }. - 1. Replace _existing_ in _container_ with _combined_. + 1. Let _combined_ be PrivateElement { [[Key]]: _element_.[[Key]], [[Kind]]: ~accessor~, [[Get]]: _element_.[[Get]], [[Set]]: _pe_.[[Set]] }. + 1. Replace _pe_ in _container_ with _combined_. 1. Else, 1. Append _element_ to _container_. 1. Else if _element_ is a ClassFieldDefinition Record, then @@ -25329,7 +25596,7 @@

        Static Semantics: Early Errors

      • It is a Syntax Error if FunctionBodyContainsUseStrict of |AsyncFunctionBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*.
      • It is a Syntax Error if |FormalParameters| Contains |AwaitExpression| is *true*.
      • If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
      • -
      • If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is *"eval"* or *"arguments"*.
      • +
      • If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
      • It is a Syntax Error if any element of the BoundNames of |FormalParameters| also occurs in the LexicallyDeclaredNames of |AsyncFunctionBody|.
      • It is a Syntax Error if |FormalParameters| Contains |SuperProperty| is *true*.
      • It is a Syntax Error if |AsyncFunctionBody| Contains |SuperProperty| is *true*.
      • @@ -25343,7 +25610,7 @@

        Runtime Semantics: InstantiateAsyncFunctionObject ( _env_: an Environment Record, _privateEnv_: a PrivateEnvironment Record or *null*, - ): a function object + ): an ECMAScript function object

        @@ -25372,7 +25639,7 @@

        Runtime Semantics: InstantiateAsyncFunctionExpression ( optional _name_: a property key or a Private Name, - ): a function object + ): an ECMAScript function object

        @@ -25412,7 +25679,7 @@

        Runtime Semantics: EvaluateAsyncFunctionBody ( - _functionObject_: a function object, + _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, ): a return completion

        @@ -25519,7 +25786,7 @@

        Static Semantics: AsyncConciseBodyContainsUseStrict ( ): a Boolean

        Runtime Semantics: EvaluateAsyncConciseBody ( - _functionObject_: a function object, + _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, ): a return completion

        @@ -25543,7 +25810,7 @@

        Runtime Semantics: InstantiateAsyncArrowFunctionExpression ( optional _name_: a property key or a Private Name, - ): a function object + ): an ECMAScript function object

        @@ -25602,7 +25869,7 @@

        1. If the source text matched by _call_ is non-strict code, return *false*. - 1. If _call_ is not contained within a |FunctionBody|, |ConciseBody|, or |AsyncConciseBody|, return *false*. + 1. If _call_ is not contained within a |FunctionBody|, a |ConciseBody|, or an |AsyncConciseBody|, return *false*. 1. Let _body_ be the |FunctionBody|, |ConciseBody|, or |AsyncConciseBody| that most closely contains _call_. 1. If _body_ is the |FunctionBody| of a |GeneratorBody|, return *false*. 1. If _body_ is the |FunctionBody| of an |AsyncFunctionBody|, return *false*. @@ -25727,13 +25994,13 @@

        1. Let _has_ be *false*. 1. If the first |CaseClauses| is present, then - 1. Let _has_ be HasCallInTailPosition of the first |CaseClauses| with argument _call_. + 1. Set _has_ to HasCallInTailPosition of the first |CaseClauses| with argument _call_. 1. If _has_ is *true*, return *true*. 1. If HasUnterminatedUsingDeclaration of the first |CaseClauses| is *true*, return *false*. 1. Let _has_ be HasCallInTailPosition of |DefaultClause| with argument _call_. 1. If _has_ is *true*, return *true*. 1. If HasUnterminatedUsingDeclaration of |DefaultClause| is *true*, return *false*. - 1. If the second |CaseClauses| is present, let _has_ be HasCallInTailPosition of the second |CaseClauses| with argument _call_. + 1. If the second |CaseClauses| is present, set _has_ to HasCallInTailPosition of the second |CaseClauses| with argument _call_. 1. Return _has_. CaseClauses : CaseClauses CaseClause @@ -25837,6 +26104,7 @@

        CallExpression : SuperCall + ImportCall CallExpression `[` Expression `]` CallExpression `.` IdentifierName CallExpression `.` PrivateIdentifier @@ -26206,9 +26474,9 @@

        1. Push _scriptContext_ onto the execution context stack; _scriptContext_ is now the running execution context. 1. Let _script_ be _scriptRecord_.[[ECMAScriptCode]]. 1. Let _result_ be Completion(GlobalDeclarationInstantiation(_script_, _globalEnv_)). - 1. If _result_.[[Type]] is ~normal~, then + 1. If _result_ is a normal completion, then 1. Set _result_ to Completion(Evaluation of _script_). - 1. If _result_.[[Type]] is ~normal~ and _result_.[[Value]] is ~empty~, then + 1. If _result_ is a normal completion and _result_.[[Value]] is ~empty~, then 1. Set _result_ to NormalCompletion(*undefined*). 1. Suspend _scriptContext_ and remove it from the execution context stack. 1. Assert: The execution context stack is not empty. @@ -26251,23 +26519,23 @@

        1. Let _functionsToInitialize_ be a new empty List. 1. Let _declaredFunctionNames_ be a new empty List. 1. For each element _d_ of _varDeclarations_, in reverse List order, do - 1. If _d_ is neither a |VariableDeclaration| nor a |ForBinding| nor a |BindingIdentifier|, then + 1. If _d_ is not either a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then 1. Assert: _d_ is either a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|. 1. NOTE: If there are multiple function declarations for the same name, the last declaration is used. 1. Let _fn_ be the sole element of the BoundNames of _d_. - 1. If _fn_ is not an element of _declaredFunctionNames_, then + 1. If _declaredFunctionNames_ does not contain _fn_, then 1. Let _fnDefinable_ be ? _env_.CanDeclareGlobalFunction(_fn_). 1. If _fnDefinable_ is *false*, throw a *TypeError* exception. 1. Append _fn_ to _declaredFunctionNames_. 1. Insert _d_ as the first element of _functionsToInitialize_. 1. Let _declaredVarNames_ be a new empty List. 1. For each element _d_ of _varDeclarations_, do - 1. If _d_ is a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then + 1. If _d_ is either a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then 1. For each String _vn_ of the BoundNames of _d_, do - 1. If _vn_ is not an element of _declaredFunctionNames_, then + 1. If _declaredFunctionNames_ does not contain _vn_, then 1. Let _vnDefinable_ be ? _env_.CanDeclareGlobalVar(_vn_). 1. If _vnDefinable_ is *false*, throw a *TypeError* exception. - 1. If _vn_ is not an element of _declaredVarNames_, then + 1. If _declaredVarNames_ does not contain _vn_, then 1. Append _vn_ to _declaredVarNames_. 1. NOTE: No abnormal terminations occur after this algorithm step if the global object is an ordinary object. However, if the global object is a Proxy exotic object it may exhibit behaviours that cause abnormal terminations in some of the following steps. 1. [id="step-globaldeclarationinstantiation-web-compat-insertion-point"] NOTE: Annex adds additional steps at this point. @@ -26400,7 +26668,9 @@

        Static Semantics: ModuleRequests ( ): a List of Strings

        1. Let _moduleNames_ be ModuleRequests of |ModuleItemList|. 1. Let _additionalNames_ be ModuleRequests of |ModuleItem|. - 1. Append to _moduleNames_ each element of _additionalNames_ that is not already an element of _moduleNames_. + 1. For each String _name_ of _additionalNames_, do + 1. If _moduleNames_ does not contain _name_, then + 1. Append _name_ to _moduleNames_. 1. Return _moduleNames_. ModuleItem : StatementListItem @@ -26607,7 +26877,7 @@

        Cyclic Module Records

        an integer or ~empty~ - Auxiliary field used during Link and Evaluate only. If [[Status]] is ~linking~ or ~evaluating~, this non-negative number records the point at which the module was first visited during the depth-first traversal of the dependency graph. + Auxiliary field used during Link and Evaluate only. If [[Status]] is either ~linking~ or ~evaluating~, this non-negative number records the point at which the module was first visited during the depth-first traversal of the dependency graph. @@ -26618,7 +26888,7 @@

        Cyclic Module Records

        an integer or ~empty~ - Auxiliary field used during Link and Evaluate only. If [[Status]] is ~linking~ or ~evaluating~, this is either the module's own [[DFSIndex]] or that of an "earlier" module in the same strongly connected component. + Auxiliary field used during Link and Evaluate only. If [[Status]] is either ~linking~ or ~evaluating~, this is either the module's own [[DFSIndex]] or that of an "earlier" module in the same strongly connected component. @@ -26651,7 +26921,7 @@

        Cyclic Module Records

        a Cyclic Module Record or ~empty~ - The first visited module of the cycle, the root DFS ancestor of the strongly connected component. For a module not in a cycle this would be the module itself. Once Evaluate has completed, a module's [[DFSAncestorIndex]] is equal to the [[DFSIndex]] of its [[CycleRoot]]. + The first visited module of the cycle, the root DFS ancestor of the strongly connected component. For a module not in a cycle, this would be the module itself. Once Evaluate has completed, a module's [[DFSAncestorIndex]] is the [[DFSIndex]] of its [[CycleRoot]]. @@ -26912,7 +27182,7 @@

        Link ( ): either a normal completion containing ~unused~ or a throw completi - 1. Assert: _module_.[[Status]] is ~unlinked~, ~linked~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _module_.[[Status]] is one of ~unlinked~, ~linked~, ~evaluating-async~, or ~evaluated~. 1. Let _stack_ be a new empty List. 1. Let _result_ be Completion(InnerModuleLinking(_module_, _stack_, 0)). 1. If _result_ is an abrupt completion, then @@ -26921,7 +27191,7 @@

        Link ( ): either a normal completion containing ~unused~ or a throw completi 1. Set _m_.[[Status]] to ~unlinked~. 1. Assert: _module_.[[Status]] is ~unlinked~. 1. Return ? _result_. - 1. Assert: _module_.[[Status]] is ~linked~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _module_.[[Status]] is one of ~linked~, ~evaluating-async~, or ~evaluated~. 1. Assert: _stack_ is empty. 1. Return ~unused~. @@ -26943,7 +27213,7 @@

        1. If _module_ is not a Cyclic Module Record, then 1. Perform ? _module_.Link(). 1. Return _index_. - 1. If _module_.[[Status]] is ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~, then + 1. If _module_.[[Status]] is one of ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~, then 1. Return _index_. 1. Assert: _module_.[[Status]] is ~unlinked~. 1. Set _module_.[[Status]] to ~linking~. @@ -26955,8 +27225,8 @@

        1. Let _requiredModule_ be GetImportedModule(_module_, _required_). 1. Set _index_ to ? InnerModuleLinking(_requiredModule_, _stack_, _index_). 1. If _requiredModule_ is a Cyclic Module Record, then - 1. Assert: _requiredModule_.[[Status]] is either ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~. - 1. Assert: _requiredModule_.[[Status]] is ~linking~ if and only if _requiredModule_ is in _stack_. + 1. Assert: _requiredModule_.[[Status]] is one of ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _requiredModule_.[[Status]] is ~linking~ if and only if _stack_ contains _requiredModule_. 1. If _requiredModule_.[[Status]] is ~linking~, then 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). 1. Perform ? _module_.InitializeEnvironment(). @@ -26987,8 +27257,8 @@

        Evaluate ( ): a Promise

        1. Assert: This call to Evaluate is not happening at the same time as another call to Evaluate within the surrounding agent. - 1. Assert: _module_.[[Status]] is ~linked~, ~evaluating-async~, or ~evaluated~. - 1. If _module_.[[Status]] is ~evaluating-async~ or ~evaluated~, set _module_ to _module_.[[CycleRoot]]. + 1. Assert: _module_.[[Status]] is one of ~linked~, ~evaluating-async~, or ~evaluated~. + 1. If _module_.[[Status]] is either ~evaluating-async~ or ~evaluated~, set _module_ to _module_.[[CycleRoot]]. 1. If _module_.[[TopLevelCapability]] is not ~empty~, then 1. Return _module_.[[TopLevelCapability]].[[Promise]]. 1. Let _stack_ be a new empty List. @@ -27001,10 +27271,10 @@

        Evaluate ( ): a Promise

        1. Set _m_.[[Status]] to ~evaluated~. 1. Set _m_.[[EvaluationError]] to _result_. 1. Assert: _module_.[[Status]] is ~evaluated~. - 1. Assert: _module_.[[EvaluationError]] is _result_. + 1. Assert: _module_.[[EvaluationError]] and _result_ are the same Completion Record. 1. Perform ! Call(_capability_.[[Reject]], *undefined*, « _result_.[[Value]] »). 1. Else, - 1. Assert: _module_.[[Status]] is ~evaluating-async~ or ~evaluated~. + 1. Assert: _module_.[[Status]] is either ~evaluating-async~ or ~evaluated~. 1. Assert: _module_.[[EvaluationError]] is ~empty~. 1. If _module_.[[AsyncEvaluation]] is *false*, then 1. Assert: _module_.[[Status]] is ~evaluated~. @@ -27033,7 +27303,7 @@

        1. If _promise_.[[PromiseState]] is ~rejected~, then 1. Return ThrowCompletion(_promise_.[[PromiseResult]]). 1. Return _index_. - 1. If _module_.[[Status]] is ~evaluating-async~ or ~evaluated~, then + 1. If _module_.[[Status]] is either ~evaluating-async~ or ~evaluated~, then 1. If _module_.[[EvaluationError]] is ~empty~, return _index_. 1. Otherwise, return ? _module_.[[EvaluationError]]. 1. If _module_.[[Status]] is ~evaluating~, return _index_. @@ -27048,13 +27318,13 @@

        1. Let _requiredModule_ be GetImportedModule(_module_, _required_). 1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_). 1. If _requiredModule_ is a Cyclic Module Record, then - 1. Assert: _requiredModule_.[[Status]] is either ~evaluating~, ~evaluating-async~, or ~evaluated~. - 1. Assert: _requiredModule_.[[Status]] is ~evaluating~ if and only if _requiredModule_ is in _stack_. + 1. Assert: _requiredModule_.[[Status]] is one of ~evaluating~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _requiredModule_.[[Status]] is ~evaluating~ if and only if _stack_ contains _requiredModule_. 1. If _requiredModule_.[[Status]] is ~evaluating~, then 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). 1. Else, 1. Set _requiredModule_ to _requiredModule_.[[CycleRoot]]. - 1. Assert: _requiredModule_.[[Status]] is ~evaluating-async~ or ~evaluated~. + 1. Assert: _requiredModule_.[[Status]] is either ~evaluating-async~ or ~evaluated~. 1. If _requiredModule_.[[EvaluationError]] is not ~empty~, return ? _requiredModule_.[[EvaluationError]]. 1. If _requiredModule_.[[AsyncEvaluation]] is *true*, then 1. Set _module_.[[PendingAsyncDependencies]] to _module_.[[PendingAsyncDependencies]] + 1. @@ -27063,8 +27333,9 @@

        1. Assert: _module_.[[AsyncEvaluation]] is *false* and was never previously set to *true*. 1. Set _module_.[[AsyncEvaluation]] to *true*. 1. NOTE: The order in which module records have their [[AsyncEvaluation]] fields transition to *true* is significant. (See .) - 1. If _module_.[[PendingAsyncDependencies]] is 0, perform ExecuteAsyncModule(_module_). - 1. Otherwise, perform ? _module_.ExecuteModule(). + 1. If _module_.[[PendingAsyncDependencies]] = 0, perform ExecuteAsyncModule(_module_). + 1. Else, + 1. Perform ? _module_.ExecuteModule(). 1. Assert: _module_ occurs exactly once in _stack_. 1. Assert: _module_.[[DFSAncestorIndex]] ≤ _module_.[[DFSIndex]]. 1. If _module_.[[DFSAncestorIndex]] = _module_.[[DFSIndex]], then @@ -27097,7 +27368,7 @@

        - 1. Assert: _module_.[[Status]] is ~evaluating~ or ~evaluating-async~. + 1. Assert: _module_.[[Status]] is either ~evaluating~ or ~evaluating-async~. 1. Assert: _module_.[[HasTLA]] is *true*. 1. Let _capability_ be ! NewPromiseCapability(%Promise%). 1. Let _fulfilledClosure_ be a new Abstract Closure with no parameters that captures _module_ and performs the following steps when called: @@ -27159,7 +27430,7 @@

        1. Set _module_.[[AsyncEvaluation]] to *false*. 1. Set _module_.[[Status]] to ~evaluated~. 1. If _module_.[[TopLevelCapability]] is not ~empty~, then - 1. Assert: _module_.[[CycleRoot]] is _module_. + 1. Assert: _module_.[[CycleRoot]] and _module_ are the same Module Record. 1. Perform ! Call(_module_.[[TopLevelCapability]].[[Resolve]], *undefined*, « *undefined* »). 1. Let _execList_ be a new empty List. 1. Perform GatherAvailableAncestors(_module_, _execList_). @@ -27177,7 +27448,7 @@

        1. Else, 1. Set _m_.[[Status]] to ~evaluated~. 1. If _m_.[[TopLevelCapability]] is not ~empty~, then - 1. Assert: _m_.[[CycleRoot]] is _m_. + 1. Assert: _m_.[[CycleRoot]] and _m_ are the same Module Record. 1. Perform ! Call(_m_.[[TopLevelCapability]].[[Resolve]], *undefined*, « *undefined* »). 1. Return ~unused~. @@ -27204,7 +27475,7 @@

        1. For each Cyclic Module Record _m_ of _module_.[[AsyncParentModules]], do 1. Perform AsyncModuleExecutionRejected(_m_, _error_). 1. If _module_.[[TopLevelCapability]] is not ~empty~, then - 1. Assert: _module_.[[CycleRoot]] is _module_. + 1. Assert: _module_.[[CycleRoot]] and _module_ are the same Module Record. 1. Perform ! Call(_module_.[[TopLevelCapability]].[[Reject]], *undefined*, « _error_ »). 1. Return ~unused~. @@ -27267,7 +27538,7 @@

        Example Cyclic Module Record Graphs

        Calling _A_.Evaluate() calls InnerModuleEvaluation on _A_, _B_, and _D_, which all transition to ~evaluating~. Then InnerModuleEvaluation is called on _A_ again, which is a no-op because it is already ~evaluating~. At this point, _D_.[[PendingAsyncDependencies]] is 0, so ExecuteAsyncModule(_D_) is called and we call _D_.ExecuteModule with a new PromiseCapability tracking the asynchronous execution of _D_. We unwind back to the InnerModuleEvaluation on _B_, setting _B_.[[PendingAsyncDependencies]] to 1 and _B_.[[AsyncEvaluation]] to *true*. We unwind back to the original InnerModuleEvaluation on _A_, setting _A_.[[PendingAsyncDependencies]] to 1. In the next iteration of the loop over _A_'s dependencies, we call InnerModuleEvaluation on _C_ and thus on _D_ (again a no-op) and _E_. As _E_ has no dependencies and is not part of a cycle, we call ExecuteAsyncModule(_E_) in the same manner as _D_ and _E_ is immediately removed from the stack. We unwind once more to the original InnerModuleEvaluation on _A_, setting _C_.[[AsyncEvaluation]] to *true*. Now we finish the loop over _A_'s dependencies, set _A_.[[AsyncEvaluation]] to *true*, and remove the entire strongly connected component from the stack, transitioning all of the modules to ~evaluating-async~ at once. At this point, the fields of the modules are as given in .

        - + @@ -27300,7 +27571,7 @@

        Example Cyclic Module Record Graphs

        - + @@ -27309,7 +27580,7 @@

        Example Cyclic Module Record Graphs

        - + @@ -27330,7 +27601,7 @@

        Example Cyclic Module Record Graphs

        Let us assume that _E_ finishes executing first. When that happens, AsyncModuleExecutionFulfilled is called, _E_.[[Status]] is set to ~evaluated~ and _C_.[[PendingAsyncDependencies]] is decremented to become 1. The fields of the updated modules are as given in .

        - +
        _C_23 0 ~evaluating-async~ *true*
        _D_32 0 ~evaluating-async~ *true*
        @@ -27345,7 +27616,7 @@

        Example Cyclic Module Record Graphs

        - + @@ -27366,7 +27637,7 @@

        Example Cyclic Module Record Graphs

        _D_ is next to finish (as it was the only module that was still executing). When that happens, AsyncModuleExecutionFulfilled is called again and _D_.[[Status]] is set to ~evaluated~. Then _B_.[[PendingAsyncDependencies]] is decremented to become 0, ExecuteAsyncModule is called on _B_, and it starts executing. _C_.[[PendingAsyncDependencies]] is also decremented to become 0, and _C_ starts executing (potentially in parallel to _B_ if _B_ contains an `await`). The fields of the updated modules are as given in .

        - +
        _C_23 0 ~evaluating-async~ *true*
        @@ -27390,7 +27661,7 @@

        Example Cyclic Module Record Graphs

        - + @@ -27399,7 +27670,7 @@

        Example Cyclic Module Record Graphs

        - + @@ -27411,7 +27682,7 @@

        Example Cyclic Module Record Graphs

        Let us assume that _C_ finishes executing next. When that happens, AsyncModuleExecutionFulfilled is called again, _C_.[[Status]] is set to ~evaluated~ and _A_.[[PendingAsyncDependencies]] is decremented to become 1. The fields of the updated modules are as given in .

        - +
        _C_23 0 ~evaluating-async~ *true*
        _D_32 0 ~evaluated~ *true*
        @@ -27435,7 +27706,7 @@

        Example Cyclic Module Record Graphs

        - + @@ -27447,7 +27718,7 @@

        Example Cyclic Module Record Graphs

        Then, _B_ finishes executing. When that happens, AsyncModuleExecutionFulfilled is called again and _B_.[[Status]] is set to ~evaluated~. _A_.[[PendingAsyncDependencies]] is decremented to become 0, so ExecuteAsyncModule is called and it starts executing. The fields of the updated modules are as given in .

        - +
        _C_23 0 ~evaluated~ *true*
        @@ -27483,7 +27754,7 @@

        Example Cyclic Module Record Graphs

        Finally, _A_ finishes executing. When that happens, AsyncModuleExecutionFulfilled is called again and _A_.[[Status]] is set to ~evaluated~. At this point, the Promise in _A_.[[TopLevelCapability]] (which was returned from _A_.Evaluate()) is resolved, and this concludes the handling of this module graph. The fields of the updated module are as given in .

        - +
        @@ -27510,7 +27781,7 @@

        Example Cyclic Module Record Graphs

        Alternatively, consider a failure case where _C_ fails execution and returns an error before _B_ has finished executing. When that happens, AsyncModuleExecutionRejected is called, which sets _C_.[[Status]] to ~evaluated~ and _C_.[[EvaluationError]] to the error. It then propagates this error to all of the AsyncParentModules by performing AsyncModuleExecutionRejected on each of them. The fields of the updated modules are as given in .

        - +
        @@ -27536,8 +27807,8 @@

        Example Cyclic Module Record Graphs

        - - + + @@ -27549,7 +27820,7 @@

        Example Cyclic Module Record Graphs

        _A_ will be rejected with the same error as _C_ since _C_ will call AsyncModuleExecutionRejected on _A_ with _C_'s error. _A_.[[Status]] is set to ~evaluated~. At this point the Promise in _A_.[[TopLevelCapability]] (which was returned from _A_.Evaluate()) is rejected. The fields of the updated module are as given in .

        - +
        _C_2130 ~evaluated~ *true* « _A_ »
        @@ -27578,7 +27849,7 @@

        Example Cyclic Module Record Graphs

        Then, _B_ finishes executing without an error. When that happens, AsyncModuleExecutionFulfilled is called again and _B_.[[Status]] is set to ~evaluated~. GatherAvailableAncestors is called on _B_. However, _A_.[[CycleRoot]] is _A_ which has an evaluation error, so it will not be added to the returned _sortedExecList_ and AsyncModuleExecutionFulfilled will return without further processing. Any future importer of _B_ will resolve the rejection of _B_.[[CycleRoot]].[[EvaluationError]] from the evaluation error from _C_ that was set on the cycle root _A_. The fields of the updated modules are as given in .

        - +
        @@ -27620,7 +27891,7 @@

        Example Cyclic Module Record Graphs

        Source Text Module Records

        -

        A Source Text Module Record is used to represent information about a module that was defined from ECMAScript source text () that was parsed using the goal symbol |Module|. Its fields contain digested information about the names that are imported by the module and its concrete methods use this digest to link, link, and evaluate the module.

        +

        A Source Text Module Record is used to represent information about a module that was defined from ECMAScript source text () that was parsed using the goal symbol |Module|. Its fields contain digested information about the names that are imported and exported by the module, and its concrete methods use these digests to link and evaluate the module.

        A Source Text Module Record can exist in a module graph with other subclasses of the abstract Module Record type, and can participate in cycles with other subclasses of the Cyclic Module Record type.

        @@ -27766,7 +28037,7 @@

        Source Text Module Records

        - +

        gives examples of ImportEntry records fields used to represent the syntactic import forms:

        @@ -27911,7 +28182,7 @@

        Source Text Module Records

        - +

        gives examples of the ExportEntry record fields used to represent the syntactic export forms:

        @@ -28131,10 +28402,10 @@

        1. Let _exportEntries_ be ExportEntries of _body_. 1. For each ExportEntry Record _ee_ of _exportEntries_, do 1. If _ee_.[[ModuleRequest]] is *null*, then - 1. If _ee_.[[LocalName]] is not an element of _importedBoundNames_, then + 1. If _importedBoundNames_ does not contain _ee_.[[LocalName]], then 1. Append _ee_ to _localExportEntries_. 1. Else, - 1. Let _ie_ be the element of _importEntries_ whose [[LocalName]] is the same as _ee_.[[LocalName]]. + 1. Let _ie_ be the element of _importEntries_ whose [[LocalName]] is _ee_.[[LocalName]]. 1. If _ie_.[[ImportName]] is ~namespace-object~, then 1. NOTE: This is a re-export of an imported module namespace object. 1. Append _ee_ to _localExportEntries_. @@ -28158,7 +28429,7 @@

        GetExportedNames ( optional _exportStarSet_: a List of Source Text Module Records, - ): a List of either Strings or *null* + ): a List of Strings

        for
        @@ -28174,16 +28445,19 @@

        1. Let _exportedNames_ be a new empty List. 1. For each ExportEntry Record _e_ of _module_.[[LocalExportEntries]], do 1. Assert: _module_ provides the direct binding for this export. + 1. Assert: _e_.[[ExportName]] is not *null*. 1. Append _e_.[[ExportName]] to _exportedNames_. 1. For each ExportEntry Record _e_ of _module_.[[IndirectExportEntries]], do 1. Assert: _module_ imports a specific binding for this export. + 1. Assert: _e_.[[ExportName]] is not *null*. 1. Append _e_.[[ExportName]] to _exportedNames_. 1. For each ExportEntry Record _e_ of _module_.[[StarExportEntries]], do + 1. Assert: _e_.[[ModuleRequest]] is not *null*. 1. Let _requestedModule_ be GetImportedModule(_module_, _e_.[[ModuleRequest]]). 1. Let _starNames_ be _requestedModule_.GetExportedNames(_exportStarSet_). 1. For each element _n_ of _starNames_, do - 1. If SameValue(_n_, *"default"*) is *false*, then - 1. If _n_ is not an element of _exportedNames_, then + 1. If _n_ is not *"default"*, then + 1. If _exportedNames_ does not contain _n_, then 1. Append _n_ to _exportedNames_. 1. Return _exportedNames_. @@ -28214,16 +28488,17 @@

        1. Assert: _module_.[[Status]] is not ~new~. 1. If _resolveSet_ is not present, set _resolveSet_ to a new empty List. 1. For each Record { [[Module]], [[ExportName]] } _r_ of _resolveSet_, do - 1. If _module_ and _r_.[[Module]] are the same Module Record and SameValue(_exportName_, _r_.[[ExportName]]) is *true*, then + 1. If _module_ and _r_.[[Module]] are the same Module Record and _exportName_ is _r_.[[ExportName]], then 1. Assert: This is a circular import request. 1. Return *null*. 1. Append the Record { [[Module]]: _module_, [[ExportName]]: _exportName_ } to _resolveSet_. 1. For each ExportEntry Record _e_ of _module_.[[LocalExportEntries]], do - 1. If SameValue(_exportName_, _e_.[[ExportName]]) is *true*, then + 1. If _e_.[[ExportName]] is _exportName_, then 1. Assert: _module_ provides the direct binding for this export. 1. Return ResolvedBinding Record { [[Module]]: _module_, [[BindingName]]: _e_.[[LocalName]] }. 1. For each ExportEntry Record _e_ of _module_.[[IndirectExportEntries]], do - 1. If SameValue(_exportName_, _e_.[[ExportName]]) is *true*, then + 1. If _e_.[[ExportName]] is _exportName_, then + 1. Assert: _e_.[[ModuleRequest]] is not *null*. 1. Let _importedModule_ be GetImportedModule(_module_, _e_.[[ModuleRequest]]). 1. If _e_.[[ImportName]] is ~all~, then 1. Assert: _module_ does not provide the direct binding for this export. @@ -28231,23 +28506,25 @@

        1. Else, 1. Assert: _module_ imports a specific binding for this export. 1. Return _importedModule_.ResolveExport(_e_.[[ImportName]], _resolveSet_). - 1. If SameValue(_exportName_, *"default"*) is *true*, then + 1. If _exportName_ is *"default"*, then 1. Assert: A `default` export was not explicitly defined by this module. 1. Return *null*. 1. NOTE: A `default` export cannot be provided by an `export * from "mod"` declaration. 1. Let _starResolution_ be *null*. 1. For each ExportEntry Record _e_ of _module_.[[StarExportEntries]], do + 1. Assert: _e_.[[ModuleRequest]] is not *null*. 1. Let _importedModule_ be GetImportedModule(_module_, _e_.[[ModuleRequest]]). 1. Let _resolution_ be _importedModule_.ResolveExport(_exportName_, _resolveSet_). 1. If _resolution_ is ~ambiguous~, return ~ambiguous~. 1. If _resolution_ is not *null*, then 1. Assert: _resolution_ is a ResolvedBinding Record. - 1. If _starResolution_ is *null*, set _starResolution_ to _resolution_. + 1. If _starResolution_ is *null*, then + 1. Set _starResolution_ to _resolution_. 1. Else, 1. Assert: There is more than one `*` import that includes the requested name. 1. If _resolution_.[[Module]] and _starResolution_.[[Module]] are not the same Module Record, return ~ambiguous~. - 1. If _resolution_.[[BindingName]] is ~namespace~ and _starResolution_.[[BindingName]] is not ~namespace~, or if _resolution_.[[BindingName]] is not ~namespace~ and _starResolution_.[[BindingName]] is ~namespace~, return ~ambiguous~. - 1. If _resolution_.[[BindingName]] is a String, _starResolution_.[[BindingName]] is a String, and SameValue(_resolution_.[[BindingName]], _starResolution_.[[BindingName]]) is *false*, return ~ambiguous~. + 1. If _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]] and either _resolution_.[[BindingName]] or _starResolution_.[[BindingName]] is ~namespace~, return ~ambiguous~. + 1. If _resolution_.[[BindingName]] is a String, _starResolution_.[[BindingName]] is a String, and _resolution_.[[BindingName]] is not _starResolution_.[[BindingName]], return ~ambiguous~. 1. Return _starResolution_. @@ -28261,8 +28538,9 @@

        InitializeEnvironment ( ): either a normal completion containing ~unused~ or 1. For each ExportEntry Record _e_ of _module_.[[IndirectExportEntries]], do + 1. Assert: _e_.[[ExportName]] is not *null*. 1. Let _resolution_ be _module_.ResolveExport(_e_.[[ExportName]]). - 1. If _resolution_ is *null* or ~ambiguous~, throw a *SyntaxError* exception. + 1. If _resolution_ is either *null* or ~ambiguous~, throw a *SyntaxError* exception. 1. Assert: _resolution_ is a ResolvedBinding Record. 1. Assert: All named exports from _module_ are resolvable. 1. Let _realm_ be _module_.[[Realm]]. @@ -28277,7 +28555,7 @@

        InitializeEnvironment ( ): either a normal completion containing ~unused~ or 1. Perform ! _env_.InitializeBinding(_in_.[[LocalName]], _namespace_, ~normal~). 1. Else, 1. Let _resolution_ be _importedModule_.ResolveExport(_in_.[[ImportName]]). - 1. If _resolution_ is *null* or ~ambiguous~, throw a *SyntaxError* exception. + 1. If _resolution_ is either *null* or ~ambiguous~, throw a *SyntaxError* exception. 1. If _resolution_.[[BindingName]] is ~namespace~, then 1. Let _namespace_ be GetModuleNamespace(_resolution_.[[Module]]). 1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*). @@ -28299,7 +28577,7 @@

        InitializeEnvironment ( ): either a normal completion containing ~unused~ or 1. Let _declaredVarNames_ be a new empty List. 1. For each element _d_ of _varDeclarations_, do 1. For each element _dn_ of the BoundNames of _d_, do - 1. If _dn_ is not an element of _declaredVarNames_, then + 1. If _declaredVarNames_ does not contain _dn_, then 1. Perform ! _env_.CreateMutableBinding(_dn_, *false*). 1. Perform ! _env_.InitializeBinding(_dn_, *undefined*, ~normal~). 1. Append _dn_ to _declaredVarNames_. @@ -28311,7 +28589,7 @@

        InitializeEnvironment ( ): either a normal completion containing ~unused~ or 1. Perform ! _env_.CreateImmutableBinding(_dn_, *true*). 1. Else, 1. Perform ! _env_.CreateMutableBinding(_dn_, *false*). - 1. If _d_ is a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then + 1. If _d_ is either a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then 1. Let _fo_ be InstantiateFunctionObject of _d_ with arguments _env_ and _privateEnv_. 1. Perform ! _env_.InitializeBinding(_dn_, _fo_, ~normal~). 1. Remove _moduleContext_ from the execution context stack. @@ -28431,7 +28709,8 @@

        1. If _result_ is a normal completion, then 1. If _referrer_.[[LoadedModules]] contains a Record whose [[Specifier]] is _specifier_, then 1. Assert: That Record's [[Module]] is _result_.[[Value]]. - 1. Else, append the Record { [[Specifier]]: _specifier_, [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]]. + 1. Else, + 1. Append the Record { [[Specifier]]: _specifier_, [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]]. 1. If _payload_ is a GraphLoadingState Record, then 1. Perform ContinueModuleLoading(_payload_, _result_). 1. Else, @@ -28477,7 +28756,7 @@

        Runtime Semantics: Evaluation

        ModuleBody : ModuleItemList 1. Let _result_ be Completion(Evaluation of |ModuleItemList|). - 1. If _result_.[[Type]] is ~normal~ and _result_.[[Value]] is ~empty~, then + 1. If _result_ is a normal completion and _result_.[[Value]] is ~empty~, then 1. Return *undefined*. 1. Return ? _result_. @@ -28682,7 +28961,7 @@

        Static Semantics: Early Errors

        It is a Syntax Error if ReferencedBindings of |NamedExports| contains any |StringLiteral|s.
      • - For each |IdentifierName| _n_ in ReferencedBindings of |NamedExports|: It is a Syntax Error if StringValue of _n_ is a |ReservedWord| or if the StringValue of _n_ is one of: *"implements"*, *"interface"*, *"let"*, *"package"*, *"private"*, *"protected"*, *"public"*, or *"static"*. + For each |IdentifierName| _n_ in ReferencedBindings of |NamedExports|: It is a Syntax Error if StringValue of _n_ is a |ReservedWord| or the StringValue of _n_ is one of *"implements"*, *"interface"*, *"let"*, *"package"*, *"private"*, *"protected"*, *"public"*, or *"static"*.
      • @@ -28888,13 +29167,13 @@

        Static Semantics: ExportEntries ( ): a List of ExportEntry Records

        1. Let _names_ be BoundNames of |HoistableDeclaration|. 1. Let _localName_ be the sole element of _names_. - 1. Return a List whose sole element is the ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: _localName_, [[ExportName]]: *"default"* }. + 1. Return a List whose sole element is a new ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: _localName_, [[ExportName]]: *"default"* }. ExportDeclaration : `export` `default` ClassDeclaration 1. Let _names_ be BoundNames of |ClassDeclaration|. 1. Let _localName_ be the sole element of _names_. - 1. Return a List whose sole element is the ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: _localName_, [[ExportName]]: *"default"* }. + 1. Return a List whose sole element is a new ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: _localName_, [[ExportName]]: *"default"* }. ExportDeclaration : `export` `default` AssignmentExpression `;` @@ -28944,7 +29223,7 @@

        1. Else, 1. Let _localName_ be *null*. 1. Let _importName_ be _sourceName_. - 1. Return a List whose sole element is the ExportEntry Record { [[ModuleRequest]]: _module_, [[ImportName]]: _importName_, [[LocalName]]: _localName_, [[ExportName]]: _sourceName_ }. + 1. Return a List whose sole element is a new ExportEntry Record { [[ModuleRequest]]: _module_, [[ImportName]]: _importName_, [[LocalName]]: _localName_, [[ExportName]]: _sourceName_ }. ExportSpecifier : ModuleExportName `as` ModuleExportName @@ -28956,7 +29235,7 @@

        1. Else, 1. Let _localName_ be *null*. 1. Let _importName_ be _sourceName_. - 1. Return a List whose sole element is the ExportEntry Record { [[ModuleRequest]]: _module_, [[ImportName]]: _importName_, [[LocalName]]: _localName_, [[ExportName]]: _exportName_ }. + 1. Return a List whose sole element is a new ExportEntry Record { [[ModuleRequest]]: _module_, [[ImportName]]: _importName_, [[LocalName]]: _localName_, [[ExportName]]: _exportName_ }. @@ -29104,9 +29383,11 @@

        ECMAScript Standard Built-in Objects

        Unless otherwise specified every built-in function and every built-in constructor has the Function prototype object, which is the initial value of the expression `Function.prototype` (), as the value of its [[Prototype]] internal slot.

        Unless otherwise specified every built-in prototype object has the Object prototype object, which is the initial value of the expression `Object.prototype` (), as the value of its [[Prototype]] internal slot, except the Object prototype object itself.

        +

        If this specification defines a built-in constructor's behaviour via algorithm steps, then that is its behaviour for the purposes of both [[Call]] and [[Construct]]. If such an algorithm needs to distinguish the two cases, it checks whether NewTarget is *undefined*, which indicates a [[Call]] invocation.

        Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless otherwise specified in the description of a particular function.

        +

        Built-in function objects that are not constructors do not have a *"prototype"* property unless otherwise specified in the description of a particular function.

        Each built-in function defined in this specification is created by calling the CreateBuiltinFunction abstract operation (). The values of the _length_ and _name_ parameters are the initial values of the *"length"* and *"name"* properties as discussed below. The values of the _prefix_ parameter are similarly discussed below.

        -

        Every built-in function object, including constructors, has a *"length"* property whose value is a non-negative integral Number. Unless otherwise specified, this value is equal to the number of required parameters shown in the subclause heading for the function description. Optional parameters and rest parameters are not included in the parameter count.

        +

        Every built-in function object, including constructors, has a *"length"* property whose value is a non-negative integral Number. Unless otherwise specified, this value is the number of required parameters shown in the subclause heading for the function description. Optional parameters and rest parameters are not included in the parameter count.

        For example, the function object that is the initial value of the *"map"* property of the Array prototype object is described under the subclause heading «Array.prototype.map (callbackFn [ , thisArg])» which shows the two named arguments callbackFn and thisArg, the latter being optional; therefore the value of the *"length"* property of that function object is *1*𝔽.

        @@ -29180,7 +29461,7 @@

        1. If _x_ is not a String, return _x_. 1. Let _evalRealm_ be the current Realm Record. 1. NOTE: In the case of a direct eval, _evalRealm_ is the realm of both the caller of `eval` and of the `eval` function itself. - 1. Perform ? HostEnsureCanCompileStrings(_evalRealm_). + 1. Perform ? HostEnsureCanCompileStrings(_evalRealm_, « », _x_, _direct_). 1. Let _inFunction_ be *false*. 1. Let _inMethod_ be *false*. 1. Let _inDerivedConstructor_ be *false*. @@ -29226,9 +29507,9 @@

        1. Set _evalContext_'s PrivateEnvironment to _privateEnv_. 1. Push _evalContext_ onto the execution context stack; _evalContext_ is now the running execution context. 1. Let _result_ be Completion(EvalDeclarationInstantiation(_body_, _varEnv_, _lexEnv_, _privateEnv_, _strictEval_)). - 1. If _result_.[[Type]] is ~normal~, then + 1. If _result_ is a normal completion, then 1. Set _result_ to Completion(Evaluation of _body_). - 1. If _result_.[[Type]] is ~normal~ and _result_.[[Value]] is ~empty~, then + 1. If _result_ is a normal completion and _result_.[[Value]] is ~empty~, then 1. Set _result_ to NormalCompletion(*undefined*). 1. Suspend _evalContext_ and remove it from the execution context stack. 1. Resume the context that is now on the top of the execution context stack as the running execution context. @@ -29243,16 +29524,19 @@

        HostEnsureCanCompileStrings ( _calleeRealm_: a Realm Record, + _parameterStrings_: a List of Strings, + _bodyString_: a String, + _direct_: a Boolean, ): either a normal completion containing ~unused~ or a throw completion

        description
        It allows host environments to block certain ECMAScript functions which allow developers to interpret and evaluate strings as ECMAScript code.
        -

        An implementation of HostEnsureCanCompileStrings must conform to the following requirements:

        -
          -
        • If the returned Completion Record is a normal completion, it must be a normal completion containing ~unused~.
        • -
        +

        + _parameterStrings_ represents the strings that, when using one of the function constructors, will be concatenated together to build the parameters list. _bodyString_ represents the function body or the string passed to an `eval` call. + _direct_ signifies whether the evaluation is a direct eval. +

        The default implementation of HostEnsureCanCompileStrings is to return NormalCompletion(~unused~).

        @@ -29284,7 +29568,7 @@

        1. NOTE: `eval` will not create a global var declaration that would be shadowed by a global lexical declaration. 1. Let _thisEnv_ be _lexEnv_. 1. Assert: The following loop will terminate. - 1. Repeat, while _thisEnv_ is not the same as _varEnv_, + 1. Repeat, while _thisEnv_ and _varEnv_ are not the same Environment Record, 1. If _thisEnv_ is not an Object Environment Record, then 1. NOTE: The environment of with statements cannot contain any lexical declaration so it doesn't need to be checked for var/let hoisting conflicts. 1. For each element _name_ of _varNames_, do @@ -29303,27 +29587,27 @@

        1. Let _functionsToInitialize_ be a new empty List. 1. Let _declaredFunctionNames_ be a new empty List. 1. For each element _d_ of _varDeclarations_, in reverse List order, do - 1. If _d_ is neither a |VariableDeclaration| nor a |ForBinding| nor a |BindingIdentifier|, then + 1. If _d_ is not either a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then 1. Assert: _d_ is either a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|. 1. NOTE: If there are multiple function declarations for the same name, the last declaration is used. 1. Let _fn_ be the sole element of the BoundNames of _d_. - 1. If _fn_ is not an element of _declaredFunctionNames_, then + 1. If _declaredFunctionNames_ does not contain _fn_, then 1. If _varEnv_ is a Global Environment Record, then 1. Let _fnDefinable_ be ? _varEnv_.CanDeclareGlobalFunction(_fn_). 1. If _fnDefinable_ is *false*, throw a *TypeError* exception. 1. Append _fn_ to _declaredFunctionNames_. 1. Insert _d_ as the first element of _functionsToInitialize_. - 1. [id="step-evaldeclarationinstantiation-web-compat-insertion-point"] NOTE: Annex adds additional steps at this point. 1. Let _declaredVarNames_ be a new empty List. 1. For each element _d_ of _varDeclarations_, do - 1. If _d_ is a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then + 1. If _d_ is either a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then 1. For each String _vn_ of the BoundNames of _d_, do - 1. If _vn_ is not an element of _declaredFunctionNames_, then + 1. If _declaredFunctionNames_ does not contain _vn_, then 1. If _varEnv_ is a Global Environment Record, then 1. Let _vnDefinable_ be ? _varEnv_.CanDeclareGlobalVar(_vn_). 1. If _vnDefinable_ is *false*, throw a *TypeError* exception. - 1. If _vn_ is not an element of _declaredVarNames_, then + 1. If _declaredVarNames_ does not contain _vn_, then 1. Append _vn_ to _declaredVarNames_. + 1. [id="step-evaldeclarationinstantiation-web-compat-insertion-point"] NOTE: Annex adds additional steps at this point. 1. [id="step-evaldeclarationinstantiation-post-validation"] NOTE: No abnormal terminations occur after this algorithm step unless _varEnv_ is a Global Environment Record and the global object is a Proxy exotic object. 1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _body_. 1. For each element _d_ of _lexDeclarations_, do @@ -29384,7 +29668,7 @@

        isNaN ( _number_ )

        1. Otherwise, return *false*.
        -

        A reliable way for ECMAScript code to test if a value `X` is a *NaN* is an expression of the form `X !== X`. The result will be *true* if and only if `X` is a *NaN*.

        +

        A reliable way for ECMAScript code to test if a value `X` is *NaN* is an expression of the form `X !== X`. The result will be *true* if and only if `X` is *NaN*.

        @@ -29396,9 +29680,9 @@

        parseFloat ( _string_ )

        1. Let _inputString_ be ? ToString(_string_). 1. Let _trimmedString_ be ! TrimString(_inputString_, ~start~). - 1. If neither _trimmedString_ nor any prefix of _trimmedString_ satisfies the syntax of a |StrDecimalLiteral| (see ), return *NaN*. - 1. Let _numberString_ be the longest prefix of _trimmedString_, which might be _trimmedString_ itself, that satisfies the syntax of a |StrDecimalLiteral|. - 1. Let _parsedNumber_ be ParseText(StringToCodePoints(_numberString_), |StrDecimalLiteral|). + 1. Let _trimmed_ be StringToCodePoints(_trimmedString_). + 1. Let _trimmedPrefix_ be the longest prefix of _trimmed_ that satisfies the syntax of a |StrDecimalLiteral|, which might be _trimmed_ itself. If there is no such prefix, return *NaN*. + 1. Let _parsedNumber_ be ParseText(_trimmedPrefix_, |StrDecimalLiteral|). 1. Assert: _parsedNumber_ is a Parse Node. 1. Return StringNumericValue of _parsedNumber_. @@ -29409,7 +29693,7 @@

        parseFloat ( _string_ )

        parseInt ( _string_, _radix_ )

        -

        This function produces an integral Number dictated by interpretation of the contents of the _string_ argument according to the specified _radix_. Leading white space in _string_ is ignored. If _radix_ is *undefined* or 0, it is assumed to be 10 except when the number begins with the code unit pairs `0x` or `0X`, in which case a radix of 16 is assumed. If _radix_ is 16, the number may also optionally begin with the code unit pairs `0x` or `0X`.

        +

        This function produces an integral Number dictated by interpretation of the contents of _string_ according to the specified _radix_. Leading white space in _string_ is ignored. If _radix_ coerces to 0 (such as when it is *undefined*), it is assumed to be 10 except when the number representation begins with *"0x"* or *"0X"*, in which case it is assumed to be 16. If _radix_ is 16, the number representation may optionally begin with *"0x"* or *"0X"*.

        It is the %parseInt% intrinsic object.

        It performs the following steps when called:

        @@ -29417,7 +29701,7 @@

        parseInt ( _string_, _radix_ )

        1. Let _S_ be ! TrimString(_inputString_, ~start~). 1. Let _sign_ be 1. 1. If _S_ is not empty and the first code unit of _S_ is the code unit 0x002D (HYPHEN-MINUS), set _sign_ to -1. - 1. If _S_ is not empty and the first code unit of _S_ is the code unit 0x002B (PLUS SIGN) or the code unit 0x002D (HYPHEN-MINUS), set _S_ to the substring of _S_ from index 1. + 1. If _S_ is not empty and the first code unit of _S_ is either the code unit 0x002B (PLUS SIGN) or the code unit 0x002D (HYPHEN-MINUS), set _S_ to the substring of _S_ from index 1. 1. Let _R_ be ℝ(? ToInt32(_radix_)). 1. Let _stripPrefix_ be *true*. 1. If _R_ ≠ 0, then @@ -29432,7 +29716,7 @@

        parseInt ( _string_, _radix_ )

        1. If _S_ contains a code unit that is not a radix-_R_ digit, let _end_ be the index within _S_ of the first such code unit; otherwise, let _end_ be the length of _S_. 1. Let _Z_ be the substring of _S_ from 0 to _end_. 1. If _Z_ is empty, return *NaN*. - 1. Let _mathInt_ be the integer value that is represented by _Z_ in radix-_R_ notation, using the letters A-Z and a-z for digits with values 10 through 35. (However, if _R_ is 10 and _Z_ contains more than 20 significant digits, every significant digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if _R_ is not 2, 4, 8, 10, 16, or 32, then _mathInt_ may be an implementation-approximated integer representing the integer value denoted by _Z_ in radix-_R_ notation.) + 1. Let _mathInt_ be the integer value that is represented by _Z_ in radix-_R_ notation, using the letters A through Z and a through z for digits with values 10 through 35. (However, if _R_ = 10 and _Z_ contains more than 20 significant digits, every significant digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if _R_ is not one of 2, 4, 8, 10, 16, or 32, then _mathInt_ may be an implementation-approximated integer representing the integer value denoted by _Z_ in radix-_R_ notation.) 1. If _mathInt_ = 0, then 1. If _sign_ = -1, return *-0*𝔽. 1. Return *+0*𝔽. @@ -29513,15 +29797,14 @@

        It performs URI encoding and escaping, interpreting _string_ as a sequence of UTF-16 encoded code points as described in . If a character is identified as unreserved in RFC 2396 or appears in _extraUnescaped_, it is not escaped.

        - 1. Let _strLen_ be the length of _string_. + 1. Let _len_ be the length of _string_. 1. Let _R_ be the empty String. 1. Let _alwaysUnescaped_ be the string-concatenation of the ASCII word characters and *"-.!~\*'()"*. 1. Let _unescapedSet_ be the string-concatenation of _alwaysUnescaped_ and _extraUnescaped_. 1. Let _k_ be 0. - 1. Repeat, - 1. If _k_ = _strLen_, return _R_. + 1. Repeat, while _k_ < _len_, 1. Let _C_ be the code unit at index _k_ within _string_. - 1. If _C_ is in _unescapedSet_, then + 1. If _unescapedSet_ contains _C_, then 1. Set _k_ to _k_ + 1. 1. Set _R_ to the string-concatenation of _R_ and _C_. 1. Else, @@ -29531,7 +29814,8 @@

        1. Let _Octets_ be the List of octets resulting by applying the UTF-8 transformation to _cp_.[[CodePoint]]. 1. For each element _octet_ of _Octets_, do 1. Let _hex_ be the String representation of _octet_, formatted as an uppercase hexadecimal number. - 1. Set _R_ to the string-concatenation of _R_, *"%"*, and ! StringPad(_hex_, *2*𝔽, *"0"*, ~start~). + 1. Set _R_ to the string-concatenation of _R_, *"%"*, and StringPad(_hex_, 2, *"0"*, ~start~). + 1. Return _R_.

        Because percent-encoding is used to represent individual octets, a single code point may be expressed as multiple consecutive escape sequences (one for each of its 8-bit UTF-8 code units).

        @@ -29550,51 +29834,70 @@

        It performs URI unescaping and decoding, preserving any escape sequences that correspond to Basic Latin characters in _preserveEscapeSet_.
        - 1. Let _strLen_ be the length of _string_. + 1. Let _len_ be the length of _string_. 1. Let _R_ be the empty String. 1. Let _k_ be 0. - 1. Repeat, - 1. If _k_ = _strLen_, return _R_. + 1. Repeat, while _k_ < _len_, 1. Let _C_ be the code unit at index _k_ within _string_. - 1. If _C_ is not the code unit 0x0025 (PERCENT SIGN), then - 1. Let _S_ be the String value containing only the code unit _C_. - 1. Else, - 1. Let _start_ be _k_. - 1. If _k_ + 2 ≥ _strLen_, throw a *URIError* exception. - 1. If the code units at index (_k_ + 1) and (_k_ + 2) within _string_ do not represent hexadecimal digits, throw a *URIError* exception. - 1. Let _B_ be the 8-bit value represented by the two hexadecimal digits at index (_k_ + 1) and (_k_ + 2). + 1. Let _S_ be _C_. + 1. If _C_ is the code unit 0x0025 (PERCENT SIGN), then + 1. If _k_ + 3 > _len_, throw a *URIError* exception. + 1. Let _escape_ be the substring of _string_ from _k_ to _k_ + 3. + 1. Let _B_ be ParseHexOctet(_string_, _k_ + 1). + 1. If _B_ is not an integer, throw a *URIError* exception. 1. Set _k_ to _k_ + 2. 1. Let _n_ be the number of leading 1 bits in _B_. 1. If _n_ = 0, then - 1. Let _C_ be the code unit whose value is _B_. - 1. If _C_ is not in _preserveEscapeSet_, then - 1. Let _S_ be the String value containing only the code unit _C_. - 1. Else, - 1. Let _S_ be the substring of _string_ from _start_ to _k_ + 1. + 1. Let _asciiChar_ be the code unit whose numeric value is _B_. + 1. If _preserveEscapeSet_ contains _asciiChar_, set _S_ to _escape_. Otherwise, set _S_ to _asciiChar_. 1. Else, 1. If _n_ = 1 or _n_ > 4, throw a *URIError* exception. - 1. If _k_ + (3 × (_n_ - 1)) ≥ _strLen_, throw a *URIError* exception. 1. Let _Octets_ be « _B_ ». 1. Let _j_ be 1. 1. Repeat, while _j_ < _n_, 1. Set _k_ to _k_ + 1. + 1. If _k_ + 3 > _len_, throw a *URIError* exception. 1. If the code unit at index _k_ within _string_ is not the code unit 0x0025 (PERCENT SIGN), throw a *URIError* exception. - 1. If the code units at index (_k_ + 1) and (_k_ + 2) within _string_ do not represent hexadecimal digits, throw a *URIError* exception. - 1. Let _B_ be the 8-bit value represented by the two hexadecimal digits at index (_k_ + 1) and (_k_ + 2). + 1. Let _continuationByte_ be ParseHexOctet(_string_, _k_ + 1). + 1. If _continuationByte_ is not an integer, throw a *URIError* exception. + 1. Append _continuationByte_ to _Octets_. 1. Set _k_ to _k_ + 2. - 1. Append _B_ to _Octets_. 1. Set _j_ to _j_ + 1. 1. Assert: The length of _Octets_ is _n_. 1. If _Octets_ does not contain a valid UTF-8 encoding of a Unicode code point, throw a *URIError* exception. 1. Let _V_ be the code point obtained by applying the UTF-8 transformation to _Octets_, that is, from a List of octets into a 21-bit value. - 1. Let _S_ be UTF16EncodeCodePoint(_V_). + 1. Set _S_ to UTF16EncodeCodePoint(_V_). 1. Set _R_ to the string-concatenation of _R_ and _S_. 1. Set _k_ to _k_ + 1. + 1. Return _R_.

        RFC 3629 prohibits the decoding of invalid UTF-8 octet sequences. For example, the invalid sequence 0xC0 0x80 must not decode into the code unit 0x0000. Implementations of the Decode algorithm are required to throw a *URIError* when encountering such invalid sequences.

        + + +

        + ParseHexOctet ( + _string_: a String, + _position_: a non-negative integer, + ): either a non-negative integer or a non-empty List of *SyntaxError* objects +

        +
        +
        description
        +
        It parses a sequence of two hexadecimal characters at the specified _position_ in _string_ into an unsigned 8-bit integer.
        +
        + + 1. Let _len_ be the length of _string_. + 1. Assert: _position_ + 2 ≤ _len_. + 1. Let _hexDigits_ be the substring of _string_ from _position_ to _position_ + 2. + 1. Let _parseResult_ be ParseText(StringToCodePoints(_hexDigits_), |HexDigits[~Sep]|). + 1. If _parseResult_ is not a Parse Node, return _parseResult_. + 1. Let _n_ be the MV of _parseResult_. + 1. Assert: _n_ is in the inclusive interval from 0 to 255. + 1. Return _n_. + +
        @@ -29850,10 +30153,9 @@

        Object ( [ _value_ ] )

        1. If NewTarget is neither *undefined* nor the active function object, then 1. Return ? OrdinaryCreateFromConstructor(NewTarget, *"%Object.prototype%"*). - 1. If _value_ is *undefined* or *null*, return OrdinaryObjectCreate(%Object.prototype%). + 1. If _value_ is either *undefined* or *null*, return OrdinaryObjectCreate(%Object.prototype%). 1. Return ! ToObject(_value_). -

        The *"length"* property of this function is *1*𝔽.

        @@ -29862,7 +30164,7 @@

        Properties of the Object Constructor

        The Object constructor:

        • has a [[Prototype]] internal slot whose value is %Function.prototype%.
        • -
        • has a *"length"* property.
        • +
        • has a *"length"* property whose value is *1*𝔽.
        • has the following additional properties:
        @@ -29927,11 +30229,9 @@

        1. If _propDesc_ is not *undefined* and _propDesc_.[[Enumerable]] is *true*, then 1. Let _descObj_ be ? Get(_props_, _nextKey_). 1. Let _desc_ be ? ToPropertyDescriptor(_descObj_). - 1. Append the pair (a two element List) consisting of _nextKey_ and _desc_ to the end of _descriptors_. - 1. For each element _pair_ of _descriptors_, do - 1. Let _P_ be the first element of _pair_. - 1. Let _desc_ be the second element of _pair_. - 1. Perform ? DefinePropertyOrThrow(_O_, _P_, _desc_). + 1. Append the Record { [[Key]]: _nextKey_, [[Descriptor]]: _desc_ } to _descriptors_. + 1. For each element _property_ of _descriptors_, do + 1. Perform ? DefinePropertyOrThrow(_O_, _property_.[[Key]], _property_.[[Descriptor]]). 1. Return _O_. @@ -30045,7 +30345,7 @@

        1. Let _keys_ be ? _obj_.[[OwnPropertyKeys]](). 1. Let _nameList_ be a new empty List. 1. For each element _nextKey_ of _keys_, do - 1. If _nextKey_ is a Symbol and _type_ is ~symbol~ or _nextKey_ is a String and _type_ is ~string~, then + 1. If _nextKey_ is a Symbol and _type_ is ~symbol~, or if _nextKey_ is a String and _type_ is ~string~, then 1. Append _nextKey_ to _nameList_. 1. Return _nameList_. @@ -30061,6 +30361,24 @@

        Object.getPrototypeOf ( _O_ )

        + +

        Object.groupBy ( _items_, _callbackfn_ )

        + +

        _callbackfn_ should be a function that accepts two arguments. `groupBy` calls _callbackfn_ once for each element in _items_, in ascending order, and constructs a new object. Each value returned by _callbackfn_ is coerced to a property key. For each such property key, the result object has a property whose key is that property key and whose value is an array containing all the elements for which the _callbackfn_ return value coerced to that key.

        +

        _callbackfn_ is called with two arguments: the value of the element and the index of the element.

        +

        The return value of `groupBy` is an object that does not inherit from %Object.prototype%.

        +
        +

        This function performs the following steps when called:

        + + 1. Let _groups_ be ? GroupBy(_items_, _callbackfn_, ~property~). + 1. Let _obj_ be OrdinaryObjectCreate(*null*). + 1. For each Record { [[Key]], [[Elements]] } _g_ of _groups_, do + 1. Let _elements_ be CreateArrayFromList(_g_.[[Elements]]). + 1. Perform ! CreateDataPropertyOrThrow(_obj_, _g_.[[Key]], _elements_). + 1. Return _obj_. + +
        +

        Object.hasOwn ( _O_, _P_ )

        This function performs the following steps when called:

        @@ -30413,18 +30731,16 @@

        CreateDynamicFunction ( _constructor_: a constructor, _newTarget_: a constructor, - _kind_: ~normal~, ~generator~, ~async~, or ~asyncGenerator~, + _kind_: ~normal~, ~generator~, ~async~, or ~async-generator~, _parameterArgs_: a List of ECMAScript language values, _bodyArg_: an ECMAScript language value, - ): either a normal completion containing a function object or a throw completion + ): either a normal completion containing an ECMAScript function object or a throw completion

        description
        _constructor_ is the constructor function that is performing this action. _newTarget_ is the constructor that `new` was initially applied to. _parameterArgs_ and _bodyArg_ reflect the argument values that were passed to _constructor_.
        - 1. Let _currentRealm_ be the current Realm Record. - 1. Perform ? HostEnsureCanCompileStrings(_currentRealm_). 1. If _newTarget_ is *undefined*, set _newTarget_ to _constructor_. 1. If _kind_ is ~normal~, then 1. Let _prefix_ be *"function"*. @@ -30445,47 +30761,51 @@

        1. Let _parameterSym_ be the grammar symbol |FormalParameters[~Yield, +Await]|. 1. Let _fallbackProto_ be *"%AsyncFunction.prototype%"*. 1. Else, - 1. Assert: _kind_ is ~asyncGenerator~. + 1. Assert: _kind_ is ~async-generator~. 1. Let _prefix_ be *"async function\*"*. 1. Let _exprSym_ be the grammar symbol |AsyncGeneratorExpression|. 1. Let _bodySym_ be the grammar symbol |AsyncGeneratorBody|. 1. Let _parameterSym_ be the grammar symbol |FormalParameters[+Yield, +Await]|. 1. Let _fallbackProto_ be *"%AsyncGeneratorFunction.prototype%"*. 1. Let _argCount_ be the number of elements in _parameterArgs_. + 1. Let _parameterStrings_ be a new empty List. + 1. For each element _arg_ of _parameterArgs_, do + 1. Append ? ToString(_arg_) to _parameterStrings_. + 1. Let _bodyString_ be ? ToString(_bodyArg_). + 1. Let _currentRealm_ be the current Realm Record. + 1. Perform ? HostEnsureCanCompileStrings(_currentRealm_, _parameterStrings_, _bodyString_, *false*). 1. Let _P_ be the empty String. 1. If _argCount_ > 0, then - 1. Let _firstArg_ be _parameterArgs_[0]. - 1. Set _P_ to ? ToString(_firstArg_). + 1. Set _P_ to _parameterStrings_[0]. 1. Let _k_ be 1. 1. Repeat, while _k_ < _argCount_, - 1. Let _nextArg_ be _parameterArgs_[_k_]. - 1. Let _nextArgString_ be ? ToString(_nextArg_). + 1. Let _nextArgString_ be _parameterStrings_[_k_]. 1. Set _P_ to the string-concatenation of _P_, *","* (a comma), and _nextArgString_. 1. Set _k_ to _k_ + 1. - 1. Let _bodyString_ be the string-concatenation of 0x000A (LINE FEED), ? ToString(_bodyArg_), and 0x000A (LINE FEED). - 1. Let _sourceString_ be the string-concatenation of _prefix_, *" anonymous("*, _P_, 0x000A (LINE FEED), *") {"*, _bodyString_, and *"}"*. + 1. Let _bodyParseString_ be the string-concatenation of 0x000A (LINE FEED), _bodyString_, and 0x000A (LINE FEED). + 1. Let _sourceString_ be the string-concatenation of _prefix_, *" anonymous("*, _P_, 0x000A (LINE FEED), *") {"*, _bodyParseString_, and *"}"*. 1. Let _sourceText_ be StringToCodePoints(_sourceString_). 1. Let _parameters_ be ParseText(StringToCodePoints(_P_), _parameterSym_). 1. If _parameters_ is a List of errors, throw a *SyntaxError* exception. - 1. Let _body_ be ParseText(StringToCodePoints(_bodyString_), _bodySym_). + 1. Let _body_ be ParseText(StringToCodePoints(_bodyParseString_), _bodySym_). 1. If _body_ is a List of errors, throw a *SyntaxError* exception. - 1. NOTE: The parameters and body are parsed separately to ensure that each is valid alone. For example, `new Function("/*", "*/ ) {")` is not legal. + 1. NOTE: The parameters and body are parsed separately to ensure that each is valid alone. For example, `new Function("/*", "*/ ) {")` does not evaluate to a function. 1. NOTE: If this step is reached, _sourceText_ must have the syntax of _exprSym_ (although the reverse implication does not hold). The purpose of the next two steps is to enforce any Early Error rules which apply to _exprSym_ directly. 1. Let _expr_ be ParseText(_sourceText_, _exprSym_). 1. If _expr_ is a List of errors, throw a *SyntaxError* exception. 1. Let _proto_ be ? GetPrototypeFromConstructor(_newTarget_, _fallbackProto_). - 1. Let _realmF_ be the current Realm Record. - 1. Let _env_ be _realmF_.[[GlobalEnv]]. + 1. Let _env_ be _currentRealm_.[[GlobalEnv]]. 1. Let _privateEnv_ be *null*. 1. Let _F_ be OrdinaryFunctionCreate(_proto_, _sourceText_, _parameters_, _body_, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform SetFunctionName(_F_, *"anonymous"*). 1. If _kind_ is ~generator~, then 1. Let _prototype_ be OrdinaryObjectCreate(%GeneratorFunction.prototype.prototype%). 1. Perform ! DefinePropertyOrThrow(_F_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Else if _kind_ is ~asyncGenerator~, then + 1. Else if _kind_ is ~async-generator~, then 1. Let _prototype_ be OrdinaryObjectCreate(%AsyncGeneratorFunction.prototype.prototype%). 1. Perform ! DefinePropertyOrThrow(_F_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Else if _kind_ is ~normal~, perform MakeConstructor(_F_). + 1. Else if _kind_ is ~normal~, then + 1. Perform MakeConstructor(_F_). 1. NOTE: Functions whose _kind_ is ~async~ are not constructible and do not have a [[Construct]] internal method or a *"prototype"* property. 1. Return _F_. @@ -30502,14 +30822,10 @@

        Properties of the Function Constructor

        • is itself a built-in function object.
        • has a [[Prototype]] internal slot whose value is %Function.prototype%.
        • +
        • has a *"length"* property whose value is *1*𝔽.
        • has the following properties:
        - -

        Function.length

        -

        This is a data property with a value of 1. This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        -
        -

        Function.prototype

        The value of `Function.prototype` is the Function prototype object.

        @@ -30540,7 +30856,7 @@

        Function.prototype.apply ( _thisArg_, _argArray_ )

        1. Let _func_ be the *this* value. 1. If IsCallable(_func_) is *false*, throw a *TypeError* exception. - 1. If _argArray_ is *undefined* or *null*, then + 1. If _argArray_ is either *undefined* or *null*, then 1. Perform PrepareForTailCall(). 1. Return ? Call(_func_, _thisArg_). 1. Let _argList_ be ? CreateListFromArrayLike(_argArray_). @@ -30551,7 +30867,7 @@

        Function.prototype.apply ( _thisArg_, _argArray_ )

        The _thisArg_ value is passed without modification as the *this* value. This is a change from Edition 3, where an *undefined* or *null* _thisArg_ is replaced with the global object and ToObject is applied to all other values and that result is passed as the *this* value. Even though the _thisArg_ is passed without modification, non-strict functions still perform these transformations upon entry to the function.

        -

        If _func_ is an arrow function or a bound function exotic object then the _thisArg_ will be ignored by the function [[Call]] in step .

        +

        If _func_ is either an arrow function or a bound function exotic object, then the _thisArg_ will be ignored by the function [[Call]] in step .

        @@ -30567,8 +30883,10 @@

        Function.prototype.bind ( _thisArg_, ..._args_ )

        1. If _targetHasLength_ is *true*, then 1. Let _targetLen_ be ? Get(_Target_, *"length"*). 1. If _targetLen_ is a Number, then - 1. If _targetLen_ is *+∞*𝔽, set _L_ to +∞. - 1. Else if _targetLen_ is *-∞*𝔽, set _L_ to 0. + 1. If _targetLen_ is *+∞*𝔽, then + 1. Set _L_ to +∞. + 1. Else if _targetLen_ is *-∞*𝔽, then + 1. Set _L_ to 0. 1. Else, 1. Let _targetLenAsInt_ be ! ToIntegerOrInfinity(_targetLen_). 1. Assert: _targetLenAsInt_ is finite. @@ -30584,7 +30902,7 @@

        Function.prototype.bind ( _thisArg_, ..._args_ )

        Function objects created using `Function.prototype.bind` are exotic objects. They also do not have a *"prototype"* property.

        -

        If _Target_ is an arrow function or a bound function exotic object then the _thisArg_ passed to this method will not be used by subsequent calls to _F_.

        +

        If _Target_ is either an arrow function or a bound function exotic object, then the _thisArg_ passed to this method will not be used by subsequent calls to _F_.

        @@ -30601,7 +30919,7 @@

        Function.prototype.call ( _thisArg_, ..._args_ )

        The _thisArg_ value is passed without modification as the *this* value. This is a change from Edition 3, where an *undefined* or *null* _thisArg_ is replaced with the global object and ToObject is applied to all other values and that result is passed as the *this* value. Even though the _thisArg_ is passed without modification, non-strict functions still perform these transformations upon entry to the function.

        -

        If _func_ is an arrow function or a bound function exotic object then the _thisArg_ will be ignored by the function [[Call]] in step .

        +

        If _func_ is either an arrow function or a bound function exotic object, then the _thisArg_ will be ignored by the function [[Call]] in step .

        @@ -30751,15 +31069,6 @@

        Properties of the Boolean Prototype Object

      • is itself a Boolean object; it has a [[BooleanData]] internal slot with the value *false*.
      • has a [[Prototype]] internal slot whose value is %Object.prototype%.
      • -

        The abstract operation thisBooleanValue takes argument _value_. It performs the following steps when called:

        - - 1. If _value_ is a Boolean, return _value_. - 1. If _value_ is an Object and _value_ has a [[BooleanData]] internal slot, then - 1. Let _b_ be _value_.[[BooleanData]]. - 1. Assert: _b_ is a Boolean. - 1. Return _b_. - 1. Throw a *TypeError* exception. -

        Boolean.prototype.constructor

        @@ -30770,7 +31079,7 @@

        Boolean.prototype.constructor

        Boolean.prototype.toString ( )

        This method performs the following steps when called:

        - 1. Let _b_ be ? thisBooleanValue(*this* value). + 1. Let _b_ be ? ThisBooleanValue(*this* value). 1. If _b_ is *true*, return *"true"*; else return *"false"*.
        @@ -30779,8 +31088,26 @@

        Boolean.prototype.toString ( )

        Boolean.prototype.valueOf ( )

        This method performs the following steps when called:

        - 1. Return ? thisBooleanValue(*this* value). + 1. Return ? ThisBooleanValue(*this* value). + + +

        + ThisBooleanValue ( + _value_: an ECMAScript language value, + ): either a normal completion containing a Boolean or a throw completion +

        +
        +
        + + 1. If _value_ is a Boolean, return _value_. + 1. If _value_ is an Object and _value_ has a [[BooleanData]] internal slot, then + 1. Let _b_ be _value_.[[BooleanData]]. + 1. Assert: _b_ is a Boolean. + 1. Return _b_. + 1. Throw a *TypeError* exception. + +
        @@ -30812,7 +31139,7 @@

        Symbol ( [ _description_ ] )

        1. If NewTarget is not *undefined*, throw a *TypeError* exception. 1. If _description_ is *undefined*, let _descString_ be *undefined*. 1. Else, let _descString_ be ? ToString(_description_). - 1. Return a new unique Symbol value whose [[Description]] value is _descString_. + 1. Return a new Symbol whose [[Description]] is _descString_.
        @@ -30827,7 +31154,7 @@

        Properties of the Symbol Constructor

        Symbol.asyncIterator

        -

        The initial value of `Symbol.asyncIterator` is the well known symbol @@asyncIterator ().

        +

        The initial value of `Symbol.asyncIterator` is the well-known symbol @@asyncIterator ().

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

        @@ -30837,13 +31164,13 @@

        Symbol.for ( _key_ )

        1. Let _stringKey_ be ? ToString(_key_). 1. For each element _e_ of the GlobalSymbolRegistry List, do - 1. If SameValue(_e_.[[Key]], _stringKey_) is *true*, return _e_.[[Symbol]]. + 1. If _e_.[[Key]] is _stringKey_, return _e_.[[Symbol]]. 1. Assert: GlobalSymbolRegistry does not currently contain an entry for _stringKey_. - 1. Let _newSymbol_ be a new unique Symbol value whose [[Description]] value is _stringKey_. + 1. Let _newSymbol_ be a new Symbol whose [[Description]] is _stringKey_. 1. Append the Record { [[Key]]: _stringKey_, [[Symbol]]: _newSymbol_ } to the GlobalSymbolRegistry List. 1. Return _newSymbol_. -

        The GlobalSymbolRegistry is a List that is globally available. It is shared by all realms. Prior to the evaluation of any ECMAScript code, it is initialized as a new empty List. Elements of the GlobalSymbolRegistry are Records with the structure defined in .

        +

        The GlobalSymbolRegistry is an append-only List that is globally available. It is shared by all realms. Prior to the evaluation of any ECMAScript code, it is initialized as a new empty List. Elements of the GlobalSymbolRegistry are Records with the structure defined in .

        @@ -30906,10 +31233,7 @@

        Symbol.keyFor ( _sym_ )

        This function performs the following steps when called:

        1. If _sym_ is not a Symbol, throw a *TypeError* exception. - 1. For each element _e_ of the GlobalSymbolRegistry List (see ), do - 1. If SameValue(_e_.[[Symbol]], _sym_) is *true*, return _e_.[[Key]]. - 1. Assert: GlobalSymbolRegistry does not currently contain an entry for _sym_. - 1. Return *undefined*. + 1. Return KeyForSymbol(_sym_). @@ -30983,15 +31307,6 @@

        Properties of the Symbol Prototype Object

      • is not a Symbol instance and does not have a [[SymbolData]] internal slot.
      • has a [[Prototype]] internal slot whose value is %Object.prototype%.
      • -

        The abstract operation thisSymbolValue takes argument _value_. It performs the following steps when called:

        - - 1. If _value_ is a Symbol, return _value_. - 1. If _value_ is an Object and _value_ has a [[SymbolData]] internal slot, then - 1. Let _s_ be _value_.[[SymbolData]]. - 1. Assert: _s_ is a Symbol. - 1. Return _s_. - 1. Throw a *TypeError* exception. -

        Symbol.prototype.constructor

        @@ -31003,7 +31318,7 @@

        get Symbol.prototype.description

        `Symbol.prototype.description` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        1. Let _s_ be the *this* value. - 1. Let _sym_ be ? thisSymbolValue(_s_). + 1. Let _sym_ be ? ThisSymbolValue(_s_). 1. Return _sym_.[[Description]].
        @@ -31012,7 +31327,7 @@

        get Symbol.prototype.description

        Symbol.prototype.toString ( )

        This method performs the following steps when called:

        - 1. Let _sym_ be ? thisSymbolValue(*this* value). + 1. Let _sym_ be ? ThisSymbolValue(*this* value). 1. Return SymbolDescriptiveString(_sym_). @@ -31037,8 +31352,26 @@

        Symbol.prototype.valueOf ( )

        This method performs the following steps when called:

        - 1. Return ? thisSymbolValue(*this* value). + 1. Return ? ThisSymbolValue(*this* value). + + +

        + ThisSymbolValue ( + _value_: an ECMAScript language value, + ): either a normal completion containing a Symbol or a throw completion +

        +
        +
        + + 1. If _value_ is a Symbol, return _value_. + 1. If _value_ is an Object and _value_ has a [[SymbolData]] internal slot, then + 1. Let _s_ be _value_.[[SymbolData]]. + 1. Assert: _s_ is a Symbol. + 1. Return _s_. + 1. Throw a *TypeError* exception. + +
        @@ -31046,7 +31379,7 @@

        Symbol.prototype [ @@toPrimitive ] ( _hint_ )

        This method is called by ECMAScript language operators to convert a Symbol object to a primitive value.

        It performs the following steps when called:

        - 1. Return ? thisSymbolValue(*this* value). + 1. Return ? ThisSymbolValue(*this* value).

        The argument is ignored.

        @@ -31066,6 +31399,28 @@

        Symbol.prototype [ @@toStringTag ]

        Properties of Symbol Instances

        Symbol instances are ordinary objects that inherit properties from the Symbol prototype object. Symbol instances have a [[SymbolData]] internal slot. The [[SymbolData]] internal slot is the Symbol value represented by this Symbol object.

        + + +

        Abstract Operations for Symbols

        + + +

        + KeyForSymbol ( + _sym_: a Symbol, + ): a String or *undefined* +

        +
        +
        description
        +
        If _sym_ is in the GlobalSymbolRegistry (see ) the String used to register _sym_ will be returned.
        +
        + + 1. For each element _e_ of the GlobalSymbolRegistry List, do + 1. If SameValue(_e_.[[Symbol]], _sym_) is *true*, return _e_.[[Key]]. + 1. Assert: GlobalSymbolRegistry does not currently contain an entry for _sym_. + 1. Return *undefined*. + +
        +
        @@ -31257,7 +31612,7 @@

        Properties of the _NativeError_ Prototype Objects

        _NativeError_.prototype.constructor

        -

        The initial value of the *"constructor"* property of the prototype for a given _NativeError_ constructor is the corresponding intrinsic object %_NativeError_% ().

        +

        The initial value of the *"constructor"* property of the prototype for a given _NativeError_ constructor is the constructor itself.

        @@ -31300,7 +31655,7 @@

        AggregateError ( _errors_, _message_ [ , _options_ ] )

        1. Let _msg_ be ? ToString(_message_). 1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"message"*, _msg_). 1. Perform ? InstallErrorCause(_O_, _options_). - 1. Let _errorsList_ be ? IterableToList(_errors_). + 1. Let _errorsList_ be ? IteratorToList(? GetIterator(_errors_, ~sync~)). 1. Perform ! DefinePropertyOrThrow(_O_, *"errors"*, PropertyDescriptor { [[Configurable]]: *true*, [[Enumerable]]: *false*, [[Writable]]: *true*, [[Value]]: CreateArrayFromList(_errorsList_) }). 1. Return _O_. @@ -31538,7 +31893,7 @@

        Number.isNaN ( _number_ )

        Number.isSafeInteger ( _number_ )

        -

        An integer _n_ is considered "safe" if and only if the Number value for _n_ is not the Number value for any other integer.

        +

        An integer _n_ is a "safe integer" if and only if the Number value for _n_ is not the Number value for any other integer.

        This function performs the following steps when called:

        @@ -31624,16 +31979,7 @@

        Properties of the Number Prototype Object

      • has a [[Prototype]] internal slot whose value is %Object.prototype%.
      • Unless explicitly stated otherwise, the methods of the Number prototype object defined below are not generic and the *this* value passed to them must be either a Number value or an object that has a [[NumberData]] internal slot that has been initialized to a Number value.

        -

        The abstract operation thisNumberValue takes argument _value_. It performs the following steps when called:

        - - 1. If _value_ is a Number, return _value_. - 1. If _value_ is an Object and _value_ has a [[NumberData]] internal slot, then - 1. Let _n_ be _value_.[[NumberData]]. - 1. Assert: _n_ is a Number. - 1. Return _n_. - 1. Throw a *TypeError* exception. - -

        The phrase “this Number value” within the specification of a method refers to the result returned by calling the abstract operation thisNumberValue with the *this* value of the method invocation passed as the argument.

        +

        The phrase “this Number value” within the specification of a method refers to the result returned by calling the abstract operation ThisNumberValue with the *this* value of the method invocation passed as the argument.

        Number.prototype.constructor

        @@ -31645,7 +31991,7 @@

        Number.prototype.toExponential ( _fractionDigits_ )

        This method returns a String containing this Number value represented in decimal exponential notation with one digit before the significand's decimal point and _fractionDigits_ digits after the significand's decimal point. If _fractionDigits_ is *undefined*, it includes as many significand digits as necessary to uniquely specify the Number (just like in ToString except that in this case the Number is always output in exponential notation).

        It performs the following steps when called:

        - 1. Let _x_ be ? thisNumberValue(*this* value). + 1. Let _x_ be ? ThisNumberValue(*this* value). 1. Let _f_ be ? ToIntegerOrInfinity(_fractionDigits_). 1. Assert: If _fractionDigits_ is *undefined*, then _f_ is 0. 1. If _x_ is not finite, return Number::toString(_x_, 10). @@ -31662,7 +32008,8 @@

        Number.prototype.toExponential ( _fractionDigits_ )

        1. If _fractionDigits_ is not *undefined*, then 1. Let _e_ and _n_ be integers such that 10_f_ ≤ _n_ < 10_f_ + 1 and for which _n_ × 10_e_ - _f_ - _x_ is as close to zero as possible. If there are two such sets of _e_ and _n_, pick the _e_ and _n_ for which _n_ × 10_e_ - _f_ is larger. 1. Else, - 1. [id="step-number-proto-toexponential-intermediate-values"] Let _e_, _n_, and _f_ be integers such that _f_ ≥ 0, 10_f_ ≤ _n_ < 10_f_ + 1, 𝔽(_n_ × 10_e_ - _f_) is 𝔽(_x_), and _f_ is as small as possible. Note that the decimal representation of _n_ has _f_ + 1 digits, _n_ is not divisible by 10, and the least significant digit of _n_ is not necessarily uniquely determined by these criteria. + 1. [id="step-number-proto-toexponential-intermediate-values"] Let _e_, _n_, and _ff_ be integers such that _ff_ ≥ 0, 10_ff_ ≤ _n_ < 10_ff_ + 1, 𝔽(_n_ × 10_e_ - _ff_) is 𝔽(_x_), and _ff_ is as small as possible. Note that the decimal representation of _n_ has _ff_ + 1 digits, _n_ is not divisible by 10, and the least significant digit of _n_ is not necessarily uniquely determined by these criteria. + 1. Set _f_ to _ff_. 1. Let _m_ be the String value consisting of the digits of the decimal representation of _n_ (in order, with no leading zeroes). 1. If _f_ ≠ 0, then 1. Let _a_ be the first code unit of _m_. @@ -31672,7 +32019,8 @@

        Number.prototype.toExponential ( _fractionDigits_ )

        1. Let _c_ be *"+"*. 1. Let _d_ be *"0"*. 1. Else, - 1. If _e_ > 0, let _c_ be *"+"*. + 1. If _e_ > 0, then + 1. Let _c_ be *"+"*. 1. Else, 1. Assert: _e_ < 0. 1. Let _c_ be *"-"*. @@ -31696,7 +32044,7 @@

        Number.prototype.toFixed ( _fractionDigits_ )

        It performs the following steps when called:

        - 1. Let _x_ be ? thisNumberValue(*this* value). + 1. Let _x_ be ? ThisNumberValue(*this* value). 1. Let _f_ be ? ToIntegerOrInfinity(_fractionDigits_). 1. Assert: If _fractionDigits_ is *undefined*, then _f_ is 0. 1. If _f_ is not finite, throw a *RangeError* exception. @@ -31744,7 +32092,7 @@

        Number.prototype.toPrecision ( _precision_ )

        This method returns a String containing this Number value represented either in decimal exponential notation with one digit before the significand's decimal point and _precision_ - 1 digits after the significand's decimal point or in decimal fixed notation with _precision_ significant digits. If _precision_ is *undefined*, it calls ToString instead.

        It performs the following steps when called:

        - 1. Let _x_ be ? thisNumberValue(*this* value). + 1. Let _x_ be ? ThisNumberValue(*this* value). 1. If _precision_ is *undefined*, return ! ToString(_x_). 1. Let _p_ be ? ToIntegerOrInfinity(_precision_). 1. If _x_ is not finite, return Number::toString(_x_, 10). @@ -31790,7 +32138,7 @@

        Number.prototype.toString ( [ _radix_ ] )

        This method performs the following steps when called:

        - 1. Let _x_ be ? thisNumberValue(*this* value). + 1. Let _x_ be ? ThisNumberValue(*this* value). 1. If _radix_ is *undefined*, let _radixMV_ be 10. 1. Else, let _radixMV_ be ? ToIntegerOrInfinity(_radix_). 1. If _radixMV_ is not in the inclusive interval from 2 to 36, throw a *RangeError* exception. @@ -31803,8 +32151,26 @@

        Number.prototype.toString ( [ _radix_ ] )

        Number.prototype.valueOf ( )

        - 1. Return ? thisNumberValue(*this* value). + 1. Return ? ThisNumberValue(*this* value). + + +

        + ThisNumberValue ( + _value_: an ECMAScript language value, + ): either a normal completion containing a Number or a throw completion +

        +
        +
        + + 1. If _value_ is a Number, return _value_. + 1. If _value_ is an Object and _value_ has a [[NumberData]] internal slot, then + 1. Let _n_ be _value_.[[NumberData]]. + 1. Assert: _n_ is a Number. + 1. Return _n_. + 1. Throw a *TypeError* exception. + +
        @@ -31847,7 +32213,7 @@

        1. If IsIntegralNumber(_number_) is *false*, throw a *RangeError* exception. - 1. Return the BigInt value that represents ℝ(_number_). + 1. Return ℤ(ℝ(_number_)). @@ -31878,7 +32244,7 @@

        BigInt.asUintN ( _bits_, _bigint_ )

        1. Set _bits_ to ? ToIndex(_bits_). 1. Set _bigint_ to ? ToBigInt(_bigint_). - 1. Return the BigInt value that represents ℝ(_bigint_) modulo 2_bits_. + 1. Return ℤ(ℝ(_bigint_) modulo 2_bits_).
        @@ -31898,15 +32264,7 @@

        Properties of the BigInt Prototype Object

      • is not a BigInt object; it does not have a [[BigIntData]] internal slot.
      • has a [[Prototype]] internal slot whose value is %Object.prototype%.
      • -

        The abstract operation thisBigIntValue takes argument _value_. It performs the following steps when called:

        - - 1. If _value_ is a BigInt, return _value_. - 1. If _value_ is an Object and _value_ has a [[BigIntData]] internal slot, then - 1. Assert: _value_.[[BigIntData]] is a BigInt. - 1. Return _value_.[[BigIntData]]. - 1. Throw a *TypeError* exception. - -

        The phrase “this BigInt value” within the specification of a method refers to the result returned by calling the abstract operation thisBigIntValue with the *this* value of the method invocation passed as the argument.

        +

        The phrase “this BigInt value” within the specification of a method refers to the result returned by calling the abstract operation ThisBigIntValue with the *this* value of the method invocation passed as the argument.

        BigInt.prototype.constructor

        @@ -31927,7 +32285,7 @@

        BigInt.prototype.toString ( [ _radix_ ] )

        This method performs the following steps when called:

        - 1. Let _x_ be ? thisBigIntValue(*this* value). + 1. Let _x_ be ? ThisBigIntValue(*this* value). 1. If _radix_ is *undefined*, let _radixMV_ be 10. 1. Else, let _radixMV_ be ? ToIntegerOrInfinity(_radix_). 1. If _radixMV_ is not in the inclusive interval from 2 to 36, throw a *RangeError* exception. @@ -31939,8 +32297,25 @@

        BigInt.prototype.toString ( [ _radix_ ] )

        BigInt.prototype.valueOf ( )

        - 1. Return ? thisBigIntValue(*this* value). + 1. Return ? ThisBigIntValue(*this* value). + + +

        + ThisBigIntValue ( + _value_: an ECMAScript language value, + ): either a normal completion containing a BigInt or a throw completion +

        +
        +
        + + 1. If _value_ is a BigInt, return _value_. + 1. If _value_ is an Object and _value_ has a [[BigIntData]] internal slot, then + 1. Assert: _value_.[[BigIntData]] is a BigInt. + 1. Return _value_.[[BigIntData]]. + 1. Throw a *TypeError* exception. + +
        @@ -31949,6 +32324,11 @@

        BigInt.prototype [ @@toStringTag ]

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        + + +

        Properties of BigInt Instances

        +

        BigInt instances are ordinary objects that inherit properties from the BigInt prototype object. BigInt instances also have a [[BigIntData]] internal slot. The [[BigIntData]] internal slot is the BigInt value represented by this BigInt object.

        +
        @@ -31972,7 +32352,7 @@

        Value Properties of the Math Object

        Math.E

        -

        The Number value for _e_, the base of the natural logarithms, which is approximately 2.7182818284590452354.

        +

        The Number value for e, the base of the natural logarithms, which is approximately 2.7182818284590452354.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

        @@ -31990,7 +32370,7 @@

        Math.LN2

        Math.LOG10E

        -

        The Number value for the base-10 logarithm of _e_, the base of the natural logarithms; this value is approximately 0.4342944819032518.

        +

        The Number value for the base-10 logarithm of e, the base of the natural logarithms; this value is approximately 0.4342944819032518.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

        The value of `Math.LOG10E` is approximately the reciprocal of the value of `Math.LN10`.

        @@ -31999,7 +32379,7 @@

        Math.LOG10E

        Math.LOG2E

        -

        The Number value for the base-2 logarithm of _e_, the base of the natural logarithms; this value is approximately 1.4426950408889634.

        +

        The Number value for the base-2 logarithm of e, the base of the natural logarithms; this value is approximately 1.4426950408889634.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

        The value of `Math.LOG2E` is approximately the reciprocal of the value of `Math.LN2`.

        @@ -32073,7 +32453,7 @@

        Math.acosh ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN* or _n_ is *+∞*𝔽, return _n_. + 1. If _n_ is either *NaN* or *+∞*𝔽, return _n_. 1. If _n_ is *1*𝔽, return *+0*𝔽. 1. If _n_ < *1*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the inverse hyperbolic cosine of ℝ(_n_). @@ -32086,7 +32466,7 @@

        Math.asin ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, or _n_ is *-0*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, or *-0*𝔽, return _n_. 1. If _n_ > *1*𝔽 or _n_ < *-1*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the inverse sine of ℝ(_n_). @@ -32109,7 +32489,7 @@

        Math.atan ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, or _n_ is *-0*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, or *-0*𝔽, return _n_. 1. If _n_ is *+∞*𝔽, return an implementation-approximated Number value representing π / 2. 1. If _n_ is *-∞*𝔽, return an implementation-approximated Number value representing -π / 2. 1. Return an implementation-approximated Number value representing the result of the inverse tangent of ℝ(_n_). @@ -32122,7 +32502,7 @@

        Math.atanh ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, or _n_ is *-0*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, or *-0*𝔽, return _n_. 1. If _n_ > *1*𝔽 or _n_ < *-1*𝔽, return *NaN*. 1. If _n_ is *1*𝔽, return *+∞*𝔽. 1. If _n_ is *-1*𝔽, return *-∞*𝔽. @@ -32156,13 +32536,19 @@

        Math.atan2 ( _y_, _x_ )

        1. If _ny_ > *+0*𝔽, then 1. If _nx_ is *+∞*𝔽, return *+0*𝔽. 1. If _nx_ is *-∞*𝔽, return an implementation-approximated Number value representing π. - 1. If _nx_ is *+0*𝔽 or _nx_ is *-0*𝔽, return an implementation-approximated Number value representing π / 2. + 1. If _nx_ is either *+0*𝔽 or *-0*𝔽, return an implementation-approximated Number value representing π / 2. 1. If _ny_ < *-0*𝔽, then 1. If _nx_ is *+∞*𝔽, return *-0*𝔽. 1. If _nx_ is *-∞*𝔽, return an implementation-approximated Number value representing -π. - 1. If _nx_ is *+0*𝔽 or _nx_ is *-0*𝔽, return an implementation-approximated Number value representing -π / 2. + 1. If _nx_ is either *+0*𝔽 or *-0*𝔽, return an implementation-approximated Number value representing -π / 2. 1. Assert: _nx_ is finite and is neither *+0*𝔽 nor *-0*𝔽. - 1. Return an implementation-approximated Number value representing the result of the inverse tangent of the quotient ℝ(_ny_) / ℝ(_nx_). + 1. Let _r_ be the inverse tangent of abs(ℝ(_ny_) / ℝ(_nx_)). + 1. If _nx_ < *-0*𝔽, then + 1. If _ny_ > *+0*𝔽, set _r_ to π - _r_. + 1. Else, set _r_ to -π + _r_. + 1. Else, + 1. If _ny_ < *-0*𝔽, set _r_ to -_r_. + 1. Return an implementation-approximated Number value representing _r_.
        @@ -32202,7 +32588,7 @@

        Math.clz32 ( _x_ )

        1. Return 𝔽(_p_). -

        If _n_ is *+0*𝔽 or _n_ is *-0*𝔽, this method returns *32*𝔽. If the most significant bit of the 32-bit binary encoding of _n_ is 1, this method returns *+0*𝔽.

        +

        If _n_ is either *+0*𝔽 or *-0*𝔽, this method returns *32*𝔽. If the most significant bit of the 32-bit binary encoding of _n_ is 1, this method returns *+0*𝔽.

        @@ -32213,7 +32599,7 @@

        Math.cos ( _x_ )

        1. Let _n_ be ? ToNumber(_x_). 1. If _n_ is not finite, return *NaN*. - 1. If _n_ is *+0*𝔽 or _n_ is *-0*𝔽, return *1*𝔽. + 1. If _n_ is either *+0*𝔽 or *-0*𝔽, return *1*𝔽. 1. Return an implementation-approximated Number value representing the result of the cosine of ℝ(_n_).
        @@ -32225,8 +32611,8 @@

        Math.cosh ( _x_ )

        1. Let _n_ be ? ToNumber(_x_). 1. If _n_ is *NaN*, return *NaN*. - 1. If _n_ is *+∞*𝔽 or _n_ is *-∞*𝔽, return *+∞*𝔽. - 1. If _n_ is *+0*𝔽 or _n_ is *-0*𝔽, return *1*𝔽. + 1. If _n_ is either *+∞*𝔽 or *-∞*𝔽, return *+∞*𝔽. + 1. If _n_ is either *+0*𝔽 or *-0*𝔽, return *1*𝔽. 1. Return an implementation-approximated Number value representing the result of the hyperbolic cosine of ℝ(_n_). @@ -32240,8 +32626,8 @@

        Math.exp ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN* or _n_ is *+∞*𝔽, return _n_. - 1. If _n_ is *+0*𝔽 or _n_ is *-0*𝔽, return *1*𝔽. + 1. If _n_ is either *NaN* or *+∞*𝔽, return _n_. + 1. If _n_ is either *+0*𝔽 or *-0*𝔽, return *1*𝔽. 1. If _n_ is *-∞*𝔽, return *+0*𝔽. 1. Return an implementation-approximated Number value representing the result of the exponential function of ℝ(_n_). @@ -32253,7 +32639,7 @@

        Math.expm1 ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, _n_ is *-0*𝔽, or _n_ is *+∞*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, *-0*𝔽, or *+∞*𝔽, return _n_. 1. If _n_ is *-∞*𝔽, return *-1*𝔽. 1. Return an implementation-approximated Number value representing the result of subtracting 1 from the exponential function of ℝ(_n_). @@ -32282,8 +32668,8 @@

        Math.fround ( _x_ )

        1. Let _n_ be ? ToNumber(_x_). 1. If _n_ is *NaN*, return *NaN*. 1. If _n_ is one of *+0*𝔽, *-0*𝔽, *+∞*𝔽, or *-∞*𝔽, return _n_. - 1. Let _n32_ be the result of converting _n_ to a value in IEEE 754-2019 binary32 format using roundTiesToEven mode. - 1. Let _n64_ be the result of converting _n32_ to a value in IEEE 754-2019 binary64 format. + 1. Let _n32_ be the result of converting _n_ to IEEE 754-2019 binary32 format using roundTiesToEven mode. + 1. Let _n64_ be the result of converting _n32_ to IEEE 754-2019 binary64 format. 1. Return the ECMAScript Number value corresponding to _n64_.
        @@ -32298,7 +32684,7 @@

        Math.hypot ( ..._args_ )

        1. Let _n_ be ? ToNumber(_arg_). 1. Append _n_ to _coerced_. 1. For each element _number_ of _coerced_, do - 1. If _number_ is *+∞*𝔽 or _number_ is *-∞*𝔽, return *+∞*𝔽. + 1. If _number_ is either *+∞*𝔽 or *-∞*𝔽, return *+∞*𝔽. 1. Let _onlyZero_ be *true*. 1. For each element _number_ of _coerced_, do 1. If _number_ is *NaN*, return *NaN*. @@ -32329,9 +32715,9 @@

        Math.log ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN* or _n_ is *+∞*𝔽, return _n_. + 1. If _n_ is either *NaN* or *+∞*𝔽, return _n_. 1. If _n_ is *1*𝔽, return *+0*𝔽. - 1. If _n_ is *+0*𝔽 or _n_ is *-0*𝔽, return *-∞*𝔽. + 1. If _n_ is either *+0*𝔽 or *-0*𝔽, return *-∞*𝔽. 1. If _n_ < *-0*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the natural logarithm of ℝ(_n_). @@ -32343,7 +32729,7 @@

        Math.log1p ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, _n_ is *-0*𝔽, or _n_ is *+∞*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, *-0*𝔽, or *+∞*𝔽, return _n_. 1. If _n_ is *-1*𝔽, return *-∞*𝔽. 1. If _n_ < *-1*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the natural logarithm of 1 + ℝ(_n_). @@ -32356,9 +32742,9 @@

        Math.log10 ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN* or _n_ is *+∞*𝔽, return _n_. + 1. If _n_ is either *NaN* or *+∞*𝔽, return _n_. 1. If _n_ is *1*𝔽, return *+0*𝔽. - 1. If _n_ is *+0*𝔽 or _n_ is *-0*𝔽, return *-∞*𝔽. + 1. If _n_ is either *+0*𝔽 or *-0*𝔽, return *-∞*𝔽. 1. If _n_ < *-0*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the base 10 logarithm of ℝ(_n_). @@ -32370,9 +32756,9 @@

        Math.log2 ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN* or _n_ is *+∞*𝔽, return _n_. + 1. If _n_ is either *NaN* or *+∞*𝔽, return _n_. 1. If _n_ is *1*𝔽, return *+0*𝔽. - 1. If _n_ is *+0*𝔽 or _n_ is *-0*𝔽, return *-∞*𝔽. + 1. If _n_ is either *+0*𝔽 or *-0*𝔽, return *-∞*𝔽. 1. If _n_ < *-0*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the base 2 logarithm of ℝ(_n_). @@ -32453,7 +32839,7 @@

        Math.round ( _x_ )

        `Math.round(3.5)` returns 4, but `Math.round(-3.5)` returns -3.

        -

        The value of `Math.round(x)` is not always the same as the value of `Math.floor(x + 0.5)`. When `x` is *-0*𝔽 or is less than *+0*𝔽 but greater than or equal to *-0.5*𝔽, `Math.round(x)` returns *-0*𝔽, but `Math.floor(x + 0.5)` returns *+0*𝔽. `Math.round(x)` may also differ from the value of `Math.floor(x + 0.5)`because of internal rounding when computing `x + 0.5`.

        +

        The value of `Math.round(x)` is not always the same as the value of `Math.floor(x + 0.5)`. When `x` is *-0*𝔽 or `x` is less than *+0*𝔽 but greater than or equal to *-0.5*𝔽, `Math.round(x)` returns *-0*𝔽, but `Math.floor(x + 0.5)` returns *+0*𝔽. `Math.round(x)` may also differ from the value of `Math.floor(x + 0.5)`because of internal rounding when computing `x + 0.5`.

        @@ -32463,7 +32849,7 @@

        Math.sign ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, or _n_ is *-0*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, or *-0*𝔽, return _n_. 1. If _n_ < *-0*𝔽, return *-1*𝔽. 1. Return *1*𝔽. @@ -32475,8 +32861,8 @@

        Math.sin ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, or _n_ is *-0*𝔽, return _n_. - 1. If _n_ is *+∞*𝔽 or _n_ is *-∞*𝔽, return *NaN*. + 1. If _n_ is one of *NaN*, *+0*𝔽, or *-0*𝔽, return _n_. + 1. If _n_ is either *+∞*𝔽 or *-∞*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the sine of ℝ(_n_). @@ -32501,7 +32887,7 @@

        Math.sqrt ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, _n_ is *-0*𝔽, or _n_ is *+∞*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, *-0*𝔽, or *+∞*𝔽, return _n_. 1. If _n_ < *-0*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the square root of ℝ(_n_). @@ -32513,8 +32899,8 @@

        Math.tan ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, or _n_ is *-0*𝔽, return _n_. - 1. If _n_ is *+∞*𝔽, or _n_ is *-∞*𝔽, return *NaN*. + 1. If _n_ is one of *NaN*, *+0*𝔽, or *-0*𝔽, return _n_. + 1. If _n_ is either *+∞*𝔽 or *-∞*𝔽, return *NaN*. 1. Return an implementation-approximated Number value representing the result of the tangent of ℝ(_n_). @@ -32525,7 +32911,7 @@

        Math.tanh ( _x_ )

        It performs the following steps when called:

        1. Let _n_ be ? ToNumber(_x_). - 1. If _n_ is *NaN*, _n_ is *+0*𝔽, or _n_ is *-0*𝔽, return _n_. + 1. If _n_ is one of *NaN*, *+0*𝔽, or *-0*𝔽, return _n_. 1. If _n_ is *+∞*𝔽, return *1*𝔽. 1. If _n_ is *-∞*𝔽, return *-1*𝔽. 1. Return an implementation-approximated Number value representing the result of the hyperbolic tangent of ℝ(_n_). @@ -32560,97 +32946,288 @@

        Overview of Date Objects and Definitions of Abstract Operations

        Time Values and Time Range

        Time measurement in ECMAScript is analogous to time measurement in POSIX, in particular sharing definition in terms of the proleptic Gregorian calendar, an epoch of midnight at the beginning of 1 January 1970 UTC, and an accounting of every day as comprising exactly 86,400 seconds (each of which is 1000 milliseconds long).

        -

        An ECMAScript time value is a Number, either a finite integral Number representing an instant in time to millisecond precision or *NaN* representing no specific instant. A time value that is a multiple of 24 × 60 × 60 × 1000 = 86,400,000 (i.e., is equal to 86,400,000 × _d_ for some integer _d_) represents the instant at the start of the UTC day that follows the epoch by _d_ whole UTC days (preceding the epoch for negative _d_). Every other finite time value _t_ is defined relative to the greatest preceding time value _s_ that is such a multiple, and represents the instant that occurs within the same UTC day as _s_ but follows it by (_t_ - _s_) milliseconds.

        +

        An ECMAScript time value is a Number, either a finite integral Number representing an instant in time to millisecond precision or *NaN* representing no specific instant. A time value that is a multiple of 24 × 60 × 60 × 1000 = 86,400,000 (i.e., is 86,400,000 × _d_ for some integer _d_) represents the instant at the start of the UTC day that follows the epoch by _d_ whole UTC days (preceding the epoch for negative _d_). Every other finite time value _t_ is defined relative to the greatest preceding time value _s_ that is such a multiple, and represents the instant that occurs within the same UTC day as _s_ but follows it by (_t_ - _s_) milliseconds.

        Time values do not account for UTC leap seconds—there are no time values representing instants within positive leap seconds, and there are time values representing instants removed from the UTC timeline by negative leap seconds. However, the definition of time values nonetheless yields piecewise alignment with UTC, with discontinuities only at leap second boundaries and zero difference outside of leap seconds.

        A Number can exactly represent all integers from -9,007,199,254,740,992 to 9,007,199,254,740,992 ( and ). A time value supports a slightly smaller range of -8,640,000,000,000,000 to 8,640,000,000,000,000 milliseconds. This yields a supported time value range of exactly -100,000,000 days to 100,000,000 days relative to midnight at the beginning of 1 January 1970 UTC.

        The exact moment of midnight at the beginning of 1 January 1970 UTC is represented by the time value *+0*𝔽.

        +

        In the proleptic Gregorian calendar, leap years are precisely those which are both divisible by 4 and either divisible by 400 or not divisible by 100.

        The 400 year cycle of the proleptic Gregorian calendar contains 97 leap years. This yields an average of 365.2425 days per year, which is 31,556,952,000 milliseconds. Therefore, the maximum range a Number could represent exactly with millisecond precision is approximately -285,426 to 285,426 years relative to 1970. The smaller range supported by a time value as specified in this section is approximately -273,790 to 273,790 years relative to 1970.

        - -

        Day Number and Time within Day

        -

        A given time value _t_ belongs to day number

        - Day(_t_) = 𝔽(floor(ℝ(_t_ / msPerDay))) -

        where the number of milliseconds per day is

        - msPerDay = *86400000*𝔽 -

        The remainder is called the time within the day:

        - TimeWithinDay(_t_) = 𝔽(ℝ(_t_) modulo ℝ(msPerDay)) -
        - - -

        Year Number

        -

        ECMAScript uses a proleptic Gregorian calendar to map a day number to a year number and to determine the month and date within that year. In this calendar, leap years are precisely those which are (divisible by 4) and ((not divisible by 100) or (divisible by 400)). The number of days in year number _y_ is therefore defined by

        - - DaysInYear(_y_) - = *365*𝔽 if (ℝ(_y_) modulo 4) ≠ 0 - = *366*𝔽 if (ℝ(_y_) modulo 4) = 0 and (ℝ(_y_) modulo 100) ≠ 0 - = *365*𝔽 if (ℝ(_y_) modulo 100) = 0 and (ℝ(_y_) modulo 400) ≠ 0 - = *366*𝔽 if (ℝ(_y_) modulo 400) = 0 - -

        All non-leap years have 365 days with the usual number of days per month and leap years have an extra day in February. The day number of the first day of year _y_ is given by:

        - DayFromYear(_y_) = 𝔽(365 × (ℝ(_y_) - 1970) + floor((ℝ(_y_) - 1969) / 4) - floor((ℝ(_y_) - 1901) / 100) + floor((ℝ(_y_) - 1601) / 400)) -

        The time value of the start of a year is:

        - TimeFromYear(_y_) = msPerDay × DayFromYear(_y_) -

        A time value determines a year by:

        - YearFromTime(_t_) = the largest integral Number _y_ (closest to +∞) such that TimeFromYear(_y_) ≤ _t_ -

        The leap-year function is *1*𝔽 for a time within a leap year and otherwise is *+0*𝔽:

        - - InLeapYear(_t_) - = *+0*𝔽 if DaysInYear(YearFromTime(_t_)) = *365*𝔽 - = *1*𝔽 if DaysInYear(YearFromTime(_t_)) = *366*𝔽 - -
        - - -

        Month Number

        -

        Months are identified by an integral Number in the inclusive interval from *+0*𝔽 to *11*𝔽. The mapping MonthFromTime(_t_) from a time value _t_ to a month number is defined by:

        - - MonthFromTime(_t_) - = *+0*𝔽 if *+0*𝔽 ≤ DayWithinYear(_t_) < *31*𝔽 - = *1*𝔽 if *31*𝔽 ≤ DayWithinYear(_t_) < *59*𝔽 + InLeapYear(_t_) - = *2*𝔽 if *59*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *90*𝔽 + InLeapYear(_t_) - = *3*𝔽 if *90*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *120*𝔽 + InLeapYear(_t_) - = *4*𝔽 if *120*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *151*𝔽 + InLeapYear(_t_) - = *5*𝔽 if *151*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *181*𝔽 + InLeapYear(_t_) - = *6*𝔽 if *181*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *212*𝔽 + InLeapYear(_t_) - = *7*𝔽 if *212*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *243*𝔽 + InLeapYear(_t_) - = *8*𝔽 if *243*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *273*𝔽 + InLeapYear(_t_) - = *9*𝔽 if *273*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *304*𝔽 + InLeapYear(_t_) - = *10*𝔽 if *304*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *334*𝔽 + InLeapYear(_t_) - = *11*𝔽 if *334*𝔽 + InLeapYear(_t_) ≤ DayWithinYear(_t_) < *365*𝔽 + InLeapYear(_t_) - -

        where

        - DayWithinYear(_t_) = Day(_t_) - DayFromYear(YearFromTime(_t_)) -

        A month value of *+0*𝔽 specifies January; *1*𝔽 specifies February; *2*𝔽 specifies March; *3*𝔽 specifies April; *4*𝔽 specifies May; *5*𝔽 specifies June; *6*𝔽 specifies July; *7*𝔽 specifies August; *8*𝔽 specifies September; *9*𝔽 specifies October; *10*𝔽 specifies November; and *11*𝔽 specifies December. Note that MonthFromTime(*+0*𝔽) = *+0*𝔽, corresponding to Thursday, 1 January 1970.

        -
        - - -

        Date Number

        -

        A date number is identified by an integral Number in the inclusive interval from *1*𝔽 to *31*𝔽. The mapping DateFromTime(_t_) from a time value _t_ to a date number is defined by:

        - - DateFromTime(_t_) - = DayWithinYear(_t_) + *1*𝔽 if MonthFromTime(_t_) = *+0*𝔽 - = DayWithinYear(_t_) - *30*𝔽 if MonthFromTime(_t_) = *1*𝔽 - = DayWithinYear(_t_) - *58*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *2*𝔽 - = DayWithinYear(_t_) - *89*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *3*𝔽 - = DayWithinYear(_t_) - *119*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *4*𝔽 - = DayWithinYear(_t_) - *150*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *5*𝔽 - = DayWithinYear(_t_) - *180*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *6*𝔽 - = DayWithinYear(_t_) - *211*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *7*𝔽 - = DayWithinYear(_t_) - *242*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *8*𝔽 - = DayWithinYear(_t_) - *272*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *9*𝔽 - = DayWithinYear(_t_) - *303*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *10*𝔽 - = DayWithinYear(_t_) - *333*𝔽 - InLeapYear(_t_) if MonthFromTime(_t_) = *11*𝔽 - -
        - - -

        Week Day

        -

        The weekday for a particular time value _t_ is defined as

        - WeekDay(_t_) = 𝔽(ℝ(Day(_t_) + *4*𝔽) modulo 7) -

        A weekday value of *+0*𝔽 specifies Sunday; *1*𝔽 specifies Monday; *2*𝔽 specifies Tuesday; *3*𝔽 specifies Wednesday; *4*𝔽 specifies Thursday; *5*𝔽 specifies Friday; and *6*𝔽 specifies Saturday. Note that WeekDay(*+0*𝔽) = *4*𝔽, corresponding to Thursday, 1 January 1970.

        + +

        Time-related Constants

        +

        These constants are referenced by algorithms in the following sections.

        + HoursPerDay = 24 + MinutesPerHour = 60 + SecondsPerMinute = 60 + msPerSecond = *1000*𝔽 + msPerMinute = *60000*𝔽 = msPerSecond × 𝔽(SecondsPerMinute) + msPerHour = *3600000*𝔽 = msPerMinute × 𝔽(MinutesPerHour) + msPerDay = *86400000*𝔽 = msPerHour × 𝔽(HoursPerDay) +
        + + +

        + Day ( + _t_: a finite time value, + ): an integral Number +

        +
        +
        description
        +
        It returns the day number of the day in which _t_ falls.
        +
        + + 1. Return 𝔽(floor(ℝ(_t_ / msPerDay))). + +
        + + +

        + TimeWithinDay ( + _t_: a finite time value, + ): an integral Number in the interval from *+0*𝔽 (inclusive) to msPerDay (exclusive) +

        +
        +
        description
        +
        It returns the number of milliseconds since the start of the day in which _t_ falls.
        +
        + + 1. Return 𝔽(ℝ(_t_) modulo ℝ(msPerDay)). + +
        + + +

        + DaysInYear ( + _y_: an integral Number, + ): *365*𝔽 or *366*𝔽 +

        +
        +
        description
        +
        It returns the number of days in year _y_. Leap years have 366 days; all other years have 365.
        +
        + + 1. Let _ry_ be ℝ(_y_). + 1. If (_ry_ modulo 400) = 0, return *366*𝔽. + 1. If (_ry_ modulo 100) = 0, return *365*𝔽. + 1. If (_ry_ modulo 4) = 0, return *366*𝔽. + 1. Return *365*𝔽. + +
        + + +

        + DayFromYear ( + _y_: an integral Number, + ): an integral Number +

        +
        +
        description
        +
        It returns the day number of the first day of year _y_.
        +
        + + 1. Let _ry_ be ℝ(_y_). + 1. [declared="numYears1,numYears4,numYears100,numYears400"] NOTE: In the following steps, _numYears1_, _numYears4_, _numYears100_, and _numYears400_ represent the number of years divisible by 1, 4, 100, and 400, respectively, that occur between the epoch and the start of year _y_. The number is negative if _y_ is before the epoch. + 1. Let _numYears1_ be (_ry_ - 1970). + 1. Let _numYears4_ be floor((_ry_ - 1969) / 4). + 1. Let _numYears100_ be floor((_ry_ - 1901) / 100). + 1. Let _numYears400_ be floor((_ry_ - 1601) / 400). + 1. Return 𝔽(365 × _numYears1_ + _numYears4_ - _numYears100_ + _numYears400_). + +
        + + +

        + TimeFromYear ( + _y_: an integral Number, + ): a time value +

        +
        +
        description
        +
        It returns the time value of the start of year _y_.
        +
        + + 1. Return msPerDay × DayFromYear(_y_). + +
        + + +

        + YearFromTime ( + _t_: a finite time value, + ): an integral Number +

        +
        +
        description
        +
        It returns the year in which _t_ falls.
        +
        + + 1. [declared="y"] Return the largest integral Number _y_ (closest to +∞) such that TimeFromYear(_y_) ≤ _t_. + +
        + + +

        + DayWithinYear ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *+0*𝔽 to *365*𝔽 +

        +
        +
        + + 1. Return Day(_t_) - DayFromYear(YearFromTime(_t_)). + +
        + + +

        + InLeapYear ( + _t_: a finite time value, + ): *+0*𝔽 or *1*𝔽 +

        +
        +
        description
        +
        It returns *1*𝔽 if _t_ is within a leap year and *+0*𝔽 otherwise.
        +
        + + 1. If DaysInYear(YearFromTime(_t_)) is *366*𝔽, return *1*𝔽; else return *+0*𝔽. + +
        + + +

        + MonthFromTime ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *+0*𝔽 to *11*𝔽 +

        +
        +
        description
        +
        It returns a Number identifying the month in which _t_ falls. A month value of *+0*𝔽 specifies January; *1*𝔽 specifies February; *2*𝔽 specifies March; *3*𝔽 specifies April; *4*𝔽 specifies May; *5*𝔽 specifies June; *6*𝔽 specifies July; *7*𝔽 specifies August; *8*𝔽 specifies September; *9*𝔽 specifies October; *10*𝔽 specifies November; and *11*𝔽 specifies December. Note that MonthFromTime(*+0*𝔽) = *+0*𝔽, corresponding to Thursday, 1 January 1970.
        +
        + + 1. Let _inLeapYear_ be InLeapYear(_t_). + 1. Let _dayWithinYear_ be DayWithinYear(_t_). + 1. If _dayWithinYear_ < *31*𝔽, return *+0*𝔽. + 1. If _dayWithinYear_ < *59*𝔽 + _inLeapYear_, return *1*𝔽. + 1. If _dayWithinYear_ < *90*𝔽 + _inLeapYear_, return *2*𝔽. + 1. If _dayWithinYear_ < *120*𝔽 + _inLeapYear_, return *3*𝔽. + 1. If _dayWithinYear_ < *151*𝔽 + _inLeapYear_, return *4*𝔽. + 1. If _dayWithinYear_ < *181*𝔽 + _inLeapYear_, return *5*𝔽. + 1. If _dayWithinYear_ < *212*𝔽 + _inLeapYear_, return *6*𝔽. + 1. If _dayWithinYear_ < *243*𝔽 + _inLeapYear_, return *7*𝔽. + 1. If _dayWithinYear_ < *273*𝔽 + _inLeapYear_, return *8*𝔽. + 1. If _dayWithinYear_ < *304*𝔽 + _inLeapYear_, return *9*𝔽. + 1. If _dayWithinYear_ < *334*𝔽 + _inLeapYear_, return *10*𝔽. + 1. Assert: _dayWithinYear_ < *365*𝔽 + _inLeapYear_. + 1. Return *11*𝔽. + +
        + + +

        + DateFromTime ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *1*𝔽 to *31*𝔽 +

        +
        +
        description
        +
        It returns the day of the month in which _t_ falls.
        +
        + + 1. Let _inLeapYear_ be InLeapYear(_t_). + 1. Let _dayWithinYear_ be DayWithinYear(_t_). + 1. Let _month_ be MonthFromTime(_t_). + 1. If _month_ is *+0*𝔽, return _dayWithinYear_ + *1*𝔽. + 1. If _month_ is *1*𝔽, return _dayWithinYear_ - *30*𝔽. + 1. If _month_ is *2*𝔽, return _dayWithinYear_ - *58*𝔽 - _inLeapYear_. + 1. If _month_ is *3*𝔽, return _dayWithinYear_ - *89*𝔽 - _inLeapYear_. + 1. If _month_ is *4*𝔽, return _dayWithinYear_ - *119*𝔽 - _inLeapYear_. + 1. If _month_ is *5*𝔽, return _dayWithinYear_ - *150*𝔽 - _inLeapYear_. + 1. If _month_ is *6*𝔽, return _dayWithinYear_ - *180*𝔽 - _inLeapYear_. + 1. If _month_ is *7*𝔽, return _dayWithinYear_ - *211*𝔽 - _inLeapYear_. + 1. If _month_ is *8*𝔽, return _dayWithinYear_ - *242*𝔽 - _inLeapYear_. + 1. If _month_ is *9*𝔽, return _dayWithinYear_ - *272*𝔽 - _inLeapYear_. + 1. If _month_ is *10*𝔽, return _dayWithinYear_ - *303*𝔽 - _inLeapYear_. + 1. Assert: _month_ is *11*𝔽. + 1. Return _dayWithinYear_ - *333*𝔽 - _inLeapYear_. + +
        + + +

        + WeekDay ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *+0*𝔽 to *6*𝔽 +

        +
        +
        description
        +
        It returns a Number identifying the day of the week in which _t_ falls. A weekday value of *+0*𝔽 specifies Sunday; *1*𝔽 specifies Monday; *2*𝔽 specifies Tuesday; *3*𝔽 specifies Wednesday; *4*𝔽 specifies Thursday; *5*𝔽 specifies Friday; and *6*𝔽 specifies Saturday. Note that WeekDay(*+0*𝔽) = *4*𝔽, corresponding to Thursday, 1 January 1970.
        +
        + + 1. Return 𝔽(ℝ(Day(_t_) + *4*𝔽) modulo 7). + +
        + + +

        + HourFromTime ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *+0*𝔽 to *23*𝔽 +

        +
        +
        description
        +
        It returns the hour of the day in which _t_ falls.
        +
        + + 1. Return 𝔽(floor(ℝ(_t_ / msPerHour)) modulo HoursPerDay). + +
        + + +

        + MinFromTime ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *+0*𝔽 to *59*𝔽 +

        +
        +
        description
        +
        It returns the minute of the hour in which _t_ falls.
        +
        + + 1. Return 𝔽(floor(ℝ(_t_ / msPerMinute)) modulo MinutesPerHour). + +
        + + +

        + SecFromTime ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *+0*𝔽 to *59*𝔽 +

        +
        +
        description
        +
        It returns the second of the minute in which _t_ falls.
        +
        + + 1. Return 𝔽(floor(ℝ(_t_ / msPerSecond)) modulo SecondsPerMinute). + +
        + + +

        + msFromTime ( + _t_: a finite time value, + ): an integral Number in the inclusive interval from *+0*𝔽 to *999*𝔽 +

        +
        +
        description
        +
        It returns the millisecond of the second in which _t_ falls.
        +
        + + 1. Return 𝔽(ℝ(_t_) modulo ℝ(msPerSecond)). +
        @@ -32680,6 +33257,32 @@

        + +

        Time Zone Identifiers

        + +

        + Time zones in ECMAScript are represented by time zone identifiers, which are Strings composed entirely of code units in the inclusive interval from 0x0000 to 0x007F. + Time zones supported by an ECMAScript implementation may be available named time zones, represented by the [[Identifier]] field of the Time Zone Identifier Records returned by AvailableNamedTimeZoneIdentifiers, or offset time zones, represented by Strings for which IsTimeZoneOffsetString returns *true*. +

        +

        + A primary time zone identifier is the preferred identifier for an available named time zone. + A non-primary time zone identifier is an identifier for an available named time zone that is not a primary time zone identifier. + An available named time zone identifier is either a primary time zone identifier or a non-primary time zone identifier. + Each available named time zone identifier is associated with exactly one available named time zone. + Each available named time zone is associated with exactly one primary time zone identifier and zero or more non-primary time zone identifiers. +

        +

        + ECMAScript implementations must support an available named time zone with the identifier *"UTC"*, which must be the primary time zone identifier for the UTC time zone. + In addition, implementations may support any number of other available named time zones. +

        +

        + Implementations that follow the requirements for time zones as described in the ECMA-402 Internationalization API specification are called time zone aware. + Time zone aware implementations must support available named time zones corresponding to the Zone and Link names of the IANA Time Zone Database, and only such names. + In time zone aware implementations, a primary time zone identifier is a Zone name, and a non-primary time zone identifier is a Link name, respectively, in the IANA Time Zone Database except as specifically overridden by AvailableNamedTimeZoneIdentifiers as specified in the ECMA-402 specification. + Implementations that do not support the entire IANA Time Zone Database are still recommended to use IANA Time Zone Database names as identifiers to represent time zones. +

        +
        +

        GetNamedTimeZoneEpochNanoseconds ( @@ -32713,7 +33316,7 @@

        1. Return « _epochNanoseconds_ ». -

        It is recommended that implementations use the time zone information of the IANA Time Zone Database https://www.iana.org/time-zones/.

        +

        It is required for time zone aware implementations (and recommended for all others) to use the time zone information of the IANA Time Zone Database https://www.iana.org/time-zones/.

        1:30 AM on 5 November 2017 in America/New_York is repeated twice, so GetNamedTimeZoneEpochNanoseconds(*"America/New_York"*, 2017, 11, 5, 1, 30, 0, 0, 0, 0) would return a List of length 2 in which the first element represents 05:30 UTC (corresponding with 01:30 US Eastern Daylight Time at UTC offset -04:00) and the second element represents 06:30 UTC (corresponding with 01:30 US Eastern Standard Time at UTC offset -05:00).

        2:30 AM on 12 March 2017 in America/New_York does not exist, so GetNamedTimeZoneEpochNanoseconds(*"America/New_York"*, 2017, 3, 12, 2, 30, 0, 0, 0, 0) would return an empty List.

        @@ -32739,26 +33342,86 @@

        - -

        DefaultTimeZone ( ): a String

        + +

        Time Zone Identifier Record

        +

        A Time Zone Identifier Record is a Record used to describe an available named time zone identifier and its corresponding primary time zone identifier.

        +

        Time Zone Identifier Records have the fields listed in .

        + +

        + + + + + + + + + + + + + + + +
        Field NameValueMeaning
        [[Identifier]]a StringAn available named time zone identifier that is supported by the implementation.
        [[PrimaryIdentifier]]a StringThe primary time zone identifier that [[Identifier]] resolves to.
        +
        + +

        If [[Identifier]] is a primary time zone identifier, then [[Identifier]] is [[PrimaryIdentifier]].

        +
        + + + +

        AvailableNamedTimeZoneIdentifiers ( ): a List of Time Zone Identifier Records

        description
        -
        It returns a String value representing the host environment's current time zone, which is either a String representing a UTC offset for which IsTimeZoneOffsetString returns *true*, or a String identifier accepted by GetNamedTimeZoneEpochNanoseconds and GetNamedTimeZoneOffsetNanoseconds.
        +
        + Its result describes all available named time zone identifiers in this implementation, as well as the primary time zone identifier corresponding to each available named time zone identifier. + The List is ordered according to the [[Identifier]] field of each Time Zone Identifier Record. +
        +

        + Time zone aware implementations, including all implementations that implement the ECMA-402 Internationalization API, must implement the AvailableNamedTimeZoneIdentifiers abstract operation as specified in the ECMA-402 specification. + For implementations that are not time zone aware, AvailableNamedTimeZoneIdentifiers performs the following steps when called: +

        + + 1. If the implementation does not include local political rules for any time zones, then + 1. Return « the Time Zone Identifier Record { [[Identifier]]: *"UTC"*, [[PrimaryIdentifier]]: *"UTC"* } ». + 1. Let _identifiers_ be the List of unique available named time zone identifiers. + 1. [declared="comparefn"] Sort _identifiers_ into the same order as if an Array of the same values had been sorted using %Array.prototype.sort% with *undefined* as _comparefn_. + 1. Let _result_ be a new empty List. + 1. For each element _identifier_ of _identifiers_, do + 1. Let _primary_ be _identifier_. + 1. If _identifier_ is a non-primary time zone identifier in this implementation and _identifier_ is not *"UTC"*, then + 1. Set _primary_ to the primary time zone identifier associated with _identifier_. + 1. NOTE: An implementation may need to resolve _identifier_ iteratively to obtain the primary time zone identifier. + 1. Let _record_ be the Time Zone Identifier Record { [[Identifier]]: _identifier_, [[PrimaryIdentifier]]: _primary_ }. + 1. Append _record_ to _result_. + 1. Assert: _result_ contains a Time Zone Identifier Record _r_ such that _r_.[[Identifier]] is *"UTC"* and _r_.[[PrimaryIdentifier]] is *"UTC"*. + 1. Return _result_. + +
        -

        An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the DefaultTimeZone abstract operation as specified in the ECMA-402 specification.

        -

        The default implementation of DefaultTimeZone, to be used for ECMAScript implementations that do not include local political rules for any time zones, performs the following steps when called:

        + +

        SystemTimeZoneIdentifier ( ): a String

        +
        +
        description
        +
        + It returns a String representing the host environment's current time zone, which is either a String representing a UTC offset for which IsTimeZoneOffsetString returns *true*, or a primary time zone identifier. +
        +
        - 1. Return *"UTC"*. + 1. If the implementation only supports the UTC time zone, return *"UTC"*. + 1. Let _systemTimeZoneString_ be the String representing the host environment's current time zone, either a primary time zone identifier or an offset time zone identifier. + 1. Return _systemTimeZoneString_.

        - To ensure the level of functionality that implementations commonly provide in the methods of the Date object, it is recommended that DefaultTimeZone return an IANA time zone name corresponding to the host environment's time zone setting, if such a thing exists. + To ensure the level of functionality that implementations commonly provide in the methods of the Date object, it is recommended that SystemTimeZoneIdentifier return an IANA time zone name corresponding to the host environment's time zone setting, if such a thing exists. GetNamedTimeZoneEpochNanoseconds and GetNamedTimeZoneOffsetNanoseconds must reflect the local political rules for standard time and daylight saving time in that time zone, if such rules exist.

        -

        For example, if the host environment is a browser on a system where the user has chosen US Eastern Time as their time zone, DefaultTimeZone returns *"America/New_York"*.

        +

        For example, if the host environment is a browser on a system where the user has chosen US Eastern Time as their time zone, SystemTimeZoneIdentifier returns *"America/New_York"*.

        @@ -32776,17 +33439,19 @@

        - 1. Let _localTimeZone_ be DefaultTimeZone(). - 1. If IsTimeZoneOffsetString(_localTimeZone_) is *true*, then - 1. Let _offsetNs_ be ParseTimeZoneOffsetString(_localTimeZone_). + 1. Let _systemTimeZoneIdentifier_ be SystemTimeZoneIdentifier(). + 1. If IsTimeZoneOffsetString(_systemTimeZoneIdentifier_) is *true*, then + 1. Let _offsetNs_ be ParseTimeZoneOffsetString(_systemTimeZoneIdentifier_). 1. Else, - 1. Let _offsetNs_ be GetNamedTimeZoneOffsetNanoseconds(_localTimeZone_, ℤ(ℝ(_t_) × 106)). + 1. Let _offsetNs_ be GetNamedTimeZoneOffsetNanoseconds(_systemTimeZoneIdentifier_, ℤ(ℝ(_t_) × 106)). 1. Let _offsetMs_ be truncate(_offsetNs_ / 106). 1. Return _t_ + 𝔽(_offsetMs_). -

        If political rules for the local time _t_ are not available within the implementation, the result is _t_ because DefaultTimeZone returns *"UTC"* and GetNamedTimeZoneOffsetNanoseconds returns 0.

        -

        It is recommended that implementations use the time zone information of the IANA Time Zone Database https://www.iana.org/time-zones/.

        +

        If political rules for the local time _t_ are not available within the implementation, the result is _t_ because SystemTimeZoneIdentifier returns *"UTC"* and GetNamedTimeZoneOffsetNanoseconds returns 0.

        +
        + +

        It is required for time zone aware implementations (and recommended for all others) to use the time zone information of the IANA Time Zone Database https://www.iana.org/time-zones/.

        Two different input time values _t_UTC are converted to the same local time tlocal at a negative time zone transition when there are repeated times (e.g. the daylight saving time ends or the time zone adjustment is decreased.).

        @@ -32808,19 +33473,20 @@

        - 1. Let _localTimeZone_ be DefaultTimeZone(). - 1. If IsTimeZoneOffsetString(_localTimeZone_) is *true*, then - 1. Let _offsetNs_ be ParseTimeZoneOffsetString(_localTimeZone_). + 1. If _t_ is not finite, return *NaN*. + 1. Let _systemTimeZoneIdentifier_ be SystemTimeZoneIdentifier(). + 1. If IsTimeZoneOffsetString(_systemTimeZoneIdentifier_) is *true*, then + 1. Let _offsetNs_ be ParseTimeZoneOffsetString(_systemTimeZoneIdentifier_). 1. Else, - 1. Let _possibleInstants_ be GetNamedTimeZoneEpochNanoseconds(_localTimeZone_, ℝ(YearFromTime(_t_)), ℝ(MonthFromTime(_t_)) + 1, ℝ(DateFromTime(_t_)), ℝ(HourFromTime(_t_)), ℝ(MinFromTime(_t_)), ℝ(SecFromTime(_t_)), ℝ(msFromTime(_t_)), 0, 0). + 1. Let _possibleInstants_ be GetNamedTimeZoneEpochNanoseconds(_systemTimeZoneIdentifier_, ℝ(YearFromTime(_t_)), ℝ(MonthFromTime(_t_)) + 1, ℝ(DateFromTime(_t_)), ℝ(HourFromTime(_t_)), ℝ(MinFromTime(_t_)), ℝ(SecFromTime(_t_)), ℝ(msFromTime(_t_)), 0, 0). 1. NOTE: The following steps ensure that when _t_ represents local time repeating multiple times at a negative time zone transition (e.g. when the daylight saving time ends or the time zone offset is decreased due to a time zone rule change) or skipped local time at a positive time zone transition (e.g. when the daylight saving time starts or the time zone offset is increased due to a time zone rule change), _t_ is interpreted using the time zone offset before the transition. 1. If _possibleInstants_ is not empty, then 1. Let _disambiguatedInstant_ be _possibleInstants_[0]. 1. Else, 1. NOTE: _t_ represents a local time skipped at a positive time zone transition (e.g. due to daylight saving time starting or a time zone rule change increasing the UTC offset). - 1. [declared="tBefore"] Let _possibleInstantsBefore_ be GetNamedTimeZoneEpochNanoseconds(_localTimeZone_, ℝ(YearFromTime(_tBefore_)), ℝ(MonthFromTime(_tBefore_)) + 1, ℝ(DateFromTime(_tBefore_)), ℝ(HourFromTime(_tBefore_)), ℝ(MinFromTime(_tBefore_)), ℝ(SecFromTime(_tBefore_)), ℝ(msFromTime(_tBefore_)), 0, 0), where _tBefore_ is the largest integral Number < _t_ for which _possibleInstantsBefore_ is not empty (i.e., _tBefore_ represents the last local time before the transition). + 1. [declared="tBefore"] Let _possibleInstantsBefore_ be GetNamedTimeZoneEpochNanoseconds(_systemTimeZoneIdentifier_, ℝ(YearFromTime(_tBefore_)), ℝ(MonthFromTime(_tBefore_)) + 1, ℝ(DateFromTime(_tBefore_)), ℝ(HourFromTime(_tBefore_)), ℝ(MinFromTime(_tBefore_)), ℝ(SecFromTime(_tBefore_)), ℝ(msFromTime(_tBefore_)), 0, 0), where _tBefore_ is the largest integral Number < _t_ for which _possibleInstantsBefore_ is not empty (i.e., _tBefore_ represents the last local time before the transition). 1. Let _disambiguatedInstant_ be the last element of _possibleInstantsBefore_. - 1. Let _offsetNs_ be GetNamedTimeZoneOffsetNanoseconds(_localTimeZone_, _disambiguatedInstant_). + 1. Let _offsetNs_ be GetNamedTimeZoneOffsetNanoseconds(_systemTimeZoneIdentifier_, _disambiguatedInstant_). 1. Let _offsetMs_ be truncate(_offsetNs_ / 106). 1. Return _t_ - 𝔽(_offsetMs_). @@ -32830,9 +33496,9 @@

        For example, the maximum time value is 8.64 × 1015, corresponding with *"+275760-09-13T00:00:00Z"*. In an environment where the local time zone offset is ahead of UTC by 1 hour at that instant, it is represented by the larger input of 8.64 × 1015 + 3.6 × 106, corresponding with *"+275760-09-13T01:00:00+01:00"*.

        -

        If political rules for the local time _t_ are not available within the implementation, the result is _t_ because DefaultTimeZone returns *"UTC"* and GetNamedTimeZoneOffsetNanoseconds returns 0.

        +

        If political rules for the local time _t_ are not available within the implementation, the result is _t_ because SystemTimeZoneIdentifier returns *"UTC"* and GetNamedTimeZoneOffsetNanoseconds returns 0.

        -

        It is recommended that implementations use the time zone information of the IANA Time Zone Database https://www.iana.org/time-zones/.

        +

        It is required for time zone aware implementations (and recommended for all others) to use the time zone information of the IANA Time Zone Database https://www.iana.org/time-zones/.

        1:30 AM on 5 November 2017 in America/New_York is repeated twice (fall backward), but it must be interpreted as 1:30 AM UTC-04 instead of 1:30 AM UTC-05. In UTC(TimeClip(MakeDate(MakeDay(2017, 10, 5), MakeTime(1, 30, 0, 0)))), the value of _offsetMs_ is -4 × msPerHour. @@ -32847,22 +33513,6 @@

        - -

        Hours, Minutes, Second, and Milliseconds

        -

        The following abstract operations are useful in decomposing time values:

        - HourFromTime(_t_) = 𝔽(floor(ℝ(_t_ / msPerHour)) modulo HoursPerDay) - MinFromTime(_t_) = 𝔽(floor(ℝ(_t_ / msPerMinute)) modulo MinutesPerHour) - SecFromTime(_t_) = 𝔽(floor(ℝ(_t_ / msPerSecond)) modulo SecondsPerMinute) - msFromTime(_t_) = 𝔽(ℝ(_t_) modulo ℝ(msPerSecond)) -

        where

        - HoursPerDay = 24 - MinutesPerHour = 60 - SecondsPerMinute = 60 - msPerSecond = *1000*𝔽 - msPerMinute = *60000*𝔽 = msPerSecond × 𝔽(SecondsPerMinute) - msPerHour = *3600000*𝔽 = msPerMinute × 𝔽(MinutesPerHour) -
        -

        MakeTime ( @@ -32877,14 +33527,16 @@

        It calculates a number of milliseconds.
        - 1. If _hour_ is not finite or _min_ is not finite or _sec_ is not finite or _ms_ is not finite, return *NaN*. + 1. If _hour_ is not finite, _min_ is not finite, _sec_ is not finite, or _ms_ is not finite, return *NaN*. 1. Let _h_ be 𝔽(! ToIntegerOrInfinity(_hour_)). 1. Let _m_ be 𝔽(! ToIntegerOrInfinity(_min_)). 1. Let _s_ be 𝔽(! ToIntegerOrInfinity(_sec_)). 1. Let _milli_ be 𝔽(! ToIntegerOrInfinity(_ms_)). - 1. Let _t_ be ((_h_ `*` msPerHour `+` _m_ `*` msPerMinute) `+` _s_ `*` msPerSecond) `+` _milli_, performing the arithmetic according to IEEE 754-2019 rules (that is, as if using the ECMAScript operators `*` and `+`). - 1. Return _t_. + 1. Return ((_h_ × msPerHour + _m_ × msPerMinute) + _s_ × msPerSecond) + _milli_. + +

        The arithmetic in MakeTime is floating-point arithmetic, which is not associative, so the operations must be performed in the correct order.

        +
        @@ -32900,14 +33552,14 @@

        It calculates a number of days.
        - 1. If _year_ is not finite or _month_ is not finite or _date_ is not finite, return *NaN*. + 1. If _year_ is not finite, _month_ is not finite, or _date_ is not finite, return *NaN*. 1. Let _y_ be 𝔽(! ToIntegerOrInfinity(_year_)). 1. Let _m_ be 𝔽(! ToIntegerOrInfinity(_month_)). 1. Let _dt_ be 𝔽(! ToIntegerOrInfinity(_date_)). 1. Let _ym_ be _y_ + 𝔽(floor(ℝ(_m_) / 12)). 1. If _ym_ is not finite, return *NaN*. 1. Let _mn_ be 𝔽(ℝ(_m_) modulo 12). - 1. Find a finite time value _t_ such that YearFromTime(_t_) is _ym_ and MonthFromTime(_t_) is _mn_ and DateFromTime(_t_) is *1*𝔽; but if this is not possible (because some argument is out of range), return *NaN*. + 1. Find a finite time value _t_ such that YearFromTime(_t_) is _ym_, MonthFromTime(_t_) is _mn_, and DateFromTime(_t_) is *1*𝔽; but if this is not possible (because some argument is out of range), return *NaN*. 1. Return Day(_t_) + _dt_ - *1*𝔽. @@ -32931,6 +33583,24 @@

        + +

        + MakeFullYear ( + _year_: a Number, + ): an integral Number or *NaN* +

        +
        +
        description
        +
        It returns the full year associated with the integer part of _year_, interpreting any value in the inclusive interval from 0 to 99 as a count of years since the start of 1900. For alignment with the proleptic Gregorian calendar, "full year" is defined as the signed count of complete years since the start of year 0 (1 B.C.).
        +
        + + 1. If _year_ is *NaN*, return *NaN*. + 1. Let _truncated_ be ! ToIntegerOrInfinity(_year_). + 1. If _truncated_ is in the inclusive interval from 0 to 99, return *1900*𝔽 + 𝔽(_truncated_). + 1. Return 𝔽(_truncated_). + +
        +

        TimeClip ( @@ -33076,7 +33746,7 @@

        Date Time String Format

        Expanded Years

        Covering the full time value range of approximately 273,790 years forward or backward from 1 January 1970 () requires representing years before 0 or after 9999. ISO 8601 permits expansion of the year representation, but only by mutual agreement of the partners in information interchange. In the simplified ECMAScript format, such an expanded year representation shall have 6 digits and is always prefixed with a + or - sign. The year 0 is considered positive and must be prefixed with a + sign. The representation of the year 0 as -000000 is invalid. Strings matching the Date Time String Format with expanded years representing instants in time outside the range of a time value are treated as unrecognizable by `Date.parse` and cause that function to return *NaN* without falling back to implementation-specific behaviour or heuristics.

        -

        Examples of date-time values with expanded years:

        +

        Examples of date-time values with expanded years:

        @@ -33265,7 +33935,7 @@

        - +

        The Date Constructor

        The Date constructor:

          @@ -33275,7 +33945,6 @@

          The Date Constructor

        • returns a String representing the current time (UTC) when called as a function rather than as a constructor.
        • is a function whose behaviour differs based upon the number and types of its arguments.
        • may be used as the value of an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified Date behaviour must include a `super` call to the Date constructor to create and initialize the subclass instance with a [[DateValue]] internal slot.
        • -
        • has a *"length"* property whose value is *7*𝔽.
        @@ -33291,7 +33960,7 @@

        Date ( ..._values_ )

        1. Else if _numberOfArgs_ = 1, then 1. Let _value_ be _values_[0]. 1. If _value_ is an Object and _value_ has a [[DateValue]] internal slot, then - 1. Let _tv_ be ! thisTimeValue(_value_). + 1. Let _tv_ be _value_.[[DateValue]]. 1. Else, 1. Let _v_ be ? ToPrimitive(_value_). 1. If _v_ is a String, then @@ -33309,10 +33978,7 @@

        Date ( ..._values_ )

        1. If _numberOfArgs_ > 4, let _min_ be ? ToNumber(_values_[4]); else let _min_ be *+0*𝔽. 1. If _numberOfArgs_ > 5, let _s_ be ? ToNumber(_values_[5]); else let _s_ be *+0*𝔽. 1. If _numberOfArgs_ > 6, let _milli_ be ? ToNumber(_values_[6]); else let _milli_ be *+0*𝔽. - 1. If _y_ is *NaN*, let _yr_ be *NaN*. - 1. Else, - 1. Let _yi_ be ! ToIntegerOrInfinity(_y_). - 1. If 0 ≤ _yi_ ≤ 99, let _yr_ be *1900*𝔽 + 𝔽(_yi_); otherwise, let _yr_ be _y_. + 1. Let _yr_ be MakeFullYear(_y_). 1. Let _finalDate_ be MakeDate(MakeDay(_yr_, _m_, _dt_), MakeTime(_h_, _min_, _s_, _milli_)). 1. Let _dv_ be TimeClip(UTC(_finalDate_)). 1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Date.prototype%"*, « [[DateValue]] »). @@ -33327,6 +33993,7 @@

        Properties of the Date Constructor

        The Date constructor:

        • has a [[Prototype]] internal slot whose value is %Function.prototype%.
        • +
        • has a *"length"* property whose value is *7*𝔽.
        • has the following properties:
        @@ -33370,10 +34037,7 @@

        Date.UTC ( _year_ [ , _month_ [ , _date_ [ , _hours_ [ , _minutes_ [ , _seco 1. If _minutes_ is present, let _min_ be ? ToNumber(_minutes_); else let _min_ be *+0*𝔽. 1. If _seconds_ is present, let _s_ be ? ToNumber(_seconds_); else let _s_ be *+0*𝔽. 1. If _ms_ is present, let _milli_ be ? ToNumber(_ms_); else let _milli_ be *+0*𝔽. - 1. If _y_ is *NaN*, let _yr_ be *NaN*. - 1. Else, - 1. Let _yi_ be ! ToIntegerOrInfinity(_y_). - 1. If 0 ≤ _yi_ ≤ 99, let _yr_ be *1900*𝔽 + 𝔽(_yi_); otherwise, let _yr_ be _y_. + 1. Let _yr_ be MakeFullYear(_y_). 1. Return TimeClip(MakeDate(MakeDay(_yr_, _m_, _dt_), MakeTime(_h_, _min_, _s_, _milli_))).

        The *"length"* property of this function is *7*𝔽.

        @@ -33393,13 +34057,6 @@

        Properties of the Date Prototype Object

      • has a [[Prototype]] internal slot whose value is %Object.prototype%.
      • Unless explicitly defined otherwise, the methods of the Date prototype object defined below are not generic and the *this* value passed to them must be an object that has a [[DateValue]] internal slot that has been initialized to a time value.

        -

        The abstract operation thisTimeValue takes argument _value_. It performs the following steps when called:

        - - 1. If _value_ is an Object and _value_ has a [[DateValue]] internal slot, then - 1. Return _value_.[[DateValue]]. - 1. Throw a *TypeError* exception. - -

        In following descriptions of functions that are properties of the Date prototype object, the phrase “this Date object” refers to the object that is the *this* value for the invocation of the function. If the Type of the *this* value is not Object, a *TypeError* exception is thrown. The phrase “this time value” within the specification of a method refers to the result returned by calling the abstract operation thisTimeValue with the *this* value of the method invocation passed as the argument.

        Date.prototype.constructor

        @@ -33410,7 +34067,9 @@

        Date.prototype.constructor

        Date.prototype.getDate ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return DateFromTime(LocalTime(_t_)). @@ -33420,7 +34079,9 @@

        Date.prototype.getDate ( )

        Date.prototype.getDay ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return WeekDay(LocalTime(_t_)). @@ -33430,7 +34091,9 @@

        Date.prototype.getDay ( )

        Date.prototype.getFullYear ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return YearFromTime(LocalTime(_t_)). @@ -33440,7 +34103,9 @@

        Date.prototype.getFullYear ( )

        Date.prototype.getHours ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return HourFromTime(LocalTime(_t_)). @@ -33450,7 +34115,9 @@

        Date.prototype.getHours ( )

        Date.prototype.getMilliseconds ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return msFromTime(LocalTime(_t_)). @@ -33460,7 +34127,9 @@

        Date.prototype.getMilliseconds ( )

        Date.prototype.getMinutes ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return MinFromTime(LocalTime(_t_)). @@ -33470,7 +34139,9 @@

        Date.prototype.getMinutes ( )

        Date.prototype.getMonth ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return MonthFromTime(LocalTime(_t_)). @@ -33480,7 +34151,9 @@

        Date.prototype.getMonth ( )

        Date.prototype.getSeconds ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return SecFromTime(LocalTime(_t_)). @@ -33490,7 +34163,9 @@

        Date.prototype.getSeconds ( )

        Date.prototype.getTime ( )

        This method performs the following steps when called:

        - 1. Return ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Return _dateObject_.[[DateValue]].
        @@ -33498,7 +34173,9 @@

        Date.prototype.getTime ( )

        Date.prototype.getTimezoneOffset ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return (_t_ - LocalTime(_t_)) / msPerMinute. @@ -33508,7 +34185,9 @@

        Date.prototype.getTimezoneOffset ( )

        Date.prototype.getUTCDate ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return DateFromTime(_t_). @@ -33518,7 +34197,9 @@

        Date.prototype.getUTCDate ( )

        Date.prototype.getUTCDay ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return WeekDay(_t_). @@ -33528,7 +34209,9 @@

        Date.prototype.getUTCDay ( )

        Date.prototype.getUTCFullYear ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return YearFromTime(_t_). @@ -33538,7 +34221,9 @@

        Date.prototype.getUTCFullYear ( )

        Date.prototype.getUTCHours ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return HourFromTime(_t_). @@ -33548,7 +34233,9 @@

        Date.prototype.getUTCHours ( )

        Date.prototype.getUTCMilliseconds ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return msFromTime(_t_). @@ -33558,7 +34245,9 @@

        Date.prototype.getUTCMilliseconds ( )

        Date.prototype.getUTCMinutes ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return MinFromTime(_t_). @@ -33568,7 +34257,9 @@

        Date.prototype.getUTCMinutes ( )

        Date.prototype.getUTCMonth ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return MonthFromTime(_t_). @@ -33578,7 +34269,9 @@

        Date.prototype.getUTCMonth ( )

        Date.prototype.getUTCSeconds ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return SecFromTime(_t_). @@ -33588,13 +34281,15 @@

        Date.prototype.getUTCSeconds ( )

        Date.prototype.setDate ( _date_ )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _dt_ be ? ToNumber(_date_). 1. If _t_ is *NaN*, return *NaN*. 1. Set _t_ to LocalTime(_t_). 1. Let _newDate_ be MakeDate(MakeDay(YearFromTime(_t_), MonthFromTime(_t_), _dt_), TimeWithinDay(_t_)). 1. Let _u_ be TimeClip(UTC(_newDate_)). - 1. Set the [[DateValue]] internal slot of this Date object to _u_. + 1. Set _dateObject_.[[DateValue]] to _u_. 1. Return _u_.
        @@ -33603,14 +34298,16 @@

        Date.prototype.setDate ( _date_ )

        Date.prototype.setFullYear ( _year_ [ , _month_ [ , _date_ ] ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _y_ be ? ToNumber(_year_). 1. If _t_ is *NaN*, set _t_ to *+0*𝔽; otherwise, set _t_ to LocalTime(_t_). 1. If _month_ is not present, let _m_ be MonthFromTime(_t_); otherwise, let _m_ be ? ToNumber(_month_). 1. If _date_ is not present, let _dt_ be DateFromTime(_t_); otherwise, let _dt_ be ? ToNumber(_date_). 1. Let _newDate_ be MakeDate(MakeDay(_y_, _m_, _dt_), TimeWithinDay(_t_)). 1. Let _u_ be TimeClip(UTC(_newDate_)). - 1. Set the [[DateValue]] internal slot of this Date object to _u_. + 1. Set _dateObject_.[[DateValue]] to _u_. 1. Return _u_.

        The *"length"* property of this method is *3*𝔽.

        @@ -33623,7 +34320,9 @@

        Date.prototype.setFullYear ( _year_ [ , _month_ [ , _date_ ] ] )

        Date.prototype.setHours ( _hour_ [ , _min_ [ , _sec_ [ , _ms_ ] ] ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _h_ be ? ToNumber(_hour_). 1. If _min_ is present, let _m_ be ? ToNumber(_min_). 1. If _sec_ is present, let _s_ be ? ToNumber(_sec_). @@ -33635,7 +34334,7 @@

        Date.prototype.setHours ( _hour_ [ , _min_ [ , _sec_ [ , _ms_ ] ] ] )

        1. If _ms_ is not present, let _milli_ be msFromTime(_t_). 1. Let _date_ be MakeDate(Day(_t_), MakeTime(_h_, _m_, _s_, _milli_)). 1. Let _u_ be TimeClip(UTC(_date_)). - 1. Set the [[DateValue]] internal slot of this Date object to _u_. + 1. Set _dateObject_.[[DateValue]] to _u_. 1. Return _u_.

        The *"length"* property of this method is *4*𝔽.

        @@ -33648,13 +34347,15 @@

        Date.prototype.setHours ( _hour_ [ , _min_ [ , _sec_ [ , _ms_ ] ] ] )

        Date.prototype.setMilliseconds ( _ms_ )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Set _ms_ to ? ToNumber(_ms_). 1. If _t_ is *NaN*, return *NaN*. 1. Set _t_ to LocalTime(_t_). 1. Let _time_ be MakeTime(HourFromTime(_t_), MinFromTime(_t_), SecFromTime(_t_), _ms_). 1. Let _u_ be TimeClip(UTC(MakeDate(Day(_t_), _time_))). - 1. Set the [[DateValue]] internal slot of this Date object to _u_. + 1. Set _dateObject_.[[DateValue]] to _u_. 1. Return _u_.
        @@ -33663,7 +34364,9 @@

        Date.prototype.setMilliseconds ( _ms_ )

        Date.prototype.setMinutes ( _min_ [ , _sec_ [ , _ms_ ] ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _m_ be ? ToNumber(_min_). 1. If _sec_ is present, let _s_ be ? ToNumber(_sec_). 1. If _ms_ is present, let _milli_ be ? ToNumber(_ms_). @@ -33673,7 +34376,7 @@

        Date.prototype.setMinutes ( _min_ [ , _sec_ [ , _ms_ ] ] )

        1. If _ms_ is not present, let _milli_ be msFromTime(_t_). 1. Let _date_ be MakeDate(Day(_t_), MakeTime(HourFromTime(_t_), _m_, _s_, _milli_)). 1. Let _u_ be TimeClip(UTC(_date_)). - 1. Set the [[DateValue]] internal slot of this Date object to _u_. + 1. Set _dateObject_.[[DateValue]] to _u_. 1. Return _u_.

        The *"length"* property of this method is *3*𝔽.

        @@ -33686,7 +34389,9 @@

        Date.prototype.setMinutes ( _min_ [ , _sec_ [ , _ms_ ] ] )

        Date.prototype.setMonth ( _month_ [ , _date_ ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _m_ be ? ToNumber(_month_). 1. If _date_ is present, let _dt_ be ? ToNumber(_date_). 1. If _t_ is *NaN*, return *NaN*. @@ -33694,7 +34399,7 @@

        Date.prototype.setMonth ( _month_ [ , _date_ ] )

        1. If _date_ is not present, let _dt_ be DateFromTime(_t_). 1. Let _newDate_ be MakeDate(MakeDay(YearFromTime(_t_), _m_, _dt_), TimeWithinDay(_t_)). 1. Let _u_ be TimeClip(UTC(_newDate_)). - 1. Set the [[DateValue]] internal slot of this Date object to _u_. + 1. Set _dateObject_.[[DateValue]] to _u_. 1. Return _u_.

        The *"length"* property of this method is *2*𝔽.

        @@ -33707,7 +34412,9 @@

        Date.prototype.setMonth ( _month_ [ , _date_ ] )

        Date.prototype.setSeconds ( _sec_ [ , _ms_ ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _s_ be ? ToNumber(_sec_). 1. If _ms_ is present, let _milli_ be ? ToNumber(_ms_). 1. If _t_ is *NaN*, return *NaN*. @@ -33715,7 +34422,7 @@

        Date.prototype.setSeconds ( _sec_ [ , _ms_ ] )

        1. If _ms_ is not present, let _milli_ be msFromTime(_t_). 1. Let _date_ be MakeDate(Day(_t_), MakeTime(HourFromTime(_t_), MinFromTime(_t_), _s_, _milli_)). 1. Let _u_ be TimeClip(UTC(_date_)). - 1. Set the [[DateValue]] internal slot of this Date object to _u_. + 1. Set _dateObject_.[[DateValue]] to _u_. 1. Return _u_.

        The *"length"* property of this method is *2*𝔽.

        @@ -33728,10 +34435,11 @@

        Date.prototype.setSeconds ( _sec_ [ , _ms_ ] )

        Date.prototype.setTime ( _time_ )

        This method performs the following steps when called:

        - 1. Perform ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). 1. Let _t_ be ? ToNumber(_time_). 1. Let _v_ be TimeClip(_t_). - 1. Set the [[DateValue]] internal slot of this Date object to _v_. + 1. Set _dateObject_.[[DateValue]] to _v_. 1. Return _v_.
        @@ -33740,12 +34448,14 @@

        Date.prototype.setTime ( _time_ )

        Date.prototype.setUTCDate ( _date_ )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _dt_ be ? ToNumber(_date_). 1. If _t_ is *NaN*, return *NaN*. 1. Let _newDate_ be MakeDate(MakeDay(YearFromTime(_t_), MonthFromTime(_t_), _dt_), TimeWithinDay(_t_)). 1. Let _v_ be TimeClip(_newDate_). - 1. Set the [[DateValue]] internal slot of this Date object to _v_. + 1. Set _dateObject_.[[DateValue]] to _v_. 1. Return _v_. @@ -33754,14 +34464,16 @@

        Date.prototype.setUTCDate ( _date_ )

        Date.prototype.setUTCFullYear ( _year_ [ , _month_ [ , _date_ ] ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, set _t_ to *+0*𝔽. 1. Let _y_ be ? ToNumber(_year_). 1. If _month_ is not present, let _m_ be MonthFromTime(_t_); otherwise, let _m_ be ? ToNumber(_month_). 1. If _date_ is not present, let _dt_ be DateFromTime(_t_); otherwise, let _dt_ be ? ToNumber(_date_). 1. Let _newDate_ be MakeDate(MakeDay(_y_, _m_, _dt_), TimeWithinDay(_t_)). 1. Let _v_ be TimeClip(_newDate_). - 1. Set the [[DateValue]] internal slot of this Date object to _v_. + 1. Set _dateObject_.[[DateValue]] to _v_. 1. Return _v_.

        The *"length"* property of this method is *3*𝔽.

        @@ -33774,7 +34486,9 @@

        Date.prototype.setUTCFullYear ( _year_ [ , _month_ [ , _date_ ] ] )

        Date.prototype.setUTCHours ( _hour_ [ , _min_ [ , _sec_ [ , _ms_ ] ] ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _h_ be ? ToNumber(_hour_). 1. If _min_ is present, let _m_ be ? ToNumber(_min_). 1. If _sec_ is present, let _s_ be ? ToNumber(_sec_). @@ -33785,7 +34499,7 @@

        Date.prototype.setUTCHours ( _hour_ [ , _min_ [ , _sec_ [ , _ms_ ] ] ] )

        The *"length"* property of this method is *4*𝔽.

        @@ -33798,12 +34512,14 @@

        Date.prototype.setUTCHours ( _hour_ [ , _min_ [ , _sec_ [ , _ms_ ] ] ] )

        Date.prototype.setUTCMilliseconds ( _ms_ )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Set _ms_ to ? ToNumber(_ms_). 1. If _t_ is *NaN*, return *NaN*. 1. Let _time_ be MakeTime(HourFromTime(_t_), MinFromTime(_t_), SecFromTime(_t_), _ms_). 1. Let _v_ be TimeClip(MakeDate(Day(_t_), _time_)). - 1. Set the [[DateValue]] internal slot of this Date object to _v_. + 1. Set _dateObject_.[[DateValue]] to _v_. 1. Return _v_. @@ -33812,7 +34528,9 @@

        Date.prototype.setUTCMilliseconds ( _ms_ )

        Date.prototype.setUTCMinutes ( _min_ [ , _sec_ [ , _ms_ ] ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _m_ be ? ToNumber(_min_). 1. If _sec_ is present, let _s_ be ? ToNumber(_sec_). 1. If _ms_ is present, let _milli_ be ? ToNumber(_ms_). @@ -33821,7 +34539,7 @@

        Date.prototype.setUTCMinutes ( _min_ [ , _sec_ [ , _ms_ ] ] )

        1. If _ms_ is not present, let _milli_ be msFromTime(_t_). 1. Let _date_ be MakeDate(Day(_t_), MakeTime(HourFromTime(_t_), _m_, _s_, _milli_)). 1. Let _v_ be TimeClip(_date_). - 1. Set the [[DateValue]] internal slot of this Date object to _v_. + 1. Set _dateObject_.[[DateValue]] to _v_. 1. Return _v_.

        The *"length"* property of this method is *3*𝔽.

        @@ -33834,14 +34552,16 @@

        Date.prototype.setUTCMinutes ( _min_ [ , _sec_ [ , _ms_ ] ] )

        Date.prototype.setUTCMonth ( _month_ [ , _date_ ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _m_ be ? ToNumber(_month_). 1. If _date_ is present, let _dt_ be ? ToNumber(_date_). 1. If _t_ is *NaN*, return *NaN*. 1. If _date_ is not present, let _dt_ be DateFromTime(_t_). 1. Let _newDate_ be MakeDate(MakeDay(YearFromTime(_t_), _m_, _dt_), TimeWithinDay(_t_)). 1. Let _v_ be TimeClip(_newDate_). - 1. Set the [[DateValue]] internal slot of this Date object to _v_. + 1. Set _dateObject_.[[DateValue]] to _v_. 1. Return _v_.

        The *"length"* property of this method is *2*𝔽.

        @@ -33854,14 +34574,16 @@

        Date.prototype.setUTCMonth ( _month_ [ , _date_ ] )

        Date.prototype.setUTCSeconds ( _sec_ [ , _ms_ ] )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _s_ be ? ToNumber(_sec_). 1. If _ms_ is present, let _milli_ be ? ToNumber(_ms_). 1. If _t_ is *NaN*, return *NaN*. 1. If _ms_ is not present, let _milli_ be msFromTime(_t_). 1. Let _date_ be MakeDate(Day(_t_), MakeTime(HourFromTime(_t_), MinFromTime(_t_), _s_, _milli_)). 1. Let _v_ be TimeClip(_date_). - 1. Set the [[DateValue]] internal slot of this Date object to _v_. + 1. Set _dateObject_.[[DateValue]] to _v_. 1. Return _v_.

        The *"length"* property of this method is *2*𝔽.

        @@ -33874,8 +34596,9 @@

        Date.prototype.setUTCSeconds ( _sec_ [ , _ms_ ] )

        Date.prototype.toDateString ( )

        This method performs the following steps when called:

        - 1. Let _O_ be this Date object. - 1. Let _tv_ be ? thisTimeValue(_O_). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _tv_ be _dateObject_.[[DateValue]]. 1. If _tv_ is *NaN*, return *"Invalid Date"*. 1. Let _t_ be LocalTime(_tv_). 1. Return DateString(_t_). @@ -33884,7 +34607,16 @@

        Date.prototype.toDateString ( )

        Date.prototype.toISOString ( )

        -

        If this time value is not a finite Number or if it corresponds with a year that cannot be represented in the Date Time String Format, this method throws a *RangeError* exception. Otherwise, it returns a String representation of this time value in that format on the UTC time scale, including all format elements and the UTC offset representation *"Z"*.

        +

        This method performs the following steps when called:

        + + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _tv_ be _dateObject_.[[DateValue]]. + 1. If _tv_ is *NaN*, throw a *RangeError* exception. + 1. Assert: _tv_ is an integral Number. + 1. If _tv_ corresponds with a year that cannot be represented in the Date Time String Format, throw a *RangeError* exception. + 1. Return a String representation of _tv_ in the Date Time String Format on the UTC time scale, including all format elements and the UTC offset representation *"Z"*. +
        @@ -33930,7 +34662,9 @@

        Date.prototype.toLocaleTimeString ( [ _reserved1_ [ , _reserved2_ ] ] )

        Date.prototype.toString ( )

        This method performs the following steps when called:

        - 1. Let _tv_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _tv_ be _dateObject_.[[DateValue]]. 1. Return ToDateString(_tv_). @@ -34160,11 +34894,11 @@

        - 1. Let _localTimeZone_ be DefaultTimeZone(). - 1. If IsTimeZoneOffsetString(_localTimeZone_) is *true*, then - 1. Let _offsetNs_ be ParseTimeZoneOffsetString(_localTimeZone_). + 1. Let _systemTimeZoneIdentifier_ be SystemTimeZoneIdentifier(). + 1. If IsTimeZoneOffsetString(_systemTimeZoneIdentifier_) is *true*, then + 1. Let _offsetNs_ be ParseTimeZoneOffsetString(_systemTimeZoneIdentifier_). 1. Else, - 1. Let _offsetNs_ be GetNamedTimeZoneOffsetNanoseconds(_localTimeZone_, ℤ(ℝ(_tv_) × 106)). + 1. Let _offsetNs_ be GetNamedTimeZoneOffsetNanoseconds(_systemTimeZoneIdentifier_, ℤ(ℝ(_tv_) × 106)). 1. Let _offset_ be 𝔽(truncate(_offsetNs_ / 106)). 1. If _offset_ is *+0*𝔽 or _offset_ > *+0*𝔽, then 1. Let _offsetSign_ be *"+"*. @@ -34199,8 +34933,9 @@

        Date.prototype.toTimeString ( )

        This method performs the following steps when called:

        - 1. Let _O_ be this Date object. - 1. Let _tv_ be ? thisTimeValue(_O_). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _tv_ be _dateObject_.[[DateValue]]. 1. If _tv_ is *NaN*, return *"Invalid Date"*. 1. Let _t_ be LocalTime(_tv_). 1. Return the string-concatenation of TimeString(_t_) and TimeZoneString(_tv_). @@ -34209,11 +34944,12 @@

        Date.prototype.toTimeString ( )

        Date.prototype.toUTCString ( )

        -

        This method returns a String value representing the instance in time corresponding to this time value. The format of the String is based upon "HTTP-date" from RFC 7231, generalized to support the full range of times supported by ECMAScript Dates.

        +

        This method returns a String value representing the instant in time corresponding to the *this* value. The format of the String is based upon "HTTP-date" from RFC 7231, generalized to support the full range of times supported by ECMAScript Dates.

        It performs the following steps when called:

        - 1. Let _O_ be this Date object. - 1. Let _tv_ be ? thisTimeValue(_O_). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _tv_ be _dateObject_.[[DateValue]]. 1. If _tv_ is *NaN*, return *"Invalid Date"*. 1. Let _weekday_ be the Name of the entry in with the Number WeekDay(_tv_). 1. Let _month_ be the Name of the entry in with the Number MonthFromTime(_tv_). @@ -34229,7 +34965,9 @@

        Date.prototype.toUTCString ( )

        Date.prototype.valueOf ( )

        This method performs the following steps when called:

        - 1. Return ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Return _dateObject_.[[DateValue]].
        @@ -34240,11 +34978,12 @@

        Date.prototype [ @@toPrimitive ] ( _hint_ )

        1. Let _O_ be the *this* value. 1. If _O_ is not an Object, throw a *TypeError* exception. - 1. If _hint_ is *"string"* or *"default"*, then + 1. If _hint_ is either *"string"* or *"default"*, then 1. Let _tryFirst_ be ~string~. 1. Else if _hint_ is *"number"*, then 1. Let _tryFirst_ be ~number~. - 1. Else, throw a *TypeError* exception. + 1. Else, + 1. Throw a *TypeError* exception. 1. Return ? OrdinaryToPrimitive(_O_, _tryFirst_).

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        @@ -34280,7 +35019,8 @@

        The String Constructor

        String ( _value_ )

        This function performs the following steps when called:

        - 1. If _value_ is not present, let _s_ be the empty String. + 1. If _value_ is not present, then + 1. Let _s_ be the empty String. 1. Else, 1. If NewTarget is *undefined* and _value_ is a Symbol, return SymbolDescriptiveString(_value_). 1. Let _s_ be ? ToString(_value_). @@ -34375,15 +35115,6 @@

        Properties of the String Prototype Object

      • has a [[Prototype]] internal slot whose value is %Object.prototype%.
      • Unless explicitly stated otherwise, the methods of the String prototype object defined below are not generic and the *this* value passed to them must be either a String value or an object that has a [[StringData]] internal slot that has been initialized to a String value.

        -

        The abstract operation thisStringValue takes argument _value_. It performs the following steps when called:

        - - 1. If _value_ is a String, return _value_. - 1. If _value_ is an Object and _value_ has a [[StringData]] internal slot, then - 1. Let _s_ be _value_.[[StringData]]. - 1. Assert: _s_ is a String. - 1. Return _s_. - 1. Throw a *TypeError* exception. -

        String.prototype.at ( _index_ )

        @@ -34443,7 +35174,7 @@

        String.prototype.charCodeAt ( _pos_ )

        String.prototype.codePointAt ( _pos_ )

        -

        This method returns a non-negative integral Number less than or equal to *0x10FFFF*𝔽 that is the numeric value of the UTF-16 encoded code point () starting at the string element at index _pos_ within the String resulting from converting this object to a String. If there is no element at that index, the result is *undefined*. If a valid UTF-16 does not begin at _pos_, the result is the code unit at _pos_.

        +

        This method returns a non-negative integral Number less than or equal to *0x10FFFF*𝔽 that is the numeric value of the UTF-16 encoded code point () starting at the string element at index _pos_ within the String resulting from converting this object to a String. If there is no element at that index, the result is *undefined*. If a valid UTF-16 surrogate pair does not begin at _pos_, the result is the code unit at _pos_.

        This method performs the following steps when called:

        @@ -34531,7 +35262,7 @@

        String.prototype.includes ( _searchString_ [ , _position_ ] )

        1. Let _len_ be the length of _S_. 1. Let _start_ be the result of clamping _pos_ between 0 and _len_. 1. Let _index_ be StringIndexOf(_S_, _searchStr_, _start_). - 1. If _index_ is not -1, return *true*. + 1. If _index_ ≠ -1, return *true*. 1. Return *false*.
        @@ -34566,6 +35297,16 @@

        String.prototype.indexOf ( _searchString_ [ , _position_ ] )

        + +

        String.prototype.isWellFormed ( )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be ? RequireObjectCoercible(*this* value). + 1. Let _S_ be ? ToString(_O_). + 1. Return IsStringWellFormedUnicode(_S_). + +
        +

        String.prototype.lastIndexOf ( _searchString_ [ , _position_ ] )

        @@ -34582,11 +35323,7 @@

        String.prototype.lastIndexOf ( _searchString_ [ , _position_ ] )

        1. Let _len_ be the length of _S_. 1. Let _searchLen_ be the length of _searchStr_. 1. Let _start_ be the result of clamping _pos_ between 0 and _len_ - _searchLen_. - 1. If _searchStr_ is the empty String, return 𝔽(_start_). - 1. For each integer _i_ such that 0 ≤ _i_ ≤ _start_, in descending order, do - 1. Let _candidate_ be the substring of _S_ from _i_ to _i_ + _searchLen_. - 1. If _candidate_ is the same sequence of code units as _searchStr_, return 𝔽(_i_). - 1. Return *-1*𝔽. + 1. Return 𝔽(StringLastIndexOf(_S_, _searchStr_, _start_)).

        This method is intentionally generic; it does not require that its *this* value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method.

        @@ -34690,7 +35427,7 @@

        String.prototype.normalize ( [ _form_ ] )

        1. If _form_ is *undefined*, let _f_ be *"NFC"*. 1. Else, let _f_ be ? ToString(_form_). 1. If _f_ is not one of *"NFC"*, *"NFD"*, *"NFKC"*, or *"NFKD"*, throw a *RangeError* exception. - 1. Let _ns_ be the String value that is the result of normalizing _S_ into the normalization form named by _f_ as specified in https://unicode.org/reports/tr15/. + 1. Let _ns_ be the String value that is the result of normalizing _S_ into the normalization form named by _f_ as specified in the latest Unicode Standard, Normalization Forms. 1. Return _ns_.
        @@ -34703,7 +35440,7 @@

        String.prototype.padEnd ( _maxLength_ [ , _fillString_ ] )

        This method performs the following steps when called:

        1. Let _O_ be ? RequireObjectCoercible(*this* value). - 1. Return ? StringPad(_O_, _maxLength_, _fillString_, ~end~). + 1. Return ? StringPaddingBuiltinsImpl(_O_, _maxLength_, _fillString_, ~end~). @@ -34712,12 +35449,12 @@

        String.prototype.padStart ( _maxLength_ [ , _fillString_ ] )

        This method performs the following steps when called:

        1. Let _O_ be ? RequireObjectCoercible(*this* value). - 1. Return ? StringPad(_O_, _maxLength_, _fillString_, ~start~). + 1. Return ? StringPaddingBuiltinsImpl(_O_, _maxLength_, _fillString_, ~start~). - +

        - StringPad ( + StringPaddingBuiltinsImpl ( _O_: an ECMAScript language value, _maxLength_: an ECMAScript language value, _fillString_: an ECMAScript language value, @@ -34731,11 +35468,29 @@

        1. Let _intMaxLength_ be ℝ(? ToLength(_maxLength_)). 1. Let _stringLength_ be the length of _S_. 1. If _intMaxLength_ ≤ _stringLength_, return _S_. - 1. If _fillString_ is *undefined*, let _filler_ be the String value consisting solely of the code unit 0x0020 (SPACE). - 1. Else, let _filler_ be ? ToString(_fillString_). - 1. If _filler_ is the empty String, return _S_. - 1. Let _fillLen_ be _intMaxLength_ - _stringLength_. - 1. Let _truncatedStringFiller_ be the String value consisting of repeated concatenations of _filler_ truncated to length _fillLen_. + 1. If _fillString_ is *undefined*, set _fillString_ to the String value consisting solely of the code unit 0x0020 (SPACE). + 1. Else, set _fillString_ to ? ToString(_fillString_). + 1. Return StringPad(_S_, _intMaxLength_, _fillString_, _placement_). + + + + +

        + StringPad ( + _S_: a String, + _maxLength_: a non-negative integer, + _fillString_: a String, + _placement_: ~start~ or ~end~, + ): a String +

        +
        +
        + + 1. Let _stringLength_ be the length of _S_. + 1. If _maxLength_ ≤ _stringLength_, return _S_. + 1. If _fillString_ is the empty String, return _S_. + 1. Let _fillLen_ be _maxLength_ - _stringLength_. + 1. Let _truncatedStringFiller_ be the String value consisting of repeated concatenations of _fillString_ truncated to length _fillLen_. 1. If _placement_ is ~start~, return the string-concatenation of _truncatedStringFiller_ and _S_. 1. Else, return the string-concatenation of _S_ and _truncatedStringFiller_. @@ -34758,7 +35513,7 @@

        1. Let _S_ be the String representation of _n_, formatted as a decimal number. - 1. Return ! StringPad(_S_, 𝔽(_minLength_), *"0"*, ~start~). + 1. Return StringPad(_S_, _minLength_, *"0"*, ~start~). @@ -34770,8 +35525,8 @@

        String.prototype.repeat ( _count_ )

        1. Let _O_ be ? RequireObjectCoercible(*this* value). 1. Let _S_ be ? ToString(_O_). 1. Let _n_ be ? ToIntegerOrInfinity(_count_). - 1. If _n_ < 0 or _n_ is +∞, throw a *RangeError* exception. - 1. If _n_ is 0, return the empty String. + 1. If _n_ < 0 or _n_ = +∞, throw a *RangeError* exception. + 1. If _n_ = 0, return the empty String. 1. Return the String value that is made from _n_ copies of _S_ appended together. @@ -34798,7 +35553,7 @@

        String.prototype.replace ( _searchValue_, _replaceValue_ )

        1. Set _replaceValue_ to ? ToString(_replaceValue_). 1. Let _searchLength_ be the length of _searchString_. 1. Let _position_ be StringIndexOf(_string_, _searchString_, 0). - 1. If _position_ is -1, return _string_. + 1. If _position_ = -1, return _string_. 1. Let _preceding_ be the substring of _string_ from 0 to _position_. 1. Let _following_ be the substring of _string_ from _position_ + _searchLength_. 1. If _functionalReplace_ is *true*, then @@ -34819,7 +35574,7 @@

        _matched_: a String, _str_: a String, _position_: a non-negative integer, - _captures_: a possibly empty List, each of whose elements is a String or *undefined*, + _captures_: a List of either Strings or *undefined*, _namedCaptures_: an Object or *undefined*, _replacementTemplate_: a String, ): either a normal completion containing a String or a throw completion @@ -34852,11 +35607,16 @@

        1. NOTE: _tailPos_ can exceed _stringLength_ only if this abstract operation was invoked by a call to the intrinsic @@replace method of %RegExp.prototype% on an object whose *"exec"* property is not the intrinsic %RegExp.prototype.exec%. 1. Else if _templateRemainder_ starts with *"$"* followed by 1 or more decimal digits, then 1. If _templateRemainder_ starts with *"$"* followed by 2 or more decimal digits, let _digitCount_ be 2. Otherwise, let _digitCount_ be 1. - 1. Let _ref_ be the substring of _templateRemainder_ from 0 to 1 + _digitCount_. 1. Let _digits_ be the substring of _templateRemainder_ from 1 to 1 + _digitCount_. 1. Let _index_ be ℝ(StringToNumber(_digits_)). 1. Assert: 0 ≤ _index_ ≤ 99. 1. Let _captureLen_ be the number of elements in _captures_. + 1. If _index_ > _captureLen_ and _digitCount_ = 2, then + 1. NOTE: When a two-digit replacement pattern specifies an index exceeding the count of capturing groups, it is treated as a one-digit replacement pattern followed by a literal digit. + 1. Set _digitCount_ to 1. + 1. Set _digits_ to the substring of _digits_ from 0 to 1. + 1. Set _index_ to ℝ(StringToNumber(_digits_)). + 1. Let _ref_ be the substring of _templateRemainder_ from 0 to 1 + _digitCount_. 1. If 1 ≤ _index_ ≤ _captureLen_, then 1. Let _capture_ be _captures_[_index_ - 1]. 1. If _capture_ is *undefined*, then @@ -34913,7 +35673,7 @@

        String.prototype.replaceAll ( _searchValue_, _replaceValue_ )

        1. Let _advanceBy_ be max(1, _searchLength_). 1. Let _matchPositions_ be a new empty List. 1. Let _position_ be StringIndexOf(_string_, _searchString_, 0). - 1. Repeat, while _position_ is not -1, + 1. Repeat, while _position_ ≠ -1, 1. Append _position_ to _matchPositions_. 1. Set _position_ to StringIndexOf(_string_, _searchString_, _position_ + _advanceBy_). 1. Let _endOfLastMatch_ be 0. @@ -34961,11 +35721,11 @@

        String.prototype.slice ( _start_, _end_ )

        1. Let _S_ be ? ToString(_O_). 1. Let _len_ be the length of _S_. 1. Let _intStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _intStart_ is -∞, let _from_ be 0. + 1. If _intStart_ = -∞, let _from_ be 0. 1. Else if _intStart_ < 0, let _from_ be max(_len_ + _intStart_, 0). 1. Else, let _from_ be min(_intStart_, _len_). 1. If _end_ is *undefined*, let _intEnd_ be _len_; else let _intEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _intEnd_ is -∞, let _to_ be 0. + 1. If _intEnd_ = -∞, let _to_ be 0. 1. Else if _intEnd_ < 0, let _to_ be max(_len_ + _intEnd_, 0). 1. Else, let _to_ be min(_intEnd_, _len_). 1. If _from_ ≥ _to_, return the empty String. @@ -34994,7 +35754,7 @@

        String.prototype.split ( _separator_, _limit_ )

        1. If _separator_ is *undefined*, then 1. Return CreateArrayFromList(« _S_ »). 1. Let _separatorLength_ be the length of _R_. - 1. If _separatorLength_ is 0, then + 1. If _separatorLength_ = 0, then 1. Let _head_ be the substring of _S_ from 0 to _lim_. 1. Let _codeUnits_ be a List consisting of the sequence of code units that are the elements of _head_. 1. Return CreateArrayFromList(_codeUnits_). @@ -35002,7 +35762,7 @@

        String.prototype.split ( _separator_, _limit_ )

        1. Let _substrings_ be a new empty List. 1. Let _i_ be 0. 1. Let _j_ be StringIndexOf(_S_, _R_, 0). - 1. Repeat, while _j_ is not -1, + 1. Repeat, while _j_ ≠ -1, 1. Let _T_ be the substring of _S_ from _i_ to _j_. 1. Append _T_ to _substrings_. 1. If the number of elements in _substrings_ is _lim_, return CreateArrayFromList(_substrings_). @@ -35056,8 +35816,8 @@

        String.prototype.startsWith ( _searchString_ [ , _position_ ] )

        String.prototype.substring ( _start_, _end_ )

        This method returns a substring of the result of converting this object to a String, starting from index _start_ and running to, but not including, index _end_ of the String (or through the end of the String if _end_ is *undefined*). The result is a String value, not a String object.

        -

        If either argument is *NaN* or negative, it is replaced with zero; if either argument is larger than the length of the String, it is replaced with the length of the String.

        -

        If _start_ is larger than _end_, they are swapped.

        +

        If either argument is *NaN* or negative, it is replaced with zero; if either argument is strictly greater than the length of the String, it is replaced with the length of the String.

        +

        If _start_ is strictly greater than _end_, they are swapped.

        It performs the following steps when called:

        1. Let _O_ be ? RequireObjectCoercible(*this* value). @@ -35123,7 +35883,7 @@

        String.prototype.toLowerCase ( )

        String.prototype.toString ( )

        This method performs the following steps when called:

        - 1. Return ? thisStringValue(*this* value). + 1. Return ? ThisStringValue(*this* value).

        For a String object, this method happens to return the same thing as the `valueOf` method.

        @@ -35139,6 +35899,27 @@

        String.prototype.toUpperCase ( )

        + +

        String.prototype.toWellFormed ( )

        +

        This method returns a String representation of this object with all leading surrogates and trailing surrogates that are not part of a surrogate pair replaced with U+FFFD (REPLACEMENT CHARACTER).

        +

        It performs the following steps when called:

        + + 1. Let _O_ be ? RequireObjectCoercible(*this* value). + 1. Let _S_ be ? ToString(_O_). + 1. Let _strLen_ be the length of _S_. + 1. Let _k_ be 0. + 1. Let _result_ be the empty String. + 1. Repeat, while _k_ < _strLen_, + 1. Let _cp_ be CodePointAt(_S_, _k_). + 1. If _cp_.[[IsUnpairedSurrogate]] is *true*, then + 1. Set _result_ to the string-concatenation of _result_ and 0xFFFD (REPLACEMENT CHARACTER). + 1. Else, + 1. Set _result_ to the string-concatenation of _result_ and UTF16EncodeCodePoint(_cp_.[[CodePoint]]). + 1. Set _k_ to _k_ + _cp_.[[CodeUnitCount]]. + 1. Return _result_. + +
        +

        String.prototype.trim ( )

        This method interprets a String value as a sequence of UTF-16 encoded code points, as described in .

        @@ -35165,8 +35946,10 @@

        1. Let _str_ be ? RequireObjectCoercible(_string_). 1. Let _S_ be ? ToString(_str_). - 1. If _where_ is ~start~, let _T_ be the String value that is a copy of _S_ with leading white space removed. - 1. Else if _where_ is ~end~, let _T_ be the String value that is a copy of _S_ with trailing white space removed. + 1. If _where_ is ~start~, then + 1. Let _T_ be the String value that is a copy of _S_ with leading white space removed. + 1. Else if _where_ is ~end~, then + 1. Let _T_ be the String value that is a copy of _S_ with trailing white space removed. 1. Else, 1. Assert: _where_ is ~start+end~. 1. Let _T_ be the String value that is a copy of _S_ with both leading and trailing white space removed. @@ -35206,8 +35989,26 @@

        String.prototype.trimStart ( )

        String.prototype.valueOf ( )

        This method performs the following steps when called:

        - 1. Return ? thisStringValue(*this* value). + 1. Return ? ThisStringValue(*this* value). + + +

        + ThisStringValue ( + _value_: an ECMAScript language value, + ): either a normal completion containing a String or a throw completion +

        +
        +
        + + 1. If _value_ is a String, return _value_. + 1. If _value_ is an Object and _value_ has a [[StringData]] internal slot, then + 1. Let _s_ be _value_.[[StringData]]. + 1. Assert: _s_ is a String. + 1. Return _s_. + 1. Throw a *TypeError* exception. + +
        @@ -35235,7 +36036,7 @@

        String.prototype [ @@iterator ] ( )

        Properties of String Instances

        -

        String instances are String exotic objects and have the internal methods specified for such objects. String instances inherit properties from the String prototype object. String instances also have a [[StringData]] internal slot.

        +

        String instances are String exotic objects and have the internal methods specified for such objects. String instances inherit properties from the String prototype object. String instances also have a [[StringData]] internal slot. The [[StringData]] internal slot is the String value represented by this String object.

        String instances have a *"length"* property, and a set of enumerable properties with integer-indexed names.

        @@ -35287,31 +36088,31 @@

        Patterns

        The RegExp constructor applies the following grammar to the input pattern String. An error occurs if the grammar cannot interpret the String as an expansion of |Pattern|.

        Syntax

        - Pattern[UnicodeMode, N] :: - Disjunction[?UnicodeMode, ?N] + Pattern[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: + Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] - Disjunction[UnicodeMode, N] :: - Alternative[?UnicodeMode, ?N] - Alternative[?UnicodeMode, ?N] `|` Disjunction[?UnicodeMode, ?N] + Disjunction[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: + Alternative[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] + Alternative[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `|` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] - Alternative[UnicodeMode, N] :: + Alternative[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: [empty] - Alternative[?UnicodeMode, ?N] Term[?UnicodeMode, ?N] + Alternative[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] Term[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] - Term[UnicodeMode, N] :: - Assertion[?UnicodeMode, ?N] - Atom[?UnicodeMode, ?N] - Atom[?UnicodeMode, ?N] Quantifier + Term[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: + Assertion[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] + Atom[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] + Atom[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] Quantifier - Assertion[UnicodeMode, N] :: + Assertion[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: `^` `$` - `\` `b` - `\` `B` - `(` `?` `=` Disjunction[?UnicodeMode, ?N] `)` - `(` `?` `!` Disjunction[?UnicodeMode, ?N] `)` - `(` `?` `<=` Disjunction[?UnicodeMode, ?N] `)` - `(` `?` `<!` Disjunction[?UnicodeMode, ?N] `)` + `\b` + `\B` + `(?=` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + `(?!` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + `(?<=` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + `(?<!` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` Quantifier :: QuantifierPrefix @@ -35322,16 +36123,16 @@

        Syntax

        `+` `?` `{` DecimalDigits[~Sep] `}` - `{` DecimalDigits[~Sep] `,` `}` + `{` DecimalDigits[~Sep] `,}` `{` DecimalDigits[~Sep] `,` DecimalDigits[~Sep] `}` - Atom[UnicodeMode, N] :: + Atom[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: PatternCharacter `.` - `\` AtomEscape[?UnicodeMode, ?N] - CharacterClass[?UnicodeMode] - `(` GroupSpecifier[?UnicodeMode]? Disjunction[?UnicodeMode, ?N] `)` - `(` `?` `:` Disjunction[?UnicodeMode, ?N] `)` + `\` AtomEscape[?UnicodeMode, ?NamedCaptureGroups] + CharacterClass[?UnicodeMode, ?UnicodeSetsMode] + `(` GroupSpecifier[?UnicodeMode]? Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + `(?:` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` SyntaxCharacter :: one of `^` `$` `\` `.` `*` `+` `?` `(` `)` `[` `]` `{` `}` `|` @@ -35339,11 +36140,11 @@

        Syntax

        PatternCharacter :: SourceCharacter but not SyntaxCharacter - AtomEscape[UnicodeMode, N] :: + AtomEscape[UnicodeMode, NamedCaptureGroups] :: DecimalEscape CharacterClassEscape[?UnicodeMode] CharacterEscape[?UnicodeMode] - [+N] `k` GroupName[?UnicodeMode] + [+NamedCaptureGroups] `k` GroupName[?UnicodeMode] CharacterEscape[UnicodeMode] :: ControlEscape @@ -35446,23 +36247,24 @@

        Syntax

        AsciiLetter `_` - CharacterClass[UnicodeMode] :: - `[` [lookahead != `^`] ClassRanges[?UnicodeMode] `]` - `[` `^` ClassRanges[?UnicodeMode] `]` + CharacterClass[UnicodeMode, UnicodeSetsMode] :: + `[` [lookahead != `^`] ClassContents[?UnicodeMode, ?UnicodeSetsMode] `]` + `[^` ClassContents[?UnicodeMode, ?UnicodeSetsMode] `]` - ClassRanges[UnicodeMode] :: + ClassContents[UnicodeMode, UnicodeSetsMode] :: [empty] - NonemptyClassRanges[?UnicodeMode] + [~UnicodeSetsMode] NonemptyClassRanges[?UnicodeMode] + [+UnicodeSetsMode] ClassSetExpression NonemptyClassRanges[UnicodeMode] :: ClassAtom[?UnicodeMode] ClassAtom[?UnicodeMode] NonemptyClassRangesNoDash[?UnicodeMode] - ClassAtom[?UnicodeMode] `-` ClassAtom[?UnicodeMode] ClassRanges[?UnicodeMode] + ClassAtom[?UnicodeMode] `-` ClassAtom[?UnicodeMode] ClassContents[?UnicodeMode, ~UnicodeSetsMode] NonemptyClassRangesNoDash[UnicodeMode] :: ClassAtom[?UnicodeMode] ClassAtomNoDash[?UnicodeMode] NonemptyClassRangesNoDash[?UnicodeMode] - ClassAtomNoDash[?UnicodeMode] `-` ClassAtom[?UnicodeMode] ClassRanges[?UnicodeMode] + ClassAtomNoDash[?UnicodeMode] `-` ClassAtom[?UnicodeMode] ClassContents[?UnicodeMode, ~UnicodeSetsMode] ClassAtom[UnicodeMode] :: `-` @@ -35477,8 +36279,80 @@

        Syntax

        [+UnicodeMode] `-` CharacterClassEscape[?UnicodeMode] CharacterEscape[?UnicodeMode] + + ClassSetExpression :: + ClassUnion + ClassIntersection + ClassSubtraction + + ClassUnion :: + ClassSetRange ClassUnion? + ClassSetOperand ClassUnion? + + ClassIntersection :: + ClassSetOperand `&&` [lookahead != `&`] ClassSetOperand + ClassIntersection `&&` [lookahead != `&`] ClassSetOperand + + ClassSubtraction :: + ClassSetOperand `--` ClassSetOperand + ClassSubtraction `--` ClassSetOperand + + ClassSetRange :: + ClassSetCharacter `-` ClassSetCharacter + + ClassSetOperand :: + NestedClass + ClassStringDisjunction + ClassSetCharacter + + NestedClass :: + `[` [lookahead != `^`] ClassContents[+UnicodeMode, +UnicodeSetsMode] `]` + `[^` ClassContents[+UnicodeMode, +UnicodeSetsMode] `]` + `\` CharacterClassEscape[+UnicodeMode]
        + +

        The first two lines here are equivalent to CharacterClass.

        +
        + + ClassStringDisjunction :: + `\q{` ClassStringDisjunctionContents `}` + + ClassStringDisjunctionContents :: + ClassString + ClassString `|` ClassStringDisjunctionContents + ClassString :: + [empty] + NonEmptyClassString + + NonEmptyClassString :: + ClassSetCharacter NonEmptyClassString? + + ClassSetCharacter :: + [lookahead ∉ ClassSetReservedDoublePunctuator] SourceCharacter but not ClassSetSyntaxCharacter + `\` CharacterEscape[+UnicodeMode] + `\` ClassSetReservedPunctuator + `\b` + + ClassSetReservedDoublePunctuator :: one of + `&&` `!!` `##` + `$$` `%%` `**` + `++` `,,` `..` + `::` `;;` `<<` + `==` `>>` `??` + `@@` `^^` ```` + `~~` + + + ClassSetSyntaxCharacter :: one of + `(` `)` `[` `]` `{` `}` `/` `-` `\` `|` + + + ClassSetReservedPunctuator :: one of + `&` `-` `!` `#` `%` `,` + `:` `;` `<` `=` `>` `@` + ``` `~` +

        A number of productions in this section are given alternative definitions in section .

        @@ -35500,7 +36374,7 @@

        Static Semantics: Early Errors

        QuantifierPrefix :: `{` DecimalDigits `,` DecimalDigits `}`
        • - It is a Syntax Error if the MV of the first |DecimalDigits| is larger than the MV of the second |DecimalDigits|. + It is a Syntax Error if the MV of the first |DecimalDigits| is strictly greater than the MV of the second |DecimalDigits|.
        AtomEscape :: `k` GroupName @@ -35512,25 +36386,25 @@

        Static Semantics: Early Errors

        AtomEscape :: DecimalEscape
        • - It is a Syntax Error if the CapturingGroupNumber of |DecimalEscape| is larger than CountLeftCapturingParensWithin(the |Pattern| containing |AtomEscape|). + It is a Syntax Error if the CapturingGroupNumber of |DecimalEscape| is strictly greater than CountLeftCapturingParensWithin(the |Pattern| containing |AtomEscape|).
        - NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassRanges + NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassContents
        • It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *true* or IsCharacterClass of the second |ClassAtom| is *true*.
        • - It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *false* and IsCharacterClass of the second |ClassAtom| is *false* and the CharacterValue of the first |ClassAtom| is larger than the CharacterValue of the second |ClassAtom|. + It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *false*, IsCharacterClass of the second |ClassAtom| is *false*, and the CharacterValue of the first |ClassAtom| is strictly greater than the CharacterValue of the second |ClassAtom|.
        - NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassRanges + NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassContents
        • It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *true* or IsCharacterClass of |ClassAtom| is *true*.
        • - It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *false* and IsCharacterClass of |ClassAtom| is *false* and the CharacterValue of |ClassAtomNoDash| is larger than the CharacterValue of |ClassAtom|. + It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *false*, IsCharacterClass of |ClassAtom| is *false*, and the CharacterValue of |ClassAtomNoDash| is strictly greater than the CharacterValue of |ClassAtom|.
        RegExpIdentifierStart :: `\` RegExpUnicodeEscapeSequence @@ -35569,7 +36443,34 @@

        Static Semantics: Early Errors

        UnicodePropertyValueExpression :: LoneUnicodePropertyNameOrValue
        • - It is a Syntax Error if the source text matched by |LoneUnicodePropertyNameOrValue| is not a Unicode property value or property value alias for the General_Category (gc) property listed in PropertyValueAliases.txt, nor a binary property or binary property alias listed in the “Property name and aliases” column of . + It is a Syntax Error if the source text matched by |LoneUnicodePropertyNameOrValue| is not a Unicode property value or property value alias for the General_Category (gc) property listed in PropertyValueAliases.txt, nor a binary property or binary property alias listed in the “Property name and aliases” column of , nor a binary property of strings listed in the “Property name” column of . +
        • +
        • + It is a Syntax Error if the enclosing |Pattern| does not have a [UnicodeSetsMode] parameter and the source text matched by |LoneUnicodePropertyNameOrValue| is a binary property of strings listed in the “Property name” column of . +
        • +
        + CharacterClassEscape :: `P{` UnicodePropertyValueExpression `}` +
          +
        • + It is a Syntax Error if MayContainStrings of the |UnicodePropertyValueExpression| is *true*. +
        • +
        + CharacterClass :: `[^` ClassContents `]` +
          +
        • + It is a Syntax Error if MayContainStrings of the |ClassContents| is *true*. +
        • +
        + NestedClass :: `[^` ClassContents `]` +
          +
        • + It is a Syntax Error if MayContainStrings of the |ClassContents| is *true*. +
        • +
        + ClassSetRange :: ClassSetCharacter `-` ClassSetCharacter +
          +
        • + It is a Syntax Error if the CharacterValue of the first |ClassSetCharacter| is strictly greater than the CharacterValue of the second |ClassSetCharacter|.
        @@ -35849,6 +36750,106 @@

        Static Semantics: CharacterValue ( ): a non-negative integer

        1. Let _ch_ be the code point matched by |IdentityEscape|. 1. Return the numeric value of _ch_.
        + ClassSetCharacter :: SourceCharacter but not ClassSetSyntaxCharacter + + 1. Let _ch_ be the code point matched by |SourceCharacter|. + 1. Return the numeric value of _ch_. + + ClassSetCharacter :: `\` ClassSetReservedPunctuator + + 1. Let _ch_ be the code point matched by |ClassSetReservedPunctuator|. + 1. Return the numeric value of _ch_. + + ClassSetCharacter :: `\b` + + 1. Return the numeric value of U+0008 (BACKSPACE). + + + + +

        Static Semantics: MayContainStrings ( ): a Boolean

        +
        +
        + + CharacterClassEscape :: + `d` + `D` + `s` + `S` + `w` + `W` + `P{` UnicodePropertyValueExpression `}` + + UnicodePropertyValueExpression :: + UnicodePropertyName `=` UnicodePropertyValue + + NestedClass :: + `[^` ClassContents `]` + + ClassContents :: + [empty] + NonemptyClassRanges + + ClassSetOperand :: + ClassSetCharacter + + + 1. Return *false*. + + UnicodePropertyValueExpression :: LoneUnicodePropertyNameOrValue + + 1. If the source text matched by |LoneUnicodePropertyNameOrValue| is a binary property of strings listed in the “Property name” column of , return *true*. + 1. Return *false*. + + ClassUnion :: ClassSetRange ClassUnion? + + 1. If the |ClassUnion| is present, return MayContainStrings of the |ClassUnion|. + 1. Return *false*. + + ClassUnion :: ClassSetOperand ClassUnion? + + 1. If MayContainStrings of the |ClassSetOperand| is *true*, return *true*. + 1. If |ClassUnion| is present, return MayContainStrings of the |ClassUnion|. + 1. Return *false*. + + ClassIntersection :: ClassSetOperand `&&` ClassSetOperand + + 1. If MayContainStrings of the first |ClassSetOperand| is *false*, return *false*. + 1. If MayContainStrings of the second |ClassSetOperand| is *false*, return *false*. + 1. Return *true*. + + ClassIntersection :: ClassIntersection `&&` ClassSetOperand + + 1. If MayContainStrings of the |ClassIntersection| is *false*, return *false*. + 1. If MayContainStrings of the |ClassSetOperand| is *false*, return *false*. + 1. Return *true*. + + ClassSubtraction :: ClassSetOperand `--` ClassSetOperand + + 1. Return MayContainStrings of the first |ClassSetOperand|. + + ClassSubtraction :: ClassSubtraction `--` ClassSetOperand + + 1. Return MayContainStrings of the |ClassSubtraction|. + + ClassStringDisjunctionContents :: ClassString `|` ClassStringDisjunctionContents + + 1. If MayContainStrings of the |ClassString| is *true*, return *true*. + 1. Return MayContainStrings of the |ClassStringDisjunctionContents|. + + ClassString :: [empty] + + 1. Return *true*. + + ClassString :: NonEmptyClassString + + 1. Return MayContainStrings of the |NonEmptyClassString|. + + NonEmptyClassString :: ClassSetCharacter NonEmptyClassString? + + 1. If |NonEmptyClassString| is present, return *true*. + 1. Return *false*. +
        @@ -35864,7 +36865,7 @@

        1. Let _pattern_ be the |Pattern| containing _thisGroupName_. 1. Let _result_ be a new empty List. 1. For each |GroupSpecifier| _gs_ that _pattern_ contains, do - 1. If the CapturingGroupName of _gs_ is the same value as _name_, then + 1. If the CapturingGroupName of _gs_ is _name_, then 1. Append _gs_ to _result_. 1. Return _result_. @@ -35926,8 +36927,8 @@

        Static Semantics: RegExpIdentifierCodePoint ( ): a code point

        RegExpIdentifierPart :: UnicodeLeadSurrogate UnicodeTrailSurrogate - 1. Let _lead_ be the code unit whose numeric value is that of the code point matched by |UnicodeLeadSurrogate|. - 1. Let _trail_ be the code unit whose numeric value is that of the code point matched by |UnicodeTrailSurrogate|. + 1. Let _lead_ be the code unit whose numeric value is the numeric value of the code point matched by |UnicodeLeadSurrogate|. + 1. Let _trail_ be the code unit whose numeric value is the numeric value of the code point matched by |UnicodeTrailSurrogate|. 1. Return UTF16SurrogatePairToCodePoint(_lead_, _trail_).
        @@ -35936,7 +36937,7 @@

        Static Semantics: RegExpIdentifierCodePoint ( ): a code point

        Pattern Semantics

        A regular expression pattern is converted into an Abstract Closure using the process described below. An implementation is encouraged to use more efficient algorithms than the ones listed below, as long as the results are the same. The Abstract Closure is used as the value of a RegExp object's [[RegExpMatcher]] internal slot.

        -

        A |Pattern| is either a BMP pattern or a Unicode pattern depending upon whether or not its associated flags contain a `u`. A BMP pattern matches against a String interpreted as consisting of a sequence of 16-bit values that are Unicode code points in the range of the Basic Multilingual Plane. A Unicode pattern matches against a String interpreted as consisting of Unicode code points encoded using UTF-16. In the context of describing the behaviour of a BMP pattern “character” means a single 16-bit Unicode BMP code point. In the context of describing the behaviour of a Unicode pattern “character” means a UTF-16 encoded code point (). In either context, “character value” means the numeric value of the corresponding non-encoded code point.

        +

        A |Pattern| is a BMP pattern if its associated flags contain neither a `u` nor a `v`. Otherwise, it is a Unicode pattern. A BMP pattern matches against a String interpreted as consisting of a sequence of 16-bit values that are Unicode code points in the range of the Basic Multilingual Plane. A Unicode pattern matches against a String interpreted as consisting of Unicode code points encoded using UTF-16. In the context of describing the behaviour of a BMP pattern “character” means a single 16-bit Unicode BMP code point. In the context of describing the behaviour of a Unicode pattern “character” means a UTF-16 encoded code point (). In either context, “character value” means the numeric value of the corresponding non-encoded code point.

        The syntax and semantics of |Pattern| is defined as if the source text for the |Pattern| was a List of |SourceCharacter| values where each |SourceCharacter| corresponds to a Unicode code point. If a BMP pattern contains a non-BMP |SourceCharacter| the entire pattern is encoded using UTF-16 and the individual code units of that encoding are used as the elements of the List.

        For example, consider a pattern expressed in source text as the single non-BMP character U+1D11E (MUSICAL SYMBOL G CLEF). Interpreted as a Unicode pattern, it would be a single element (character) List consisting of the single code point U+1D11E. However, interpreted as a BMP pattern, it is first UTF-16 encoded to produce a two element List consisting of the code units 0xD834 and 0xDD1E.

        @@ -35949,13 +36950,24 @@

        Notation

        The descriptions below use the following internal data structures:

        • - A CharSet is a mathematical set of characters. In the context of a Unicode pattern, “all characters” means the CharSet containing all code point values; otherwise “all characters” means the CharSet containing all code unit values. + A CharSetElement is one of the two following entities: +
            +
          • + If _rer_.[[UnicodeSets]] is *false*, then a CharSetElement is a character in the sense of the Pattern Semantics above. +
          • +
          • + If _rer_.[[UnicodeSets]] is *true*, then a CharSetElement is a sequence whose elements are characters in the sense of the Pattern Semantics above. This includes the empty sequence, sequences of one character, and sequences of more than one character. For convenience, when working with CharSetElements of this kind, an individual character is treated interchangeably with a sequence of one character. +
          • +
          +
        • +
        • + A CharSet is a mathematical set of CharSetElements.
        • - A CaptureRange is an ordered pair (_startIndex_, _endIndex_) that represents the range of characters included in a capture, where _startIndex_ is an integer representing the start index (inclusive) of the range within _Input_, and _endIndex_ is an integer representing the end index (exclusive) of the range within _Input_. For any CaptureRange, these indices must satisfy the invariant that _startIndex_ ≤ _endIndex_. + A CaptureRange is a Record { [[StartIndex]], [[EndIndex]] } that represents the range of characters included in a capture, where [[StartIndex]] is an integer representing the start index (inclusive) of the range within _Input_, and [[EndIndex]] is an integer representing the end index (exclusive) of the range within _Input_. For any CaptureRange, these indices must satisfy the invariant that [[StartIndex]] ≤ [[EndIndex]].
        • - A MatchState is an ordered triple (_input_, _endIndex_, _captures_) where _input_ is a List of characters representing the String being matched, _endIndex_ is an integer, and _captures_ is a List of values, one for each left-capturing parenthesis in the pattern. States are used to represent partial match states in the regular expression matching algorithms. The _endIndex_ is one plus the index of the last input character matched so far by the pattern, while _captures_ holds the results of capturing parentheses. The _n_th element of _captures_ is either a CaptureRange representing the range of characters captured by the _n_th set of capturing parentheses, or *undefined* if the _n_th set of capturing parentheses hasn't been reached yet. Due to backtracking, many States may be in use at any time during the matching process. + A MatchState is a Record { [[Input]], [[EndIndex]], [[Captures]] } where [[Input]] is a List of characters representing the String being matched, [[EndIndex]] is an integer, and [[Captures]] is a List of values, one for each left-capturing parenthesis in the pattern. States are used to represent partial match states in the regular expression matching algorithms. The [[EndIndex]] is one plus the index of the last input character matched so far by the pattern, while [[Captures]] holds the results of capturing parentheses. The _n_th element of [[Captures]] is either a CaptureRange representing the range of characters captured by the _n_th set of capturing parentheses, or *undefined* if the _n_th set of capturing parentheses hasn't been reached yet. Due to backtracking, many States may be in use at any time during the matching process.
        • A MatchResult is either a MatchState or the special token ~failure~ that indicates that the match failed. @@ -35964,7 +36976,7 @@

          Notation

          A MatcherContinuation is an Abstract Closure that takes one MatchState argument and returns a MatchResult result. The MatcherContinuation attempts to match the remaining portion (specified by the closure's captured values) of the pattern against _Input_, starting at the intermediate state given by its MatchState argument. If the match succeeds, the MatcherContinuation returns the final MatchState that it reached; if the match fails, the MatcherContinuation returns ~failure~.
        • - A Matcher is an Abstract Closure that takes two arguments—a MatchState and a MatcherContinuation—and returns a MatchResult result. A Matcher attempts to match a middle subpattern (specified by the closure's captured values) of the pattern against the MatchState's _input_, starting at the intermediate state given by its MatchState argument. The MatcherContinuation argument should be a closure that matches the rest of the pattern. After matching the subpattern of a pattern to obtain a new MatchState, the Matcher then calls MatcherContinuation on that new MatchState to test if the rest of the pattern can match as well. If it can, the Matcher returns the MatchState returned by MatcherContinuation; if not, the Matcher may try different choices at its choice points, repeatedly calling MatcherContinuation until it either succeeds or all possibilities have been exhausted. + A Matcher is an Abstract Closure that takes two arguments—a MatchState and a MatcherContinuation—and returns a MatchResult result. A Matcher attempts to match a middle subpattern (specified by the closure's captured values) of the pattern against the MatchState's [[Input]], starting at the intermediate state given by its MatchState argument. The MatcherContinuation argument should be a closure that matches the rest of the pattern. After matching the subpattern of a pattern to obtain a new MatchState, the Matcher then calls MatcherContinuation on that new MatchState to test if the rest of the pattern can match as well. If it can, the Matcher returns the MatchState returned by MatcherContinuation; if not, the Matcher may try different choices at its choice points, repeatedly calling MatcherContinuation until it either succeeds or all possibilities have been exhausted.
        @@ -35999,6 +37011,11 @@

        RegExp Records

        + + + + + @@ -36022,12 +37039,12 @@

        1. Let _m_ be CompileSubpattern of |Disjunction| with arguments _rer_ and ~forward~. 1. Return a new Abstract Closure with parameters (_Input_, _index_) that captures _rer_ and _m_ and performs the following steps when called: 1. Assert: _Input_ is a List of characters. - 1. Assert: _index_ is a non-negative integer which is ≤ the number of elements in _Input_. + 1. Assert: 0 ≤ _index_ ≤ the number of elements in _Input_. 1. Let _c_ be a new MatcherContinuation with parameters (_y_) that captures nothing and performs the following steps when called: 1. Assert: _y_ is a MatchState. 1. Return _y_. 1. Let _cap_ be a List of _rer_.[[CapturingGroupsCount]] *undefined* values, indexed 1 through _rer_.[[CapturingGroupsCount]]. - 1. Let _x_ be the MatchState (_Input_, _index_, _cap_). + 1. Let _x_ be the MatchState { [[Input]]: _Input_, [[EndIndex]]: _index_, [[Captures]]: _cap_ }. 1. Return _m_(_x_, _c_). @@ -36053,12 +37070,7 @@

        1. Let _m1_ be CompileSubpattern of |Alternative| with arguments _rer_ and _direction_. 1. Let _m2_ be CompileSubpattern of |Disjunction| with arguments _rer_ and _direction_. - 1. Return a new Matcher with parameters (_x_, _c_) that captures _m1_ and _m2_ and performs the following steps when called: - 1. Assert: _x_ is a MatchState. - 1. Assert: _c_ is a MatcherContinuation. - 1. Let _r_ be _m1_(_x_, _c_). - 1. If _r_ is not ~failure~, return _r_. - 1. Return _m2_(_x_, _c_). + 1. Return MatchTwoAlternatives(_m1_, _m2_).

        The `|` regular expression operator separates two alternatives. The pattern first tries to match the left |Alternative| (followed by the sequel of the regular expression); if it fails, it tries to match the right |Disjunction| (followed by the sequel of the regular expression). If the left |Alternative|, the right |Disjunction|, and the sequel all have choice points, all choices in the sequel are tried before moving on to the next choice in the left |Alternative|. If choices in the left |Alternative| are exhausted, the right |Disjunction| is tried instead of the left |Alternative|. Any capturing parentheses inside a portion of the pattern skipped by `|` produce *undefined* values instead of Strings. Thus, for example,

        @@ -36075,32 +37087,13 @@

        Alternative :: [empty] - 1. Return a new Matcher with parameters (_x_, _c_) that captures nothing and performs the following steps when called: - 1. Assert: _x_ is a MatchState. - 1. Assert: _c_ is a MatcherContinuation. - 1. Return _c_(_x_). + 1. Return EmptyMatcher(). Alternative :: Alternative Term 1. Let _m1_ be CompileSubpattern of |Alternative| with arguments _rer_ and _direction_. 1. Let _m2_ be CompileSubpattern of |Term| with arguments _rer_ and _direction_. - 1. If _direction_ is ~forward~, then - 1. Return a new Matcher with parameters (_x_, _c_) that captures _m1_ and _m2_ and performs the following steps when called: - 1. Assert: _x_ is a MatchState. - 1. Assert: _c_ is a MatcherContinuation. - 1. Let _d_ be a new MatcherContinuation with parameters (_y_) that captures _c_ and _m2_ and performs the following steps when called: - 1. Assert: _y_ is a MatchState. - 1. Return _m2_(_y_, _c_). - 1. Return _m1_(_x_, _d_). - 1. Else, - 1. Assert: _direction_ is ~backward~. - 1. Return a new Matcher with parameters (_x_, _c_) that captures _m1_ and _m2_ and performs the following steps when called: - 1. Assert: _x_ is a MatchState. - 1. Assert: _c_ is a MatcherContinuation. - 1. Let _d_ be a new MatcherContinuation with parameters (_y_) that captures _c_ and _m1_ and performs the following steps when called: - 1. Assert: _y_ is a MatchState. - 1. Return _m1_(_y_, _c_). - 1. Return _m2_(_x_, _d_). + 1. Return MatchSequence(_m1_, _m2_, _direction_).

        Consecutive |Term|s try to simultaneously match consecutive portions of _Input_. When _direction_ is ~forward~, if the left |Alternative|, the right |Term|, and the sequel of the regular expression all have choice points, all choices in the sequel are tried before moving on to the next choice in the right |Term|, and all choices in the right |Term| are tried before moving on to the next choice in the left |Alternative|. When _direction_ is ~backward~, the evaluation order of |Alternative| and |Term| are reversed.

        @@ -36150,15 +37143,15 @@

        1. If _max_ = 0, return _c_(_x_). 1. Let _d_ be a new MatcherContinuation with parameters (_y_) that captures _m_, _min_, _max_, _greedy_, _x_, _c_, _parenIndex_, and _parenCount_ and performs the following steps when called: 1. Assert: _y_ is a MatchState. - 1. [id="step-repeatmatcher-done"] If _min_ = 0 and _y_'s _endIndex_ = _x_'s _endIndex_, return ~failure~. + 1. [id="step-repeatmatcher-done"] If _min_ = 0 and _y_.[[EndIndex]] = _x_.[[EndIndex]], return ~failure~. 1. If _min_ = 0, let _min2_ be 0; otherwise let _min2_ be _min_ - 1. - 1. If _max_ is +∞, let _max2_ be +∞; otherwise let _max2_ be _max_ - 1. + 1. If _max_ = +∞, let _max2_ be +∞; otherwise let _max2_ be _max_ - 1. 1. Return RepeatMatcher(_m_, _min2_, _max2_, _greedy_, _y_, _c_, _parenIndex_, _parenCount_). - 1. Let _cap_ be a copy of _x_'s _captures_ List. + 1. Let _cap_ be a copy of _x_.[[Captures]]. 1. [id="step-repeatmatcher-clear-captures"] For each integer _k_ in the inclusive interval from _parenIndex_ + 1 to _parenIndex_ + _parenCount_, set _cap_[_k_] to *undefined*. - 1. Let _Input_ be _x_'s _input_. - 1. Let _e_ be _x_'s _endIndex_. - 1. Let _xr_ be the MatchState (_Input_, _e_, _cap_). + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _e_ be _x_.[[EndIndex]]. + 1. Let _xr_ be the MatchState { [[Input]]: _Input_, [[EndIndex]]: _e_, [[Captures]]: _cap_ }. 1. If _min_ ≠ 0, return _m_(_xr_, _d_). 1. If _greedy_ is *false*, then 1. Let _z_ be _c_(_x_). @@ -36209,6 +37202,68 @@

        ["b", ""]
        + + +

        EmptyMatcher ( ): a Matcher

        +
        +
        + + 1. Return a new Matcher with parameters (_x_, _c_) that captures nothing and performs the following steps when called: + 1. Assert: _x_ is a MatchState. + 1. Assert: _c_ is a MatcherContinuation. + 1. Return _c_(_x_). + +
        + + +

        + MatchTwoAlternatives ( + _m1_: a Matcher, + _m2_: a Matcher, + ): a Matcher +

        +
        +
        + + 1. Return a new Matcher with parameters (_x_, _c_) that captures _m1_ and _m2_ and performs the following steps when called: + 1. Assert: _x_ is a MatchState. + 1. Assert: _c_ is a MatcherContinuation. + 1. Let _r_ be _m1_(_x_, _c_). + 1. If _r_ is not ~failure~, return _r_. + 1. Return _m2_(_x_, _c_). + +
        + + +

        + MatchSequence ( + _m1_: a Matcher, + _m2_: a Matcher, + _direction_: ~forward~ or ~backward~, + ): a Matcher +

        +
        +
        + + 1. If _direction_ is ~forward~, then + 1. Return a new Matcher with parameters (_x_, _c_) that captures _m1_ and _m2_ and performs the following steps when called: + 1. Assert: _x_ is a MatchState. + 1. Assert: _c_ is a MatcherContinuation. + 1. Let _d_ be a new MatcherContinuation with parameters (_y_) that captures _c_ and _m2_ and performs the following steps when called: + 1. Assert: _y_ is a MatchState. + 1. Return _m2_(_y_, _c_). + 1. Return _m1_(_x_, _d_). + 1. Else, + 1. Assert: _direction_ is ~backward~. + 1. Return a new Matcher with parameters (_x_, _c_) that captures _m1_ and _m2_ and performs the following steps when called: + 1. Assert: _x_ is a MatchState. + 1. Assert: _c_ is a MatcherContinuation. + 1. Let _d_ be a new MatcherContinuation with parameters (_y_) that captures _c_ and _m1_ and performs the following steps when called: + 1. Assert: _y_ is a MatchState. + 1. Return _m1_(_y_, _c_). + 1. Return _m2_(_x_, _d_). + +
        @@ -36227,9 +37282,9 @@

        1. Return a new Matcher with parameters (_x_, _c_) that captures _rer_ and performs the following steps when called: 1. Assert: _x_ is a MatchState. 1. Assert: _c_ is a MatcherContinuation. - 1. Let _Input_ be _x_'s _input_. - 1. Let _e_ be _x_'s _endIndex_. - 1. If _e_ = 0, or if _rer_.[[Multiline]] is *true* and the character _Input_[_e_ - 1] is one of |LineTerminator|, then + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _e_ be _x_.[[EndIndex]]. + 1. If _e_ = 0, or if _rer_.[[Multiline]] is *true* and the character _Input_[_e_ - 1] is matched by |LineTerminator|, then 1. Return _c_(_x_). 1. Return ~failure~. @@ -36241,38 +37296,38 @@

        1. Return a new Matcher with parameters (_x_, _c_) that captures _rer_ and performs the following steps when called: 1. Assert: _x_ is a MatchState. 1. Assert: _c_ is a MatcherContinuation. - 1. Let _Input_ be _x_'s _input_. - 1. Let _e_ be _x_'s _endIndex_. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _e_ be _x_.[[EndIndex]]. 1. Let _InputLength_ be the number of elements in _Input_. - 1. If _e_ = _InputLength_, or if _rer_.[[Multiline]] is *true* and the character _Input_[_e_] is one of |LineTerminator|, then + 1. If _e_ = _InputLength_, or if _rer_.[[Multiline]] is *true* and the character _Input_[_e_] is matched by |LineTerminator|, then 1. Return _c_(_x_). 1. Return ~failure~. - Assertion :: `\` `b` + Assertion :: `\b` 1. Return a new Matcher with parameters (_x_, _c_) that captures _rer_ and performs the following steps when called: 1. Assert: _x_ is a MatchState. 1. Assert: _c_ is a MatcherContinuation. - 1. Let _Input_ be _x_'s _input_. - 1. Let _e_ be _x_'s _endIndex_. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _e_ be _x_.[[EndIndex]]. 1. Let _a_ be IsWordChar(_rer_, _Input_, _e_ - 1). 1. Let _b_ be IsWordChar(_rer_, _Input_, _e_). 1. If _a_ is *true* and _b_ is *false*, or if _a_ is *false* and _b_ is *true*, return _c_(_x_). 1. Return ~failure~. - Assertion :: `\` `B` + Assertion :: `\B` 1. Return a new Matcher with parameters (_x_, _c_) that captures _rer_ and performs the following steps when called: 1. Assert: _x_ is a MatchState. 1. Assert: _c_ is a MatcherContinuation. - 1. Let _Input_ be _x_'s _input_. - 1. Let _e_ be _x_'s _endIndex_. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _e_ be _x_.[[EndIndex]]. 1. Let _a_ be IsWordChar(_rer_, _Input_, _e_ - 1). 1. Let _b_ be IsWordChar(_rer_, _Input_, _e_). 1. If _a_ is *true* and _b_ is *true*, or if _a_ is *false* and _b_ is *false*, return _c_(_x_). 1. Return ~failure~. - Assertion :: `(` `?` `=` Disjunction `)` + Assertion :: `(?=` Disjunction `)` 1. Let _m_ be CompileSubpattern of |Disjunction| with arguments _rer_ and ~forward~. 1. Return a new Matcher with parameters (_x_, _c_) that captures _m_ and performs the following steps when called: @@ -36283,14 +37338,27 @@

        1. Return _y_. 1. Let _r_ be _m_(_x_, _d_). 1. If _r_ is ~failure~, return ~failure~. - 1. Let _y_ be _r_'s MatchState. - 1. Let _cap_ be _y_'s _captures_ List. - 1. Let _Input_ be _x_'s _input_. - 1. Let _xe_ be _x_'s _endIndex_. - 1. Let _z_ be the MatchState (_Input_, _xe_, _cap_). + 1. Assert: _r_ is a MatchState. + 1. Let _cap_ be _r_.[[Captures]]. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _xe_ be _x_.[[EndIndex]]. + 1. Let _z_ be the MatchState { [[Input]]: _Input_, [[EndIndex]]: _xe_, [[Captures]]: _cap_ }. 1. Return _c_(_z_). - Assertion :: `(` `?` `!` Disjunction `)` + +

        The form `(?=` |Disjunction| `)` specifies a zero-width positive lookahead. In order for it to succeed, the pattern inside |Disjunction| must match at the current position, but the current position is not advanced before matching the sequel. If |Disjunction| can match at the current position in several ways, only the first one is tried. Unlike other regular expression operators, there is no backtracking into a `(?=` form (this unusual behaviour is inherited from Perl). This only matters when the |Disjunction| contains capturing parentheses and the sequel of the pattern contains backreferences to those captures.

        +

        For example,

        +
        /(?=(a+))/.exec("baaabac")
        +

        matches the empty String immediately after the first `b` and therefore returns the array:

        +
        ["", "aaa"]
        +

        To illustrate the lack of backtracking into the lookahead, consider:

        +
        /(?=(a+))a*b\1/.exec("baaabac")
        +

        This expression returns

        +
        ["aba", "a"]
        +

        and not:

        +
        ["aaaba", "a"]
        +
        + Assertion :: `(?!` Disjunction `)` 1. Let _m_ be CompileSubpattern of |Disjunction| with arguments _rer_ and ~forward~. 1. Return a new Matcher with parameters (_x_, _c_) that captures _m_ and performs the following steps when called: @@ -36303,7 +37371,13 @@

        1. If _r_ is not ~failure~, return ~failure~. 1. Return _c_(_x_). - Assertion :: `(` `?` `<=` Disjunction `)` + +

        The form `(?!` |Disjunction| `)` specifies a zero-width negative lookahead. In order for it to succeed, the pattern inside |Disjunction| must fail to match at the current position. The current position is not advanced before matching the sequel. |Disjunction| can contain capturing parentheses, but backreferences to them only make sense from within |Disjunction| itself. Backreferences to these capturing parentheses from elsewhere in the pattern always return *undefined* because the negative lookahead must fail for the pattern to succeed. For example,

        +
        /(.*?)a(?!(a+)b\2c)\2(.*)/.exec("baaabaac")
        +

        looks for an `a` not immediately followed by some positive number n of `a`'s, a `b`, another n `a`'s (specified by the first `\\2`) and a `c`. The second `\\2` is outside the negative lookahead, so it matches against *undefined* and therefore always succeeds. The whole expression returns the array:

        +
        ["baaabaac", "ba", undefined, "abaac"]
        +
        + Assertion :: `(?<=` Disjunction `)` 1. Let _m_ be CompileSubpattern of |Disjunction| with arguments _rer_ and ~backward~. 1. Return a new Matcher with parameters (_x_, _c_) that captures _m_ and performs the following steps when called: @@ -36314,14 +37388,14 @@

        1. Return _y_. 1. Let _r_ be _m_(_x_, _d_). 1. If _r_ is ~failure~, return ~failure~. - 1. Let _y_ be _r_'s MatchState. - 1. Let _cap_ be _y_'s _captures_ List. - 1. Let _Input_ be _x_'s _input_. - 1. Let _xe_ be _x_'s _endIndex_. - 1. Let _z_ be the MatchState (_Input_, _xe_, _cap_). + 1. Assert: _r_ is a MatchState. + 1. Let _cap_ be _r_.[[Captures]]. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _xe_ be _x_.[[EndIndex]]. + 1. Let _z_ be the MatchState { [[Input]]: _Input_, [[EndIndex]]: _xe_, [[Captures]]: _cap_ }. 1. Return _c_(_z_). - Assertion :: `(` `?` `<!` Disjunction `)` + Assertion :: `(?<!` Disjunction `)` 1. Let _m_ be CompileSubpattern of |Disjunction| with arguments _rer_ and ~backward~. 1. Return a new Matcher with parameters (_x_, _c_) that captures _m_ and performs the following steps when called: @@ -36347,9 +37421,9 @@

        1. Let _InputLength_ be the number of elements in _Input_. - 1. If _e_ = -1 or _e_ is _InputLength_, return *false*. + 1. If _e_ = -1 or _e_ = _InputLength_, return *false*. 1. Let _c_ be the character _Input_[_e_]. - 1. If _c_ is in WordCharacters(_rer_), return *true*. + 1. If WordCharacters(_rer_) contains _c_, return *true*. 1. Return *false*. @@ -36392,7 +37466,7 @@

        Runtime Semantics: CompileQuantifierPrefix ( ): a Record with fields [[Min]] 1. Let _i_ be the MV of |DecimalDigits| (see ). 1. Return the Record { [[Min]]: _i_, [[Max]]: _i_ }. - QuantifierPrefix :: `{` DecimalDigits `,` `}` + QuantifierPrefix :: `{` DecimalDigits `,}` 1. Let _i_ be the MV of |DecimalDigits|. 1. Return the Record { [[Min]]: _i_, [[Max]]: +∞ }. @@ -36427,7 +37501,7 @@

        Atom :: `.` - 1. Let _A_ be the CharSet of all characters. + 1. Let _A_ be AllCharacters(_rer_). 1. If _rer_.[[DotAll]] is not *true*, then 1. Remove from _A_ all characters corresponding to a code point on the right-hand side of the |LineTerminator| production. 1. Return CharacterSetMatcher(_rer_, _A_, *false*, _direction_). @@ -36435,7 +37509,25 @@

        Atom :: CharacterClass 1. Let _cc_ be CompileCharacterClass of |CharacterClass| with argument _rer_. - 1. Return CharacterSetMatcher(_rer_, _cc_.[[CharSet]], _cc_.[[Invert]], _direction_). + 1. Let _cs_ be _cc_.[[CharSet]]. + 1. If _rer_.[[UnicodeSets]] is *false*, or if every CharSetElement of _cs_ consists of a single character (including if _cs_ is empty), return CharacterSetMatcher(_rer_, _cs_, _cc_.[[Invert]], _direction_). + 1. Assert: _cc_.[[Invert]] is *false*. + 1. Let _lm_ be an empty List of Matchers. + 1. For each CharSetElement _s_ in _cs_ containing more than 1 character, iterating in descending order of length, do + 1. Let _cs2_ be a one-element CharSet containing the last code point of _s_. + 1. Let _m2_ be CharacterSetMatcher(_rer_, _cs2_, *false*, _direction_). + 1. For each code point _c1_ in _s_, iterating backwards from its second-to-last code point, do + 1. Let _cs1_ be a one-element CharSet containing _c1_. + 1. Let _m1_ be CharacterSetMatcher(_rer_, _cs1_, *false*, _direction_). + 1. Set _m2_ to MatchSequence(_m1_, _m2_, _direction_). + 1. Append _m2_ to _lm_. + 1. Let _singles_ be the CharSet containing every CharSetElement of _cs_ that consists of a single character. + 1. Append CharacterSetMatcher(_rer_, _singles_, *false*, _direction_) to _lm_. + 1. If _cs_ contains the empty sequence of characters, append EmptyMatcher() to _lm_. + 1. Let _m2_ be the last Matcher in _lm_. + 1. For each Matcher _m1_ of _lm_, iterating backwards from its second-to-last element, do + 1. Set _m2_ to MatchTwoAlternatives(_m1_, _m2_). + 1. Return _m2_. Atom :: `(` GroupSpecifier? Disjunction `)` @@ -36446,23 +37538,26 @@

        1. Assert: _c_ is a MatcherContinuation. 1. Let _d_ be a new MatcherContinuation with parameters (_y_) that captures _x_, _c_, _direction_, and _parenIndex_ and performs the following steps when called: 1. Assert: _y_ is a MatchState. - 1. Let _cap_ be a copy of _y_'s _captures_ List. - 1. Let _Input_ be _x_'s _input_. - 1. Let _xe_ be _x_'s _endIndex_. - 1. Let _ye_ be _y_'s _endIndex_. + 1. Let _cap_ be a copy of _y_.[[Captures]]. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _xe_ be _x_.[[EndIndex]]. + 1. Let _ye_ be _y_.[[EndIndex]]. 1. If _direction_ is ~forward~, then 1. Assert: _xe_ ≤ _ye_. - 1. Let _r_ be the CaptureRange (_xe_, _ye_). + 1. Let _r_ be the CaptureRange { [[StartIndex]]: _xe_, [[EndIndex]]: _ye_ }. 1. Else, 1. Assert: _direction_ is ~backward~. 1. Assert: _ye_ ≤ _xe_. - 1. Let _r_ be the CaptureRange (_ye_, _xe_). + 1. Let _r_ be the CaptureRange { [[StartIndex]]: _ye_, [[EndIndex]]: _xe_ }. 1. Set _cap_[_parenIndex_ + 1] to _r_. - 1. Let _z_ be the MatchState (_Input_, _ye_, _cap_). + 1. Let _z_ be the MatchState { [[Input]]: _Input_, [[EndIndex]]: _ye_, [[Captures]]: _cap_ }. 1. Return _c_(_z_). 1. Return _m_(_x_, _d_). - Atom :: `(` `?` `:` Disjunction `)` + +

        Parentheses of the form `(` |Disjunction| `)` serve both to group the components of the |Disjunction| pattern together and to save the result of the match. The result can be used either in a backreference (`\\` followed by a non-zero decimal number), referenced in a replace String, or returned as part of an array from the regular expression matching Abstract Closure. To inhibit the capturing behaviour of parentheses, use the form `(?:` |Disjunction| `)` instead.

        +
        + Atom :: `(?:` Disjunction `)` 1. Return CompileSubpattern of |Disjunction| with arguments _rer_ and _direction_. @@ -36486,8 +37581,24 @@

        AtomEscape :: CharacterClassEscape - 1. Let _A_ be CompileToCharSet of |CharacterClassEscape| with argument _rer_. - 1. Return CharacterSetMatcher(_rer_, _A_, *false*, _direction_). + 1. Let _cs_ be CompileToCharSet of |CharacterClassEscape| with argument _rer_. + 1. If _rer_.[[UnicodeSets]] is *false*, or if every CharSetElement of _cs_ consists of a single character (including if _cs_ is empty), return CharacterSetMatcher(_rer_, _cs_, *false*, _direction_). + 1. Let _lm_ be an empty List of Matchers. + 1. For each CharSetElement _s_ in _cs_ containing more than 1 character, iterating in descending order of length, do + 1. Let _cs2_ be a one-element CharSet containing the last code point of _s_. + 1. Let _m2_ be CharacterSetMatcher(_rer_, _cs2_, *false*, _direction_). + 1. For each code point _c1_ in _s_, iterating backwards from its second-to-last code point, do + 1. Let _cs1_ be a one-element CharSet containing _c1_. + 1. Let _m1_ be CharacterSetMatcher(_rer_, _cs1_, *false*, _direction_). + 1. Set _m2_ to MatchSequence(_m1_, _m2_, _direction_). + 1. Append _m2_ to _lm_. + 1. Let _singles_ be the CharSet containing every CharSetElement of _cs_ that consists of a single character. + 1. Append CharacterSetMatcher(_rer_, _singles_, *false*, _direction_) to _lm_. + 1. If _cs_ contains the empty sequence of characters, append EmptyMatcher() to _lm_. + 1. Let _m2_ be the last Matcher in _lm_. + 1. For each Matcher _m1_ of _lm_, iterating backwards from its second-to-last element, do + 1. Set _m2_ to MatchTwoAlternatives(_m1_, _m2_). + 1. Return _m2_. AtomEscape :: `k` GroupName @@ -36510,11 +37621,14 @@

        + 1. If _rer_.[[UnicodeSets]] is *true*, then + 1. Assert: _invert_ is *false*. + 1. Assert: Every CharSetElement of _A_ consists of a single character. 1. Return a new Matcher with parameters (_x_, _c_) that captures _rer_, _A_, _invert_, and _direction_ and performs the following steps when called: 1. Assert: _x_ is a MatchState. 1. Assert: _c_ is a MatcherContinuation. - 1. Let _Input_ be _x_'s _input_. - 1. Let _e_ be _x_'s _endIndex_. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _e_ be _x_.[[EndIndex]]. 1. If _direction_ is ~forward~, let _f_ be _e_ + 1. 1. Else, let _f_ be _e_ - 1. 1. Let _InputLength_ be the number of elements in _Input_. @@ -36522,11 +37636,11 @@

        1. Let _index_ be min(_e_, _f_). 1. Let _ch_ be the character _Input_[_index_]. 1. Let _cc_ be Canonicalize(_rer_, _ch_). - 1. If there exists a member _a_ of _A_ such that Canonicalize(_rer_, _a_) is _cc_, let _found_ be *true*. Otherwise, let _found_ be *false*. + 1. If there exists a CharSetElement in _A_ containing exactly one character _a_ such that Canonicalize(_rer_, _a_) is _cc_, let _found_ be *true*. Otherwise, let _found_ be *false*. 1. If _invert_ is *false* and _found_ is *false*, return ~failure~. 1. If _invert_ is *true* and _found_ is *true*, return ~failure~. - 1. Let _cap_ be _x_'s _captures_ List. - 1. Let _y_ be the MatchState (_Input_, _f_, _cap_). + 1. Let _cap_ be _x_.[[Captures]]. + 1. Let _y_ be the MatchState { [[Input]]: _Input_, [[EndIndex]]: _f_, [[Captures]]: _cap_ }. 1. Return _c_(_y_). @@ -36546,21 +37660,21 @@

        1. Return a new Matcher with parameters (_x_, _c_) that captures _rer_, _n_, and _direction_ and performs the following steps when called: 1. Assert: _x_ is a MatchState. 1. Assert: _c_ is a MatcherContinuation. - 1. Let _Input_ be _x_'s _input_. - 1. Let _cap_ be _x_'s _captures_ List. + 1. Let _Input_ be _x_.[[Input]]. + 1. Let _cap_ be _x_.[[Captures]]. 1. Let _r_ be _cap_[_n_]. 1. If _r_ is *undefined*, return _c_(_x_). - 1. Let _e_ be _x_'s _endIndex_. - 1. Let _rs_ be _r_'s _startIndex_. - 1. Let _re_ be _r_'s _endIndex_. + 1. Let _e_ be _x_.[[EndIndex]]. + 1. Let _rs_ be _r_.[[StartIndex]]. + 1. Let _re_ be _r_.[[EndIndex]]. 1. Let _len_ be _re_ - _rs_. 1. If _direction_ is ~forward~, let _f_ be _e_ + _len_. 1. Else, let _f_ be _e_ - _len_. 1. Let _InputLength_ be the number of elements in _Input_. 1. If _f_ < 0 or _f_ > _InputLength_, return ~failure~. 1. Let _g_ be min(_e_, _f_). - 1. If there exists an integer _i_ in the interval from 0 (inclusive) to _len_ (exclusive) such that Canonicalize(_rer_, _Input_[_rs_ + _i_]) is not the same character value as Canonicalize(_rer_, _Input_[_g_ + _i_]), return ~failure~. - 1. Let _y_ be the MatchState (_Input_, _f_, _cap_). + 1. If there exists an integer _i_ in the interval from 0 (inclusive) to _len_ (exclusive) such that Canonicalize(_rer_, _Input_[_rs_ + _i_]) is not Canonicalize(_rer_, _Input_[_g_ + _i_]), return ~failure~. + 1. Let _y_ be the MatchState { [[Input]]: _Input_, [[EndIndex]]: _f_, [[Captures]]: _cap_ }. 1. Return _c_(_y_). @@ -36575,43 +37689,22 @@

        - 1. If _rer_.[[Unicode]] is *true* and _rer_.[[IgnoreCase]] is *true*, then + 1. If HasEitherUnicodeFlag(_rer_) is *true* and _rer_.[[IgnoreCase]] is *true*, then 1. If the file CaseFolding.txt of the Unicode Character Database provides a simple or common case folding mapping for _ch_, return the result of applying that mapping to _ch_. 1. Return _ch_. 1. If _rer_.[[IgnoreCase]] is *false*, return _ch_. 1. Assert: _ch_ is a UTF-16 code unit. - 1. Let _cp_ be the code point whose numeric value is that of _ch_. + 1. Let _cp_ be the code point whose numeric value is the numeric value of _ch_. 1. Let _u_ be the result of toUppercase(« _cp_ »), according to the Unicode Default Case Conversion algorithm. 1. Let _uStr_ be CodePointsToString(_u_). - 1. If _uStr_ does not consist of a single code unit, return _ch_. + 1. If the length of _uStr_ ≠ 1, return _ch_. 1. Let _cu_ be _uStr_'s single code unit element. 1. If the numeric value of _ch_ ≥ 128 and the numeric value of _cu_ < 128, return _ch_. 1. Return _cu_. -

        Parentheses of the form `(` |Disjunction| `)` serve both to group the components of the |Disjunction| pattern together and to save the result of the match. The result can be used either in a backreference (`\\` followed by a non-zero decimal number), referenced in a replace String, or returned as part of an array from the regular expression matching Abstract Closure. To inhibit the capturing behaviour of parentheses, use the form `(?:` |Disjunction| `)` instead.

        -
        - -

        The form `(?=` |Disjunction| `)` specifies a zero-width positive lookahead. In order for it to succeed, the pattern inside |Disjunction| must match at the current position, but the current position is not advanced before matching the sequel. If |Disjunction| can match at the current position in several ways, only the first one is tried. Unlike other regular expression operators, there is no backtracking into a `(?=` form (this unusual behaviour is inherited from Perl). This only matters when the |Disjunction| contains capturing parentheses and the sequel of the pattern contains backreferences to those captures.

        -

        For example,

        -
        /(?=(a+))/.exec("baaabac")
        -

        matches the empty String immediately after the first `b` and therefore returns the array:

        -
        ["", "aaa"]
        -

        To illustrate the lack of backtracking into the lookahead, consider:

        -
        /(?=(a+))a*b\1/.exec("baaabac")
        -

        This expression returns

        -
        ["aba", "a"]
        -

        and not:

        -
        ["aaaba", "a"]
        -
        - -

        The form `(?!` |Disjunction| `)` specifies a zero-width negative lookahead. In order for it to succeed, the pattern inside |Disjunction| must fail to match at the current position. The current position is not advanced before matching the sequel. |Disjunction| can contain capturing parentheses, but backreferences to them only make sense from within |Disjunction| itself. Backreferences to these capturing parentheses from elsewhere in the pattern always return *undefined* because the negative lookahead must fail for the pattern to succeed. For example,

        -
        /(.*?)a(?!(a+)b\2c)\2(.*)/.exec("baaabaac")
        -

        looks for an `a` not immediately followed by some positive number n of `a`'s, a `b`, another n `a`'s (specified by the first `\\2`) and a `c`. The second `\\2` is outside the negative lookahead, so it matches against *undefined* and therefore always succeeds. The whole expression returns the array:

        -
        ["baaabaac", "ba", undefined, "abaac"]
        -
        - -

        In case-insignificant matches when _rer_.[[Unicode]] is *true*, all characters are implicitly case-folded using the simple mapping provided by the Unicode Standard immediately before they are compared. The simple mapping always maps to a single code point, so it does not map, for example, `ß` (U+00DF) to `SS`. It may however map a code point outside the Basic Latin block to a character within, for example, `ſ` (U+017F) to `s`. Such characters are not mapped if _rer_.[[Unicode]] is *false*. This prevents Unicode code points such as U+017F and U+212A from matching regular expressions such as `/[a-z]/i`, but they will match `/[a-z]/ui`.

        +

        In case-insignificant matches when HasEitherUnicodeFlag(_rer_) is *true*, all characters are implicitly case-folded using the simple mapping provided by the Unicode Standard immediately before they are compared. The simple mapping always maps to a single code point, so it does not map, for example, `ß` (U+00DF LATIN SMALL LETTER SHARP S) to `ss` or `SS`. It may however map code points outside the Basic Latin block to code points within it—for example, `ſ` (U+017F LATIN SMALL LETTER LONG S) case-folds to `s` (U+0073 LATIN SMALL LETTER S) and `K` (U+212A KELVIN SIGN) case-folds to `k` (U+006B LATIN SMALL LETTER K). Strings containing those code points are matched by regular expressions such as `/[a-z]/ui`.

        +

        In case-insignificant matches when HasEitherUnicodeFlag(_rer_) is *false*, the mapping is based on Unicode Default Case Conversion algorithm toUppercase rather than toCasefold, which results in some subtle differences. For example, `Ω` (U+2126 OHM SIGN) is mapped by toUppercase to itself but by toCasefold to `ω` (U+03C9 GREEK SMALL LETTER OMEGA) along with `Ω` (U+03A9 GREEK CAPITAL LETTER OMEGA), so *"\u2126"* is matched by `/[ω]/ui` and `/[\u03A9]/ui` but not by `/[ω]/i` or `/[\u03A9]/i`. Also, no code point outside the Basic Latin block is mapped to a code point within it, so strings such as *"\u017F ſ"* and *"\u212A K"* are not matched by `/[a-z]/i`.

        @@ -36624,14 +37717,16 @@

        - CharacterClass :: `[` ClassRanges `]` + CharacterClass :: `[` ClassContents `]` - 1. Let _A_ be CompileToCharSet of |ClassRanges| with argument _rer_. + 1. Let _A_ be CompileToCharSet of |ClassContents| with argument _rer_. 1. Return the Record { [[CharSet]]: _A_, [[Invert]]: *false* }. - CharacterClass :: `[` `^` ClassRanges `]` + CharacterClass :: `[^` ClassContents `]` - 1. Let _A_ be CompileToCharSet of |ClassRanges| with argument _rer_. + 1. Let _A_ be CompileToCharSet of |ClassContents| with argument _rer_. + 1. If _rer_.[[UnicodeSets]] is *true*, then + 1. Return the Record { [[CharSet]]: CharacterComplement(_rer_, _A_), [[Invert]]: *false* }. 1. Return the Record { [[CharSet]]: _A_, [[Invert]]: *true* }. @@ -36648,8 +37743,8 @@

        This section is amended in .

        - - ClassRanges :: [empty] + + ClassContents :: [empty] 1. Return the empty CharSet. @@ -36661,11 +37756,11 @@

        1. Let _B_ be CompileToCharSet of |NonemptyClassRangesNoDash| with argument _rer_. 1. Return the union of CharSets _A_ and _B_. - NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassRanges + NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassContents 1. Let _A_ be CompileToCharSet of the first |ClassAtom| with argument _rer_. 1. Let _B_ be CompileToCharSet of the second |ClassAtom| with argument _rer_. - 1. Let _C_ be CompileToCharSet of |ClassRanges| with argument _rer_. + 1. Let _C_ be CompileToCharSet of |ClassContents| with argument _rer_. 1. Let _D_ be CharacterRange(_A_, _B_). 1. Return the union of _D_ and _C_. @@ -36677,22 +37772,22 @@

        1. Let _B_ be CompileToCharSet of |NonemptyClassRangesNoDash| with argument _rer_. 1. Return the union of CharSets _A_ and _B_. - NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassRanges + NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassContents 1. Let _A_ be CompileToCharSet of |ClassAtomNoDash| with argument _rer_. 1. Let _B_ be CompileToCharSet of |ClassAtom| with argument _rer_. - 1. Let _C_ be CompileToCharSet of |ClassRanges| with argument _rer_. + 1. Let _C_ be CompileToCharSet of |ClassContents| with argument _rer_. 1. Let _D_ be CharacterRange(_A_, _B_). 1. Return the union of _D_ and _C_. -

        |ClassRanges| can expand into a single |ClassAtom| and/or ranges of two |ClassAtom| separated by dashes. In the latter case the |ClassRanges| includes all characters between the first |ClassAtom| and the second |ClassAtom|, inclusive; an error occurs if either |ClassAtom| does not represent a single character (for example, if one is \w) or if the first |ClassAtom|'s character value is greater than the second |ClassAtom|'s character value.

        +

        |ClassContents| can expand into a single |ClassAtom| and/or ranges of two |ClassAtom| separated by dashes. In the latter case the |ClassContents| includes all characters between the first |ClassAtom| and the second |ClassAtom|, inclusive; an error occurs if either |ClassAtom| does not represent a single character (for example, if one is \w) or if the first |ClassAtom|'s character value is strictly greater than the second |ClassAtom|'s character value.

        Even if the pattern ignores case, the case of the two ends of a range is significant in determining which characters belong to the range. Thus, for example, the pattern `/[E-F]/i` matches only the letters `E`, `F`, `e`, and `f`, while the pattern `/[E-f]/i` matches all uppercase and lowercase letters in the Unicode Basic Latin block as well as the symbols `[`, `\\`, `]`, `^`, `_`, and `.

        -

        A `-` character can be treated literally or it can denote a range. It is treated literally if it is the first or last character of |ClassRanges|, the beginning or end limit of a range specification, or immediately follows a range specification.

        +

        A `-` character can be treated literally or it can denote a range. It is treated literally if it is the first or last character of |ClassContents|, the beginning or end limit of a range specification, or immediately follows a range specification.

        @@ -36730,7 +37825,8 @@

        CharacterClassEscape :: `D` - 1. Return the CharSet containing all characters not in the CharSet returned by CharacterClassEscape :: `d`. + 1. Let _S_ be the CharSet returned by CharacterClassEscape :: `d`. + 1. Return CharacterComplement(_rer_, _S_). CharacterClassEscape :: `s` @@ -36738,41 +37834,172 @@

        CharacterClassEscape :: `S` - 1. Return the CharSet containing all characters not in the CharSet returned by CharacterClassEscape :: `s`. + 1. Let _S_ be the CharSet returned by CharacterClassEscape :: `s`. + 1. Return CharacterComplement(_rer_, _S_). CharacterClassEscape :: `w` - 1. Return WordCharacters(_rer_). + 1. Return MaybeSimpleCaseFolding(_rer_, WordCharacters(_rer_)). CharacterClassEscape :: `W` - 1. Return the CharSet containing all characters not in the CharSet returned by CharacterClassEscape :: `w`. + 1. Let _S_ be the CharSet returned by CharacterClassEscape :: `w`. + 1. Return CharacterComplement(_rer_, _S_). CharacterClassEscape :: `p{` UnicodePropertyValueExpression `}` - 1. Return the CharSet containing all Unicode code points included in CompileToCharSet of |UnicodePropertyValueExpression| with argument _rer_. + 1. Return CompileToCharSet of |UnicodePropertyValueExpression| with argument _rer_. CharacterClassEscape :: `P{` UnicodePropertyValueExpression `}` - 1. Return the CharSet containing all Unicode code points not included in CompileToCharSet of |UnicodePropertyValueExpression| with argument _rer_. + 1. Let _S_ be CompileToCharSet of |UnicodePropertyValueExpression| with argument _rer_. + 1. Assert: _S_ contains only single code points. + 1. Return CharacterComplement(_rer_, _S_). UnicodePropertyValueExpression :: UnicodePropertyName `=` UnicodePropertyValue 1. Let _ps_ be the source text matched by |UnicodePropertyName|. - 1. Let _p_ be UnicodeMatchProperty(_ps_). + 1. Let _p_ be UnicodeMatchProperty(_rer_, _ps_). 1. Assert: _p_ is a Unicode property name or property alias listed in the “Property name and aliases” column of . 1. Let _vs_ be the source text matched by |UnicodePropertyValue|. 1. Let _v_ be UnicodeMatchPropertyValue(_p_, _vs_). - 1. Return the CharSet containing all Unicode code points whose character database definition includes the property _p_ with value _v_. + 1. Let _A_ be the CharSet containing all Unicode code points whose character database definition includes the property _p_ with value _v_. + 1. Return MaybeSimpleCaseFolding(_rer_, _A_). UnicodePropertyValueExpression :: LoneUnicodePropertyNameOrValue 1. Let _s_ be the source text matched by |LoneUnicodePropertyNameOrValue|. 1. If UnicodeMatchPropertyValue(`General_Category`, _s_) is a Unicode property value or property value alias for the General_Category (gc) property listed in PropertyValueAliases.txt, then 1. Return the CharSet containing all Unicode code points whose character database definition includes the property “General_Category” with value _s_. - 1. Let _p_ be UnicodeMatchProperty(_s_). - 1. Assert: _p_ is a binary Unicode property or binary property alias listed in the “Property name and aliases” column of . - 1. Return the CharSet containing all Unicode code points whose character database definition includes the property _p_ with value “True”. + 1. Let _p_ be UnicodeMatchProperty(_rer_, _s_). + 1. Assert: _p_ is a binary Unicode property or binary property alias listed in the “Property name and aliases” column of , or a binary Unicode property of strings listed in the “Property name” column of . + 1. Let _A_ be the CharSet containing all CharSetElements whose character database definition includes the property _p_ with value “True”. + 1. Return MaybeSimpleCaseFolding(_rer_, _A_). + + + + ClassUnion :: ClassSetRange ClassUnion? + + 1. Let _A_ be CompileToCharSet of |ClassSetRange| with argument _rer_. + 1. If |ClassUnion| is present, then + 1. Let _B_ be CompileToCharSet of |ClassUnion| with argument _rer_. + 1. Return the union of CharSets _A_ and _B_. + 1. Return _A_. + + ClassUnion :: ClassSetOperand ClassUnion? + + 1. Let _A_ be CompileToCharSet of |ClassSetOperand| with argument _rer_. + 1. If |ClassUnion| is present, then + 1. Let _B_ be CompileToCharSet of |ClassUnion| with argument _rer_. + 1. Return the union of CharSets _A_ and _B_. + 1. Return _A_. + + + + ClassIntersection :: ClassSetOperand `&&` ClassSetOperand + + 1. Let _A_ be CompileToCharSet of the first |ClassSetOperand| with argument _rer_. + 1. Let _B_ be CompileToCharSet of the second |ClassSetOperand| with argument _rer_. + 1. Return the intersection of CharSets _A_ and _B_. + + ClassIntersection :: ClassIntersection `&&` ClassSetOperand + + 1. Let _A_ be CompileToCharSet of the |ClassIntersection| with argument _rer_. + 1. Let _B_ be CompileToCharSet of the |ClassSetOperand| with argument _rer_. + 1. Return the intersection of CharSets _A_ and _B_. + + + + ClassSubtraction :: ClassSetOperand `--` ClassSetOperand + + 1. Let _A_ be CompileToCharSet of the first |ClassSetOperand| with argument _rer_. + 1. Let _B_ be CompileToCharSet of the second |ClassSetOperand| with argument _rer_. + 1. Return the CharSet containing the CharSetElements of _A_ which are not also CharSetElements of _B_. + + ClassSubtraction :: ClassSubtraction `--` ClassSetOperand + + 1. Let _A_ be CompileToCharSet of the |ClassSubtraction| with argument _rer_. + 1. Let _B_ be CompileToCharSet of the |ClassSetOperand| with argument _rer_. + 1. Return the CharSet containing the CharSetElements of _A_ which are not also CharSetElements of _B_. + + + + ClassSetRange :: ClassSetCharacter `-` ClassSetCharacter + + 1. Let _A_ be CompileToCharSet of the first |ClassSetCharacter| with argument _rer_. + 1. Let _B_ be CompileToCharSet of the second |ClassSetCharacter| with argument _rer_. + 1. Return MaybeSimpleCaseFolding(_rer_, CharacterRange(_A_, _B_)). + + +

        The result will often consist of two or more ranges. When UnicodeSets is *true* and IgnoreCase is *true*, then MaybeSimpleCaseFolding(_rer_, [Ā-č]) will include only the odd-numbered code points of that range.

        +
        + + + ClassSetOperand :: ClassSetCharacter + + 1. Let _A_ be CompileToCharSet of |ClassSetCharacter| with argument _rer_. + 1. Return MaybeSimpleCaseFolding(_rer_, _A_). + + ClassSetOperand :: ClassStringDisjunction + + 1. Let _A_ be CompileToCharSet of |ClassStringDisjunction| with argument _rer_. + 1. Return MaybeSimpleCaseFolding(_rer_, _A_). + + ClassSetOperand :: NestedClass + + 1. Return CompileToCharSet of |NestedClass| with argument _rer_. + + + + NestedClass :: `[` ClassContents `]` + + 1. Return CompileToCharSet of |ClassContents| with argument _rer_. + + NestedClass :: `[^` ClassContents `]` + + 1. Let _A_ be CompileToCharSet of |ClassContents| with argument _rer_. + 1. Return CharacterComplement(_rer_, _A_). + + NestedClass :: `\` CharacterClassEscape + + 1. Return CompileToCharSet of |CharacterClassEscape| with argument _rer_. + + + + ClassStringDisjunction :: `\q{` ClassStringDisjunctionContents `}` + + 1. Return CompileToCharSet of |ClassStringDisjunctionContents| with argument _rer_. + + + + ClassStringDisjunctionContents :: ClassString + + 1. Let _s_ be CompileClassSetString of |ClassString| with argument _rer_. + 1. Return the CharSet containing the one string _s_. + + ClassStringDisjunctionContents :: ClassString `|` ClassStringDisjunctionContents + + 1. Let _s_ be CompileClassSetString of |ClassString| with argument _rer_. + 1. Let _A_ be the CharSet containing the one string _s_. + 1. Let _B_ be CompileToCharSet of |ClassStringDisjunctionContents| with argument _rer_. + 1. Return the union of CharSets _A_ and _B_. + + + + + ClassSetCharacter :: + SourceCharacter but not ClassSetSyntaxCharacter + `\` CharacterEscape + `\` ClassSetReservedPunctuator + + + 1. Let _cv_ be the CharacterValue of this |ClassSetCharacter|. + 1. Let _c_ be the character whose character value is _cv_. + 1. Return the CharSet containing the single character _c_. + + ClassSetCharacter :: `\b` + + 1. Return the CharSet containing the single character U+0008 (BACKSPACE). @@ -36791,7 +38018,22 @@

        1. Let _i_ be the character value of character _a_. 1. Let _j_ be the character value of character _b_. 1. Assert: _i_ ≤ _j_. - 1. Return the CharSet containing all characters with a character value greater than or equal to _i_ and less than or equal to _j_. + 1. Return the CharSet containing all characters with a character value in the inclusive interval from _i_ to _j_. + + + + +

        + HasEitherUnicodeFlag ( + _rer_: a RegExp Record, + ): a Boolean +

        +
        +
        + + 1. If _rer_.[[Unicode]] is *true* or _rer_.[[UnicodeSets]] is *true*, then + 1. Return *true*. + 1. Return *false*.
        @@ -36808,25 +38050,86 @@

        1. Let _basicWordChars_ be the CharSet containing every character in the ASCII word characters. 1. Let _extraWordChars_ be the CharSet containing all characters _c_ such that _c_ is not in _basicWordChars_ but Canonicalize(_rer_, _c_) is in _basicWordChars_. - 1. Assert: _extraWordChars_ is empty unless _rer_.[[Unicode]] and _rer_.[[IgnoreCase]] are both *true*. + 1. Assert: _extraWordChars_ is empty unless HasEitherUnicodeFlag(_rer_) is *true* and _rer_.[[IgnoreCase]] is *true*. 1. Return the union of _basicWordChars_ and _extraWordChars_. + +

        + AllCharacters ( + _rer_: a RegExp Record, + ): a CharSet +

        +
        +
        description
        +
        Returns the set of “all characters” according to the regular expression flags.
        +
        + + 1. If _rer_.[[UnicodeSets]] is *true* and _rer_.[[IgnoreCase]] is *true*, then + 1. [declared="c"] Return the CharSet containing all Unicode code points _c_ that do not have a Simple Case Folding mapping (that is, scf(_c_)=_c_). + 1. Else if HasEitherUnicodeFlag(_rer_) is *true*, then + 1. Return the CharSet containing all code point values. + 1. Else, + 1. Return the CharSet containing all code unit values. + +
        + + +

        + MaybeSimpleCaseFolding ( + _rer_: a RegExp Record, + _A_: a CharSet, + ): a CharSet +

        +
        +
        description
        +
        If _rer_.[[UnicodeSets]] is *false* or _rer_.[[IgnoreCase]] is *false*, it returns _A_. Otherwise, it uses the Simple Case Folding (scf(_cp_)) definitions in the file CaseFolding.txt of the Unicode Character Database (each of which maps a single code point to another single code point) to map each CharSetElement of _A_ character-by-character into a canonical form and returns the resulting CharSet.
        +
        + + 1. If _rer_.[[UnicodeSets]] is *false* or _rer_.[[IgnoreCase]] is *false*, return _A_. + 1. Let _B_ be a new empty CharSet. + 1. For each CharSetElement _s_ of _A_, do + 1. Let _t_ be an empty sequence of characters. + 1. For each single code point _cp_ in _s_, do + 1. Append scf(_cp_) to _t_. + 1. Add _t_ to _B_. + 1. Return _B_. + +
        + + +

        + CharacterComplement ( + _rer_: a RegExp Record, + _S_: a CharSet, + ): a CharSet +

        +
        +
        + + 1. Let _A_ be AllCharacters(_rer_). + 1. Return the CharSet containing the CharSetElements of _A_ which are not also CharSetElements of _S_. + +
        +

        UnicodeMatchProperty ( + _rer_: a RegExp Record, _p_: ECMAScript source text, ): a Unicode property name

        + 1. If _rer_.[[UnicodeSets]] is *true* and _p_ is a Unicode property name listed in the “Property name” column of , then + 1. Return the List of Unicode code points _p_. 1. Assert: _p_ is a Unicode property name or property alias listed in the “Property name and aliases” column of or . 1. Let _c_ be the canonical property name of _p_ as given in the “Canonical property name” column of the corresponding row. 1. Return the List of Unicode code points _c_. -

        Implementations must support the Unicode property names and aliases listed in and . To ensure interoperability, implementations must not support any other property names or aliases.

        +

        Implementations must support the Unicode property names and aliases listed in , , and . To ensure interoperability, implementations must not support any other property names or aliases.

        For example, `Script_Extensions` (property name) and `scx` (property alias) are valid, but `script_extensions` or `Scx` aren't.

        @@ -36838,6 +38141,7 @@

        + @@ -36864,6 +38168,34 @@

        + + +

        + Runtime Semantics: CompileClassSetString ( + _rer_: a RegExp Record, + ): a sequence of characters +

        +
        +
        + + ClassString :: [empty] + + 1. Return an empty sequence of characters. + + ClassString :: NonEmptyClassString + + 1. Return CompileClassSetString of |NonEmptyClassString| with argument _rer_. + + NonEmptyClassString :: ClassSetCharacter NonEmptyClassString? + + 1. Let _cs_ be CompileToCharSet of |ClassSetCharacter| with argument _rer_. + 1. Let _s1_ be the sequence of characters that is the single CharSetElement of _cs_. + 1. If |NonEmptyClassString| is present, then + 1. Let _s2_ be CompileClassSetString of |NonEmptyClassString| with argument _rer_. + 1. Return the concatenation of _s1_ and _s2_. + 1. Return _s1_. + +
        @@ -36914,22 +38246,23 @@

        1. Else, let _P_ be ? ToString(_pattern_). 1. If _flags_ is *undefined*, let _F_ be the empty String. 1. Else, let _F_ be ? ToString(_flags_). - 1. If _F_ contains any code unit other than *"d"*, *"g"*, *"i"*, *"m"*, *"s"*, *"u"*, or *"y"* or if it contains the same code unit more than once, throw a *SyntaxError* exception. + 1. If _F_ contains any code unit other than *"d"*, *"g"*, *"i"*, *"m"*, *"s"*, *"u"*, *"v"*, or *"y"*, or if _F_ contains any code unit more than once, throw a *SyntaxError* exception. 1. If _F_ contains *"i"*, let _i_ be *true*; else let _i_ be *false*. 1. If _F_ contains *"m"*, let _m_ be *true*; else let _m_ be *false*. 1. If _F_ contains *"s"*, let _s_ be *true*; else let _s_ be *false*. 1. If _F_ contains *"u"*, let _u_ be *true*; else let _u_ be *false*. - 1. If _u_ is *true*, then + 1. If _F_ contains *"v"*, let _v_ be *true*; else let _v_ be *false*. + 1. If _u_ is *true* or _v_ is *true*, then 1. Let _patternText_ be StringToCodePoints(_P_). 1. Else, 1. Let _patternText_ be the result of interpreting each of _P_'s 16-bit elements as a Unicode BMP code point. UTF-16 decoding is not applied to the elements. - 1. Let _parseResult_ be ParsePattern(_patternText_, _u_). + 1. Let _parseResult_ be ParsePattern(_patternText_, _u_, _v_). 1. If _parseResult_ is a non-empty List of *SyntaxError* objects, throw a *SyntaxError* exception. 1. Assert: _parseResult_ is a |Pattern| Parse Node. 1. Set _obj_.[[OriginalSource]] to _P_. 1. Set _obj_.[[OriginalFlags]] to _F_. 1. Let _capturingGroupsCount_ be CountLeftCapturingParensWithin(_parseResult_). - 1. Let _rer_ be the RegExp Record { [[IgnoreCase]]: _i_, [[Multiline]]: _m_, [[DotAll]]: _s_, [[Unicode]]: _u_, [[CapturingGroupsCount]]: _capturingGroupsCount_ }. + 1. Let _rer_ be the RegExp Record { [[IgnoreCase]]: _i_, [[Multiline]]: _m_, [[DotAll]]: _s_, [[Unicode]]: _u_, [[UnicodeSets]]: _v_, [[CapturingGroupsCount]]: _capturingGroupsCount_ }. 1. Set _obj_.[[RegExpRecord]] to _rer_. 1. Set _obj_.[[RegExpMatcher]] to CompilePattern of _parseResult_ with argument _rer_. 1. Perform ? Set(_obj_, *"lastIndex"*, *+0*𝔽, *true*). @@ -36942,17 +38275,23 @@

        Static Semantics: ParsePattern ( _patternText_: a sequence of Unicode code points, _u_: a Boolean, + _v_: a Boolean, ): a Parse Node or a non-empty List of *SyntaxError* objects

        + +

        This section is amended in .

        +
        - 1. If _u_ is *true*, then - 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[+UnicodeMode, +N]|). + 1. If _v_ is *true* and _u_ is *true*, then + 1. Let _parseResult_ be a List containing one or more *SyntaxError* objects. + 1. Else if _v_ is *true*, then + 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[+UnicodeMode, +UnicodeSetsMode, +NamedCaptureGroups]|). + 1. Else if _u_ is *true*, then + 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[+UnicodeMode, ~UnicodeSetsMode, +NamedCaptureGroups]|). 1. Else, - 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[~UnicodeMode, ~N]|). - 1. If _parseResult_ is a Parse Node and _parseResult_ contains a |GroupName|, then - 1. Set _parseResult_ to ParseText(_patternText_, |Pattern[~UnicodeMode, +N]|). + 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[~UnicodeMode, ~UnicodeSetsMode, +NamedCaptureGroups]|). 1. Return _parseResult_.
        @@ -36964,7 +38303,8 @@

        The RegExp Constructor

        • is %RegExp%.
        • is the initial value of the *"RegExp"* property of the global object.
        • -
        • creates and initializes a new RegExp object when called as a function rather than as a constructor. Thus the function call `RegExp(…)` is equivalent to the object creation expression `new RegExp(…)` with the same arguments.
        • +
        • creates and initializes a new RegExp object when called as a constructor.
        • +
        • when called as a function rather than as a constructor, returns either a new RegExp object, or the argument itself if the only argument is a RegExp object.
        • may be used as the value of an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified RegExp behaviour must include a `super` call to the RegExp constructor to create and initialize subclass instances with the necessary internal slots.
        @@ -36978,7 +38318,8 @@

        RegExp ( _pattern_, _flags_ )

        1. If _patternIsRegExp_ is *true* and _flags_ is *undefined*, then 1. Let _patternConstructor_ be ? Get(_pattern_, *"constructor"*). 1. If SameValue(_newTarget_, _patternConstructor_) is *true*, return _pattern_. - 1. Else, let _newTarget_ be NewTarget. + 1. Else, + 1. Let _newTarget_ be NewTarget. 1. If _pattern_ is an Object and _pattern_ has a [[RegExpMatcher]] internal slot, then 1. Let _P_ be _pattern_.[[OriginalSource]]. 1. If _flags_ is *undefined*, let _F_ be _pattern_.[[OriginalFlags]]. @@ -36987,7 +38328,8 @@

        RegExp ( _pattern_, _flags_ )

        1. Let _P_ be ? Get(_pattern_, *"source"*). 1. If _flags_ is *undefined*, then 1. Let _F_ be ? Get(_pattern_, *"flags"*). - 1. Else, let _F_ be _flags_. + 1. Else, + 1. Let _F_ be _flags_. 1. Else, 1. Let _P_ be _pattern_. 1. Let _F_ be _flags_. @@ -37086,6 +38428,8 @@

        get RegExp.prototype.flags

        1. If _dotAll_ is *true*, append the code unit 0x0073 (LATIN SMALL LETTER S) to _codeUnits_. 1. Let _unicode_ be ToBoolean(? Get(_R_, *"unicode"*)). 1. If _unicode_ is *true*, append the code unit 0x0075 (LATIN SMALL LETTER U) to _codeUnits_. + 1. Let _unicodeSets_ be ToBoolean(? Get(_R_, *"unicodeSets"*)). + 1. If _unicodeSets_ is *true*, append the code unit 0x0076 (LATIN SMALL LETTER V) to _codeUnits_. 1. Let _sticky_ be ToBoolean(? Get(_R_, *"sticky"*)). 1. If _sticky_ is *true*, append the code unit 0x0079 (LATIN SMALL LETTER Y) to _codeUnits_. 1. Return the String value whose code units are the elements of the List _codeUnits_. If _codeUnits_ has no elements, the empty String is returned. @@ -37153,7 +38497,7 @@

        RegExp.prototype [ @@match ] ( _string_ )

        1. If _flags_ does not contain *"g"*, then 1. Return ? RegExpExec(_rx_, _S_). 1. Else, - 1. If _flags_ contains *"u"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*. + 1. If _flags_ contains *"u"* or _flags_ contains *"v"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*. 1. Perform ? Set(_rx_, *"lastIndex"*, *+0*𝔽, *true*). 1. Let _A_ be ! ArrayCreate(0). 1. Let _n_ be 0. @@ -37191,7 +38535,7 @@

        RegExp.prototype [ @@matchAll ] ( _string_ )

        1. Perform ? Set(_matcher_, *"lastIndex"*, _lastIndex_, *true*). 1. If _flags_ contains *"g"*, let _global_ be *true*. 1. Else, let _global_ be *false*. - 1. If _flags_ contains *"u"*, let _fullUnicode_ be *true*. + 1. If _flags_ contains *"u"* or _flags_ contains *"v"*, let _fullUnicode_ be *true*. 1. Else, let _fullUnicode_ be *false*. 1. Return CreateRegExpStringIterator(_matcher_, _S_, _global_, _fullUnicode_). @@ -37222,20 +38566,22 @@

        RegExp.prototype [ @@replace ] ( _string_, _replaceValue_ )

        1. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)). 1. If _flags_ contains *"g"*, let _global_ be *true*. Otherwise, let _global_ be *false*. 1. If _global_ is *true*, then - 1. If _flags_ contains *"u"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*. 1. Perform ? Set(_rx_, *"lastIndex"*, *+0*𝔽, *true*). 1. Let _results_ be a new empty List. 1. Let _done_ be *false*. 1. Repeat, while _done_ is *false*, 1. Let _result_ be ? RegExpExec(_rx_, _S_). - 1. If _result_ is *null*, set _done_ to *true*. + 1. If _result_ is *null*, then + 1. Set _done_ to *true*. 1. Else, 1. Append _result_ to _results_. - 1. If _global_ is *false*, set _done_ to *true*. + 1. If _global_ is *false*, then + 1. Set _done_ to *true*. 1. Else, 1. Let _matchStr_ be ? ToString(? Get(_result_, *"0"*)). 1. If _matchStr_ is the empty String, then 1. Let _thisIndex_ be ℝ(? ToLength(? Get(_rx_, *"lastIndex"*))). + 1. If _flags_ contains *"u"* or _flags_ contains *"v"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*. 1. Let _nextIndex_ be AdvanceStringIndex(_S_, _thisIndex_, _fullUnicode_). 1. Perform ? Set(_rx_, *"lastIndex"*, 𝔽(_nextIndex_), *true*). 1. Let _accumulatedResult_ be the empty String. @@ -37285,7 +38631,7 @@

        RegExp.prototype [ @@search ] ( _string_ )

        1. If _rx_ is not an Object, throw a *TypeError* exception. 1. Let _S_ be ? ToString(_string_). 1. Let _previousLastIndex_ be ? Get(_rx_, *"lastIndex"*). - 1. If SameValue(_previousLastIndex_, *+0*𝔽) is *false*, then + 1. If _previousLastIndex_ is not *+0*𝔽, then 1. Perform ? Set(_rx_, *"lastIndex"*, *+0*𝔽, *true*). 1. Let _result_ be ? RegExpExec(_rx_, _S_). 1. Let _currentLastIndex_ be ? Get(_rx_, *"lastIndex"*). @@ -37325,7 +38671,13 @@

        - 1. Let _S_ be a String in the form of a |Pattern[~UnicodeMode]| (|Pattern[+UnicodeMode]| if _F_ contains *"u"*) equivalent to _P_ interpreted as UTF-16 encoded Unicode code points (), in which certain code points are escaped as described below. _S_ may or may not be identical to _P_; however, the Abstract Closure that would result from evaluating _S_ as a |Pattern[~UnicodeMode]| (|Pattern[+UnicodeMode]| if _F_ contains *"u"*) must behave identically to the Abstract Closure given by the constructed object's [[RegExpMatcher]] internal slot. Multiple calls to this abstract operation using the same values for _P_ and _F_ must produce identical results. + 1. If _F_ contains *"v"*, then + 1. Let _patternSymbol_ be |Pattern[+UnicodeMode, +UnicodeSetsMode]|. + 1. Else if _F_ contains *"u"*, then + 1. Let _patternSymbol_ be |Pattern[+UnicodeMode, ~UnicodeSetsMode]|. + 1. Else, + 1. Let _patternSymbol_ be |Pattern[~UnicodeMode, ~UnicodeSetsMode]|. + 1. Let _S_ be a String in the form of a _patternSymbol_ equivalent to _P_ interpreted as UTF-16 encoded Unicode code points (), in which certain code points are escaped as described below. _S_ may or may not differ from _P_; however, the Abstract Closure that would result from evaluating _S_ as a _patternSymbol_ must behave identically to the Abstract Closure given by the constructed object's [[RegExpMatcher]] internal slot. Multiple calls to this abstract operation using the same values for _P_ and _F_ must produce identical results. 1. The code points `/` or any |LineTerminator| occurring in the pattern shall be escaped in _S_ as necessary to ensure that the string-concatenation of *"/"*, _S_, *"/"*, and _F_ can be parsed (in an appropriate lexical context) as a |RegularExpressionLiteral| that behaves identically to the constructed regular expression. For example, if _P_ is *"/"*, then _S_ could be *"\\/"* or *"\\u002F"*, among other possibilities, but not *"/"*, because `///` followed by _F_ would be parsed as a |SingleLineComment| rather than a |RegularExpressionLiteral|. If _P_ is the empty String, this specification can be met by letting _S_ be *"(?:)"*. 1. Return _S_. @@ -37351,7 +38703,7 @@

        RegExp.prototype [ @@split ] ( _string_, _limit_ )

        1. Let _S_ be ? ToString(_string_). 1. Let _C_ be ? SpeciesConstructor(_rx_, %RegExp%). 1. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)). - 1. If _flags_ contains *"u"*, let _unicodeMatching_ be *true*. + 1. If _flags_ contains *"u"* or _flags_ contains *"v"*, let _unicodeMatching_ be *true*. 1. Else, let _unicodeMatching_ be *false*. 1. If _flags_ contains *"y"*, let _newFlags_ be _flags_. 1. Else, let _newFlags_ be the string-concatenation of _flags_ and *"y"*. @@ -37359,23 +38711,25 @@

        RegExp.prototype [ @@split ] ( _string_, _limit_ )

        1. Let _A_ be ! ArrayCreate(0). 1. Let _lengthA_ be 0. 1. If _limit_ is *undefined*, let _lim_ be 232 - 1; else let _lim_ be ℝ(? ToUint32(_limit_)). - 1. If _lim_ is 0, return _A_. - 1. Let _size_ be the length of _S_. - 1. If _size_ is 0, then + 1. If _lim_ = 0, return _A_. + 1. If _S_ is the empty String, then 1. Let _z_ be ? RegExpExec(_splitter_, _S_). 1. If _z_ is not *null*, return _A_. 1. Perform ! CreateDataPropertyOrThrow(_A_, *"0"*, _S_). 1. Return _A_. + 1. Let _size_ be the length of _S_. 1. Let _p_ be 0. 1. Let _q_ be _p_. 1. Repeat, while _q_ < _size_, 1. Perform ? Set(_splitter_, *"lastIndex"*, 𝔽(_q_), *true*). 1. Let _z_ be ? RegExpExec(_splitter_, _S_). - 1. If _z_ is *null*, set _q_ to AdvanceStringIndex(_S_, _q_, _unicodeMatching_). + 1. If _z_ is *null*, then + 1. Set _q_ to AdvanceStringIndex(_S_, _q_, _unicodeMatching_). 1. Else, 1. Let _e_ be ℝ(? ToLength(? Get(_splitter_, *"lastIndex"*))). 1. Set _e_ to min(_e_, _size_). - 1. If _e_ = _p_, set _q_ to AdvanceStringIndex(_S_, _q_, _unicodeMatching_). + 1. If _e_ = _p_, then + 1. Set _q_ to AdvanceStringIndex(_S_, _q_, _unicodeMatching_). 1. Else, 1. Let _T_ be the substring of _S_ from _p_ to _q_. 1. Perform ! CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_lengthA_)), _T_). @@ -37448,6 +38802,16 @@

        get RegExp.prototype.unicode

        1. Return ? RegExpHasFlag(_R_, _cu_).
        + + +

        get RegExp.prototype.unicodeSets

        +

        `RegExp.prototype.unicodeSets` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        + + 1. Let _R_ be the *this* value. + 1. Let _cu_ be the code unit 0x0076 (LATIN SMALL LETTER V). + 1. Return ? RegExpHasFlag(_R_, _cu_). + +
        @@ -37494,7 +38858,7 @@

        1. If _flags_ contains *"d"*, let _hasIndices_ be *true*; else let _hasIndices_ be *false*. 1. If _global_ is *false* and _sticky_ is *false*, set _lastIndex_ to 0. 1. Let _matcher_ be _R_.[[RegExpMatcher]]. - 1. If _flags_ contains *"u"*, let _fullUnicode_ be *true*; else let _fullUnicode_ be *false*. + 1. If _flags_ contains *"u"* or _flags_ contains *"v"*, let _fullUnicode_ be *true*; else let _fullUnicode_ be *false*. 1. Let _matchSucceeded_ be *false*. 1. If _fullUnicode_ is *true*, let _input_ be StringToCodePoints(_S_). Otherwise, let _input_ be a List whose elements are the code units that are the elements of _S_. 1. NOTE: Each element of _input_ is considered to be a character. @@ -37513,11 +38877,11 @@

        1. Else, 1. Assert: _r_ is a MatchState. 1. Set _matchSucceeded_ to *true*. - 1. Let _e_ be _r_'s _endIndex_ value. + 1. Let _e_ be _r_.[[EndIndex]]. 1. If _fullUnicode_ is *true*, set _e_ to GetStringIndex(_S_, _e_). 1. If _global_ is *true* or _sticky_ is *true*, then 1. Perform ? Set(_R_, *"lastIndex"*, 𝔽(_e_), *true*). - 1. Let _n_ be the number of elements in _r_'s _captures_ List. + 1. Let _n_ be the number of elements in _r_.[[Captures]]. 1. Assert: _n_ = _R_.[[RegExpRecord]].[[CapturingGroupsCount]]. 1. Assert: _n_ < 232 - 1. 1. Let _A_ be ! ArrayCreate(_n_ + 1). @@ -37538,13 +38902,13 @@

        1. Let _hasGroups_ be *false*. 1. Perform ! CreateDataPropertyOrThrow(_A_, *"groups"*, _groups_). 1. For each integer _i_ such that 1 ≤ _i_ ≤ _n_, in ascending order, do - 1. Let _captureI_ be _i_th element of _r_'s _captures_ List. + 1. Let _captureI_ be _i_th element of _r_.[[Captures]]. 1. If _captureI_ is *undefined*, then 1. Let _capturedValue_ be *undefined*. 1. Append *undefined* to _indices_. 1. Else, - 1. Let _captureStart_ be _captureI_'s _startIndex_. - 1. Let _captureEnd_ be _captureI_'s _endIndex_. + 1. Let _captureStart_ be _captureI_.[[StartIndex]]. + 1. Let _captureEnd_ be _captureI_.[[EndIndex]]. 1. If _fullUnicode_ is *true*, then 1. Set _captureStart_ to GetStringIndex(_S_, _captureStart_). 1. Set _captureEnd_ to GetStringIndex(_S_, _captureEnd_). @@ -37645,8 +39009,7 @@

        - 1. Assert: _match_.[[StartIndex]] is a non-negative integer less than or equal to the length of _S_. - 1. Assert: _match_.[[EndIndex]] is an integer in the inclusive interval from _match_.[[StartIndex]] to the length of _S_. + 1. Assert: _match_.[[StartIndex]] ≤ _match_.[[EndIndex]] ≤ the length of _S_. 1. Return the substring of _S_ from _match_.[[StartIndex]] to _match_.[[EndIndex]]. @@ -37661,8 +39024,7 @@

        - 1. Assert: _match_.[[StartIndex]] is a non-negative integer less than or equal to the length of _S_. - 1. Assert: _match_.[[EndIndex]] is an integer in the inclusive interval from _match_.[[StartIndex]] to the length of _S_. + 1. Assert: _match_.[[StartIndex]] ≤ _match_.[[EndIndex]] ≤ the length of _S_. 1. Return CreateArrayFromList(« 𝔽(_match_.[[StartIndex]]), 𝔽(_match_.[[EndIndex]]) »). @@ -37795,7 +39157,6 @@

        The Array Constructor

      • also creates and initializes a new Array when called as a function rather than as a constructor. Thus the function call `Array(…)` is equivalent to the object creation expression `new Array(…)` with the same arguments.
      • is a function whose behaviour differs based upon the number and types of its arguments.
      • may be used as the value of an `extends` clause of a class definition. Subclass constructors that intend to inherit the exotic Array behaviour must include a `super` call to the Array constructor to initialize subclass instances that are Array exotic objects. However, most of the `Array.prototype` methods are generic methods that are not dependent upon their *this* value being an Array exotic object.
      • -
      • has a *"length"* property whose value is *1*𝔽.
      • @@ -37838,6 +39199,7 @@

        Properties of the Array Constructor

        The Array constructor:

        • has a [[Prototype]] internal slot whose value is %Function.prototype%.
        • +
        • has a *"length"* property whose value is *1*𝔽.
        • has the following properties:
        @@ -37846,7 +39208,8 @@

        Array.from ( _items_ [ , _mapfn_ [ , _thisArg_ ] ] )

        This method performs the following steps when called:

        1. Let _C_ be the *this* value. - 1. If _mapfn_ is *undefined*, let _mapping_ be *false*. + 1. If _mapfn_ is *undefined*, then + 1. Let _mapping_ be *false*. 1. Else, 1. If IsCallable(_mapfn_) is *false*, throw a *TypeError* exception. 1. Let _mapping_ be *true*. @@ -37856,22 +39219,22 @@

        Array.from ( _items_ [ , _mapfn_ [ , _thisArg_ ] ] )

        1. Let _A_ be ? Construct(_C_). 1. Else, 1. Let _A_ be ! ArrayCreate(0). - 1. Let _iteratorRecord_ be ? GetIterator(_items_, ~sync~, _usingIterator_). + 1. Let _iteratorRecord_ be ? GetIteratorFromMethod(_items_, _usingIterator_). 1. Let _k_ be 0. 1. Repeat, 1. If _k_ ≥ 253 - 1, then 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). 1. Return ? IteratorClose(_iteratorRecord_, _error_). 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _next_ be ? IteratorStep(_iteratorRecord_). - 1. If _next_ is *false*, then + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, then 1. Perform ? Set(_A_, *"length"*, 𝔽(_k_), *true*). 1. Return _A_. - 1. Let _nextValue_ be ? IteratorValue(_next_). 1. If _mapping_ is *true*, then - 1. Let _mappedValue_ be Completion(Call(_mapfn_, _thisArg_, « _nextValue_, 𝔽(_k_) »)). + 1. Let _mappedValue_ be Completion(Call(_mapfn_, _thisArg_, « _next_, 𝔽(_k_) »)). 1. IfAbruptCloseIterator(_mappedValue_, _iteratorRecord_). - 1. Else, let _mappedValue_ be _nextValue_. + 1. Else, + 1. Let _mappedValue_ be _next_. 1. Let _defineStatus_ be Completion(CreateDataPropertyOrThrow(_A_, _Pk_, _mappedValue_)). 1. IfAbruptCloseIterator(_defineStatus_, _iteratorRecord_). 1. Set _k_ to _k_ + 1. @@ -37888,7 +39251,8 @@

        Array.from ( _items_ [ , _mapfn_ [ , _thisArg_ ] ] )

        1. Let _kValue_ be ? Get(_arrayLike_, _Pk_). 1. If _mapping_ is *true*, then 1. Let _mappedValue_ be ? Call(_mapfn_, _thisArg_, « _kValue_, 𝔽(_k_) »). - 1. Else, let _mappedValue_ be _kValue_. + 1. Else, + 1. Let _mappedValue_ be _kValue_. 1. Perform ? CreateDataPropertyOrThrow(_A_, _Pk_, _mappedValue_). 1. Set _k_ to _k_ + 1. 1. Perform ? Set(_A_, *"length"*, 𝔽(_len_), *true*). @@ -37995,10 +39359,10 @@

        Array.prototype.concat ( ..._items_ )

        1. If _n_ + _len_ > 253 - 1, throw a *TypeError* exception. 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, - 1. Let _P_ be ! ToString(𝔽(_k_)). - 1. Let _exists_ be ? HasProperty(_E_, _P_). + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. Let _exists_ be ? HasProperty(_E_, _Pk_). 1. If _exists_ is *true*, then - 1. Let _subElement_ be ? Get(_E_, _P_). + 1. Let _subElement_ be ? Get(_E_, _Pk_). 1. Perform ? CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_n_)), _subElement_). 1. Set _n_ to _n_ + 1. 1. Set _k_ to _k_ + 1. @@ -38012,7 +39376,7 @@

        Array.prototype.concat ( ..._items_ )

        The *"length"* property of this method is *1*𝔽.

        -

        The explicit setting of the *"length"* property in step is necessary to ensure that its value is correct in situations where the trailing elements of the result Array are not present.

        +

        The explicit setting of the *"length"* property in step is intended to ensure the length is correct when the final non-empty element of _items_ has trailing holes or when _A_ is not a built-in Array.

        This method is intentionally generic; it does not require that its *this* value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

        @@ -38053,15 +39417,15 @@

        Array.prototype.copyWithin ( _target_, _start_ [ , _end_ ] )

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). 1. Let _relativeTarget_ be ? ToIntegerOrInfinity(_target_). - 1. If _relativeTarget_ is -∞, let _to_ be 0. + 1. If _relativeTarget_ = -∞, let _to_ be 0. 1. Else if _relativeTarget_ < 0, let _to_ be max(_len_ + _relativeTarget_, 0). 1. Else, let _to_ be min(_relativeTarget_, _len_). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _from_ be 0. + 1. If _relativeStart_ = -∞, let _from_ be 0. 1. Else if _relativeStart_ < 0, let _from_ be max(_len_ + _relativeStart_, 0). 1. Else, let _from_ be min(_relativeStart_, _len_). 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. + 1. If _relativeEnd_ = -∞, let _final_ be 0. 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). 1. Else, let _final_ be min(_relativeEnd_, _len_). 1. Let _count_ be min(_final_ - _from_, _len_ - _to_). @@ -38076,8 +39440,8 @@

        Array.prototype.copyWithin ( _target_, _start_ [ , _end_ ] )

        1. Let _toKey_ be ! ToString(𝔽(_to_)). 1. Let _fromPresent_ be ? HasProperty(_O_, _fromKey_). 1. If _fromPresent_ is *true*, then - 1. Let _fromVal_ be ? Get(_O_, _fromKey_). - 1. Perform ? Set(_O_, _toKey_, _fromVal_, *true*). + 1. Let _fromValue_ be ? Get(_O_, _fromKey_). + 1. Perform ? Set(_O_, _toKey_, _fromValue_, *true*). 1. Else, 1. Assert: _fromPresent_ is *false*. 1. Perform ? DeletePropertyOrThrow(_O_, _toKey_). @@ -38103,7 +39467,7 @@

        Array.prototype.entries ( )

        Array.prototype.every ( _callbackfn_ [ , _thisArg_ ] )

        -

        _callbackfn_ should be a function that accepts three arguments and returns a value that is coercible to a Boolean value. `every` calls _callbackfn_ once for each element present in the array, in ascending order, until it finds one where _callbackfn_ returns *false*. If such an element is found, `every` immediately returns *false*. Otherwise, if _callbackfn_ returned *true* for all elements, `every` will return *true*. _callbackfn_ is called only for elements of the array which actually exist; it is not called for missing elements of the array.

        +

        _callbackfn_ should be a function that accepts three arguments and returns a value that is coercible to a Boolean value. `every` calls _callbackfn_ once for each element present in the array, in ascending order, until it finds one where _callbackfn_ returns *false*. If such an element is found, `every` immediately returns *false*. Otherwise, `every` returns *true*. _callbackfn_ is called only for elements of the array which actually exist; it is not called for missing elements of the array.

        If a _thisArg_ parameter is provided, it will be used as the *this* value for each invocation of _callbackfn_. If it is not provided, *undefined* is used instead.

        _callbackfn_ is called with three arguments: the value of the element, the index of the element, and the object being traversed.

        `every` does not directly mutate the object on which it is called but the object may be mutated by the calls to _callbackfn_.

        @@ -38144,11 +39508,11 @@

        Array.prototype.fill ( _value_ [ , _start_ [ , _end_ ] ] )

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _k_ be 0. + 1. If _relativeStart_ = -∞, let _k_ be 0. 1. Else if _relativeStart_ < 0, let _k_ be max(_len_ + _relativeStart_, 0). 1. Else, let _k_ be min(_relativeStart_, _len_). 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. + 1. If _relativeEnd_ = -∞, let _final_ be 0. 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). 1. Else, let _final_ be min(_relativeEnd_, _len_). 1. Repeat, while _k_ < _final_, @@ -38199,25 +39563,15 @@

        Array.prototype.filter ( _callbackfn_ [ , _thisArg_ ] )

        Array.prototype.find ( _predicate_ [ , _thisArg_ ] )

        -

        _predicate_ should be a function that accepts three arguments and returns a value that is coercible to a Boolean value. `find` calls _predicate_ once for each element of the array, in ascending order, until it finds one where _predicate_ returns *true*. If such an element is found, `find` immediately returns that element value. Otherwise, `find` returns *undefined*.

        -

        If a _thisArg_ parameter is provided, it will be used as the *this* value for each invocation of _predicate_. If it is not provided, *undefined* is used instead.

        -

        _predicate_ is called with three arguments: the value of the element, the index of the element, and the object being traversed.

        -

        `find` does not directly mutate the object on which it is called but the object may be mutated by the calls to _predicate_.

        -

        The range of elements processed by `find` is set before the first call to _predicate_. Elements that are appended to the array after the call to `find` begins will not be visited by _predicate_. If existing elements of the array are changed, their value as passed to _predicate_ will be the value at the time that `find` visits them; elements that are deleted after the call to `find` begins and before being visited are still visited and are either looked up from the prototype or are *undefined*.

        +

        This method calls _predicate_ once for each element of the array, in ascending index order, until it finds one where _predicate_ returns a value that coerces to *true*. If such an element is found, `find` immediately returns that element value. Otherwise, `find` returns *undefined*.

        +

        See FindViaPredicate for additional information.

        This method performs the following steps when called:

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be 0. - 1. Repeat, while _k_ < _len_, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ? Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return _kValue_. - 1. Set _k_ to _k_ + 1. - 1. Return *undefined*. + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~ascending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Value]].

        This method is intentionally generic; it does not require that its *this* value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

        @@ -38227,25 +39581,15 @@

        Array.prototype.find ( _predicate_ [ , _thisArg_ ] )

        Array.prototype.findIndex ( _predicate_ [ , _thisArg_ ] )

        -

        _predicate_ should be a function that accepts three arguments and returns a value that is coercible to a Boolean value. `findIndex` calls _predicate_ once for each element of the array, in ascending order, until it finds one where _predicate_ returns *true*. If such an element is found, `findIndex` immediately returns the index of that element value. Otherwise, `findIndex` returns -1.

        -

        If a _thisArg_ parameter is provided, it will be used as the *this* value for each invocation of _predicate_. If it is not provided, *undefined* is used instead.

        -

        _predicate_ is called with three arguments: the value of the element, the index of the element, and the object being traversed.

        -

        `findIndex` does not directly mutate the object on which it is called but the object may be mutated by the calls to _predicate_.

        -

        The range of elements processed by `findIndex` is set before the first call to _predicate_. Elements that are appended to the array after the call to `findIndex` begins will not be visited by _predicate_. If existing elements of the array are changed, their value as passed to _predicate_ will be the value at the time that `findIndex` visits them; elements that are deleted after the call to `findIndex` begins and before being visited are still visited and are either looked up from the prototype or are *undefined*.

        +

        This method calls _predicate_ once for each element of the array, in ascending index order, until it finds one where _predicate_ returns a value that coerces to *true*. If such an element is found, `findIndex` immediately returns the index of that element value. Otherwise, `findIndex` returns -1.

        +

        See FindViaPredicate for additional information.

        This method performs the following steps when called:

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be 0. - 1. Repeat, while _k_ < _len_, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ? Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return 𝔽(_k_). - 1. Set _k_ to _k_ + 1. - 1. Return *-1*𝔽. + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~ascending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Index]].

        This method is intentionally generic; it does not require that its *this* value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

        @@ -38255,25 +39599,15 @@

        Array.prototype.findIndex ( _predicate_ [ , _thisArg_ ] )

        Array.prototype.findLast ( _predicate_ [ , _thisArg_ ] )

        -

        _predicate_ should be a function that accepts three arguments and returns a value that is coercible to a Boolean value. `findLast` calls _predicate_ once for each element of the array, in descending index order, until it finds one where _predicate_ returns *true*. If such an element is found, `findLast` immediately returns that element value. Otherwise, `findLast` returns *undefined*.

        -

        If a _thisArg_ parameter is provided, it will be used as the *this* value for each invocation of _predicate_. If it is not provided, *undefined* is used instead.

        -

        _predicate_ is called with three arguments: the element, the index of the element in the array, and the object being traversed.

        -

        `findLast` does not directly mutate the object on which it is called but the object may be mutated by the calls to _predicate_.

        -

        The range of elements processed by `findLast` is set before the first call to _predicate_. Elements that are appended to the array after the call to `findLast` begins will not be visited by _predicate_. If existing elements of the array are changed, their value as passed to _predicate_ will be the value at the time that `findLast` visits them.

        +

        This method calls _predicate_ once for each element of the array, in descending index order, until it finds one where _predicate_ returns a value that coerces to *true*. If such an element is found, `findLast` immediately returns that element value. Otherwise, `findLast` returns *undefined*.

        +

        See FindViaPredicate for additional information.

        This method performs the following steps when called:

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be _len_ - 1. - 1. Repeat, while _k_ ≥ 0, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ? Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return _kValue_. - 1. Set _k_ to _k_ - 1. - 1. Return *undefined*. + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~descending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Value]].

        This method is intentionally generic; it does not require that its *this* value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.

        @@ -38283,29 +39617,55 @@

        Array.prototype.findLast ( _predicate_ [ , _thisArg_ ] )

        Array.prototype.findLastIndex ( _predicate_ [ , _thisArg_ ] )

        -

        _predicate_ should be a function that accepts three arguments and returns a value that is coercible to a Boolean value. `findLastIndex` calls _predicate_ once for each element of the array, in descending index order, until it finds one where _predicate_ returns *true*. If such an element is found, `findLastIndex` immediately returns the index of that element value. Otherwise, `findLastIndex` returns -1.

        -

        If a _thisArg_ parameter is provided, it will be used as the *this* value for each invocation of _predicate_. If it is not provided, *undefined* is used instead.

        -

        _predicate_ is called with three arguments: the element, the index of the element in the array, and the object being traversed.

        -

        `findLastIndex` does not directly mutate the object on which it is called but the object may be mutated by the calls to _predicate_.

        -

        The range of elements processed by `findLastIndex` is set before the first call to _predicate_. Elements that are appended to the array after the call to `findLastIndex` begins will not be visited by _predicate_. If existing elements of the array are changed, their value as passed to _predicate_ will be the value at the time that `findLastIndex` visits them.

        +

        This method calls _predicate_ once for each element of the array, in descending index order, until it finds one where _predicate_ returns a value that coerces to *true*. If such an element is found, `findLastIndex` immediately returns the index of that element value. Otherwise, `findLastIndex` returns -1.

        +

        See FindViaPredicate for additional information.

        This method performs the following steps when called:

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be _len_ - 1. - 1. Repeat, while _k_ ≥ 0, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ? Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return 𝔽(_k_). - 1. Set _k_ to _k_ - 1. - 1. Return *-1*𝔽. + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~descending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Index]].

        This method is intentionally generic; it does not require that its *this* value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.

        + + +

        + FindViaPredicate ( + _O_: an Object, + _len_: a non-negative integer, + _direction_: ~ascending~ or ~descending~, + _predicate_: an ECMAScript language value, + _thisArg_: an ECMAScript language value, + ): either a normal completion containing a Record with fields [[Index]] (an integral Number) and [[Value]] (an ECMAScript language value) or a throw completion +

        +
        +
        description
        +
        +

        _O_ should be an array-like object or a TypedArray. This operation calls _predicate_ once for each element of _O_, in either ascending index order or descending index order (as indicated by _direction_), until it finds one where _predicate_ returns a value that coerces to *true*. At that point, this operation returns a Record that gives the index and value of the element found. If no such element is found, this operation returns a Record that specifies *-1*𝔽 for the index and *undefined* for the value.

        +

        _predicate_ should be a function. When called for an element of the array, it is passed three arguments: the value of the element, the index of the element, and the object being traversed. Its return value will be coerced to a Boolean value.

        +

        _thisArg_ will be used as the *this* value for each invocation of _predicate_.

        +

        This operation does not directly mutate the object on which it is called, but the object may be mutated by the calls to _predicate_.

        +

        The range of elements processed is set before the first call to _predicate_, just before the traversal begins. Elements that are appended to the array after this will not be visited by _predicate_. If existing elements of the array are changed, their value as passed to _predicate_ will be the value at the time that this operation visits them. Elements that are deleted after traversal begins and before being visited are still visited and are either looked up from the prototype or are *undefined*.

        +
        +
        + + 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. + 1. If _direction_ is ~ascending~, then + 1. Let _indices_ be a List of the integers in the interval from 0 (inclusive) to _len_ (exclusive), in ascending order. + 1. Else, + 1. Let _indices_ be a List of the integers in the interval from 0 (inclusive) to _len_ (exclusive), in descending order. + 1. For each integer _k_ of _indices_, do + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. NOTE: If _O_ is a TypedArray, the following invocation of Get will return a normal completion. + 1. Let _kValue_ be ? Get(_O_, _Pk_). + 1. Let _testResult_ be ? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »). + 1. If ToBoolean(_testResult_) is *true*, return the Record { [[Index]]: 𝔽(_k_), [[Value]]: _kValue_ }. + 1. Return the Record { [[Index]]: *-1*𝔽, [[Value]]: *undefined* }. + +
        @@ -38352,7 +39712,7 @@

        1. If _depth_ > 0, then 1. Set _shouldFlatten_ to ? IsArray(_element_). 1. If _shouldFlatten_ is *true*, then - 1. If _depth_ is +∞, let _newDepth_ be +∞. + 1. If _depth_ = +∞, let _newDepth_ be +∞. 1. Else, let _newDepth_ be _depth_ - 1. 1. Let _elementLen_ be ? LengthOfArrayLike(_element_). 1. Set _targetIndex_ to ? FlattenIntoArray(_target_, _element_, _elementLen_, _targetIndex_, _newDepth_). @@ -38412,17 +39772,17 @@

        Array.prototype.forEach ( _callbackfn_ [ , _thisArg_ ] )

        Array.prototype.includes ( _searchElement_ [ , _fromIndex_ ] )

        This method compares _searchElement_ to the elements of the array, in ascending order, using the SameValueZero algorithm, and if found at any position, returns *true*; otherwise, it returns *false*.

        -

        The optional second argument _fromIndex_ defaults to *+0*𝔽 (i.e. the whole array is searched). If it is greater than or equal to the length of the array, *false* is returned, i.e. the array will not be searched. If it is less than *+0*𝔽, it is used as the offset from the end of the array to compute _fromIndex_. If the computed index is less than *+0*𝔽, the whole array will be searched.

        +

        The optional second argument _fromIndex_ defaults to *+0*𝔽 (i.e. the whole array is searched). If it is greater than or equal to the length of the array, *false* is returned, i.e. the array will not be searched. If it is less than *-0*𝔽, it is used as the offset from the end of the array to compute _fromIndex_. If the computed index is less than or equal to *+0*𝔽, the whole array will be searched.

        This method performs the following steps when called:

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). - 1. If _len_ is 0, return *false*. + 1. If _len_ = 0, return *false*. 1. Let _n_ be ? ToIntegerOrInfinity(_fromIndex_). 1. Assert: If _fromIndex_ is *undefined*, then _n_ is 0. - 1. If _n_ is +∞, return *false*. - 1. Else if _n_ is -∞, set _n_ to 0. + 1. If _n_ = +∞, return *false*. + 1. Else if _n_ = -∞, set _n_ to 0. 1. If _n_ ≥ 0, then 1. Let _k_ be _n_. 1. Else, @@ -38446,28 +39806,28 @@

        Array.prototype.includes ( _searchElement_ [ , _fromIndex_ ] )

        Array.prototype.indexOf ( _searchElement_ [ , _fromIndex_ ] )

        This method compares _searchElement_ to the elements of the array, in ascending order, using the IsStrictlyEqual algorithm, and if found at one or more indices, returns the smallest such index; otherwise, it returns *-1*𝔽.

        -

        The optional second argument _fromIndex_ defaults to *+0*𝔽 (i.e. the whole array is searched). If it is greater than or equal to the length of the array, *-1*𝔽 is returned, i.e. the array will not be searched. If it is less than *+0*𝔽, it is used as the offset from the end of the array to compute _fromIndex_. If the computed index is less than *+0*𝔽, the whole array will be searched.

        +

        The optional second argument _fromIndex_ defaults to *+0*𝔽 (i.e. the whole array is searched). If it is greater than or equal to the length of the array, *-1*𝔽 is returned, i.e. the array will not be searched. If it is less than *-0*𝔽, it is used as the offset from the end of the array to compute _fromIndex_. If the computed index is less than or equal to *+0*𝔽, the whole array will be searched.

        This method performs the following steps when called:

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). - 1. If _len_ is 0, return *-1*𝔽. + 1. If _len_ = 0, return *-1*𝔽. 1. Let _n_ be ? ToIntegerOrInfinity(_fromIndex_). 1. Assert: If _fromIndex_ is *undefined*, then _n_ is 0. - 1. If _n_ is +∞, return *-1*𝔽. - 1. Else if _n_ is -∞, set _n_ to 0. + 1. If _n_ = +∞, return *-1*𝔽. + 1. Else if _n_ = -∞, set _n_ to 0. 1. If _n_ ≥ 0, then 1. Let _k_ be _n_. 1. Else, 1. Let _k_ be _len_ + _n_. 1. If _k_ < 0, set _k_ to 0. 1. Repeat, while _k_ < _len_, - 1. Let _kPresent_ be ? HasProperty(_O_, ! ToString(𝔽(_k_))). + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. Let _kPresent_ be ? HasProperty(_O_, _Pk_). 1. If _kPresent_ is *true*, then - 1. Let _elementK_ be ? Get(_O_, ! ToString(𝔽(_k_))). - 1. Let _same_ be IsStrictlyEqual(_searchElement_, _elementK_). - 1. If _same_ is *true*, return 𝔽(_k_). + 1. Let _elementK_ be ? Get(_O_, _Pk_). + 1. If IsStrictlyEqual(_searchElement_, _elementK_) is *true*, return 𝔽(_k_). 1. Set _k_ to _k_ + 1. 1. Return *-1*𝔽. @@ -38490,8 +39850,9 @@

        Array.prototype.join ( _separator_ )

        1. Repeat, while _k_ < _len_, 1. If _k_ > 0, set _R_ to the string-concatenation of _R_ and _sep_. 1. Let _element_ be ? Get(_O_, ! ToString(𝔽(_k_))). - 1. If _element_ is *undefined* or *null*, let _next_ be the empty String; otherwise, let _next_ be ? ToString(_element_). - 1. Set _R_ to the string-concatenation of _R_ and _next_. + 1. If _element_ is neither *undefined* nor *null*, then + 1. Let _S_ be ? ToString(_element_). + 1. Set _R_ to the string-concatenation of _R_ and _S_. 1. Set _k_ to _k_ + 1. 1. Return _R_.
        @@ -38513,25 +39874,25 @@

        Array.prototype.keys ( )

        Array.prototype.lastIndexOf ( _searchElement_ [ , _fromIndex_ ] )

        This method compares _searchElement_ to the elements of the array in descending order using the IsStrictlyEqual algorithm, and if found at one or more indices, returns the largest such index; otherwise, it returns *-1*𝔽.

        -

        The optional second argument _fromIndex_ defaults to the array's length minus one (i.e. the whole array is searched). If it is greater than or equal to the length of the array, the whole array will be searched. If it is less than *+0*𝔽, it is used as the offset from the end of the array to compute _fromIndex_. If the computed index is less than *+0*𝔽, *-1*𝔽 is returned.

        +

        The optional second argument _fromIndex_ defaults to the array's length minus one (i.e. the whole array is searched). If it is greater than or equal to the length of the array, the whole array will be searched. If it is less than *-0*𝔽, it is used as the offset from the end of the array to compute _fromIndex_. If the computed index is less than or equal to *+0*𝔽, *-1*𝔽 is returned.

        This method performs the following steps when called:

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). - 1. If _len_ is 0, return *-1*𝔽. + 1. If _len_ = 0, return *-1*𝔽. 1. If _fromIndex_ is present, let _n_ be ? ToIntegerOrInfinity(_fromIndex_); else let _n_ be _len_ - 1. - 1. If _n_ is -∞, return *-1*𝔽. + 1. If _n_ = -∞, return *-1*𝔽. 1. If _n_ ≥ 0, then 1. Let _k_ be min(_n_, _len_ - 1). 1. Else, 1. Let _k_ be _len_ + _n_. 1. Repeat, while _k_ ≥ 0, - 1. Let _kPresent_ be ? HasProperty(_O_, ! ToString(𝔽(_k_))). + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. Let _kPresent_ be ? HasProperty(_O_, _Pk_). 1. If _kPresent_ is *true*, then - 1. Let _elementK_ be ? Get(_O_, ! ToString(𝔽(_k_))). - 1. Let _same_ be IsStrictlyEqual(_searchElement_, _elementK_). - 1. If _same_ is *true*, return 𝔽(_k_). + 1. Let _elementK_ be ? Get(_O_, _Pk_). + 1. If IsStrictlyEqual(_searchElement_, _elementK_) is *true*, return 𝔽(_k_). 1. Set _k_ to _k_ - 1. 1. Return *-1*𝔽. @@ -38624,7 +39985,7 @@

        Array.prototype.push ( ..._items_ )

        Array.prototype.reduce ( _callbackfn_ [ , _initialValue_ ] )

        _callbackfn_ should be a function that takes four arguments. `reduce` calls the callback, as a function, once for each element after the first element present in the array, in ascending order.

        -

        _callbackfn_ is called with four arguments: the _previousValue_ (value from the previous call to _callbackfn_), the _currentValue_ (value of the current element), the _currentIndex_, and the object being traversed. The first time that callback is called, the _previousValue_ and _currentValue_ can be one of two values. If an _initialValue_ was supplied in the call to `reduce`, then _previousValue_ will be equal to _initialValue_ and _currentValue_ will be equal to the first value in the array. If no _initialValue_ was supplied, then _previousValue_ will be equal to the first value in the array and _currentValue_ will be equal to the second. It is a *TypeError* if the array contains no elements and _initialValue_ is not provided.

        +

        _callbackfn_ is called with four arguments: the _previousValue_ (value from the previous call to _callbackfn_), the _currentValue_ (value of the current element), the _currentIndex_, and the object being traversed. The first time that callback is called, the _previousValue_ and _currentValue_ can be one of two values. If an _initialValue_ was supplied in the call to `reduce`, then _previousValue_ will be _initialValue_ and _currentValue_ will be the first value in the array. If no _initialValue_ was supplied, then _previousValue_ will be the first value in the array and _currentValue_ will be the second. It is a *TypeError* if the array contains no elements and _initialValue_ is not provided.

        `reduce` does not directly mutate the object on which it is called but the object may be mutated by the calls to _callbackfn_.

        The range of elements processed by `reduce` is set before the first call to _callbackfn_. Elements that are appended to the array after the call to `reduce` begins will not be visited by _callbackfn_. If existing elements of the array are changed, their value as passed to _callbackfn_ will be the value at the time `reduce` visits them; elements that are deleted after the call to `reduce` begins and before being visited are not visited.

        @@ -38665,7 +40026,7 @@

        Array.prototype.reduce ( _callbackfn_ [ , _initialValue_ ] )

        Array.prototype.reduceRight ( _callbackfn_ [ , _initialValue_ ] )

        _callbackfn_ should be a function that takes four arguments. `reduceRight` calls the callback, as a function, once for each element after the first element present in the array, in descending order.

        -

        _callbackfn_ is called with four arguments: the _previousValue_ (value from the previous call to _callbackfn_), the _currentValue_ (value of the current element), the _currentIndex_, and the object being traversed. The first time the function is called, the _previousValue_ and _currentValue_ can be one of two values. If an _initialValue_ was supplied in the call to `reduceRight`, then _previousValue_ will be equal to _initialValue_ and _currentValue_ will be equal to the last value in the array. If no _initialValue_ was supplied, then _previousValue_ will be equal to the last value in the array and _currentValue_ will be equal to the second-to-last value. It is a *TypeError* if the array contains no elements and _initialValue_ is not provided.

        +

        _callbackfn_ is called with four arguments: the _previousValue_ (value from the previous call to _callbackfn_), the _currentValue_ (value of the current element), the _currentIndex_, and the object being traversed. The first time the function is called, the _previousValue_ and _currentValue_ can be one of two values. If an _initialValue_ was supplied in the call to `reduceRight`, then _previousValue_ will be _initialValue_ and _currentValue_ will be the last value in the array. If no _initialValue_ was supplied, then _previousValue_ will be the last value in the array and _currentValue_ will be the second-to-last value. It is a *TypeError* if the array contains no elements and _initialValue_ is not provided.

        `reduceRight` does not directly mutate the object on which it is called but the object may be mutated by the calls to _callbackfn_.

        The range of elements processed by `reduceRight` is set before the first call to _callbackfn_. Elements that are appended to the array after the call to `reduceRight` begins will not be visited by _callbackfn_. If existing elements of the array are changed by _callbackfn_, their value as passed to _callbackfn_ will be the value at the time `reduceRight` visits them; elements that are deleted after the call to `reduceRight` begins and before being visited are not visited.

        @@ -38674,7 +40035,7 @@

        Array.prototype.reduceRight ( _callbackfn_ [ , _initialValue_ ] )

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. - 1. If _len_ is 0 and _initialValue_ is not present, throw a *TypeError* exception. + 1. If _len_ = 0 and _initialValue_ is not present, throw a *TypeError* exception. 1. Let _k_ be _len_ - 1. 1. Let _accumulator_ be *undefined*. 1. If _initialValue_ is present, then @@ -38760,8 +40121,8 @@

        Array.prototype.shift ( )

        1. Let _to_ be ! ToString(𝔽(_k_ - 1)). 1. Let _fromPresent_ be ? HasProperty(_O_, _from_). 1. If _fromPresent_ is *true*, then - 1. Let _fromVal_ be ? Get(_O_, _from_). - 1. Perform ? Set(_O_, _to_, _fromVal_, *true*). + 1. Let _fromValue_ be ? Get(_O_, _from_). + 1. Perform ? Set(_O_, _to_, _fromValue_, *true*). 1. Else, 1. Assert: _fromPresent_ is *false*. 1. Perform ? DeletePropertyOrThrow(_O_, _to_). @@ -38783,11 +40144,11 @@

        Array.prototype.slice ( _start_, _end_ )

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _k_ be 0. + 1. If _relativeStart_ = -∞, let _k_ be 0. 1. Else if _relativeStart_ < 0, let _k_ be max(_len_ + _relativeStart_, 0). 1. Else, let _k_ be min(_relativeStart_, _len_). 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. + 1. If _relativeEnd_ = -∞, let _final_ be 0. 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). 1. Else, let _final_ be min(_relativeEnd_, _len_). 1. Let _count_ be max(_final_ - _k_, 0). @@ -38805,7 +40166,7 @@

        Array.prototype.slice ( _start_, _end_ )

        1. Return _A_. -

        The explicit setting of the *"length"* property of the result Array in step was necessary in previous editions of ECMAScript to ensure that its length was correct in situations where the trailing elements of the result Array were not present. Setting *"length"* became unnecessary starting in ES2015 when the result Array was initialized to its proper length rather than an empty Array but is carried forward to preserve backward compatibility.

        +

        The explicit setting of the *"length"* property in step is intended to ensure the length is correct even when _A_ is not a built-in Array.

        This method is intentionally generic; it does not require that its *this* value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

        @@ -38851,24 +40212,21 @@

        Array.prototype.sort ( _comparefn_ )

        1. Let _obj_ be ? ToObject(*this* value). 1. [id="step-array-sort-len"] Let _len_ be ? LengthOfArrayLike(_obj_). 1. Let _SortCompare_ be a new Abstract Closure with parameters (_x_, _y_) that captures _comparefn_ and performs the following steps when called: - 1. If _x_ and _y_ are both *undefined*, return *+0*𝔽. - 1. If _x_ is *undefined*, return *1*𝔽. - 1. If _y_ is *undefined*, return *-1*𝔽. - 1. If _comparefn_ is not *undefined*, then - 1. Let _v_ be ? ToNumber(? Call(_comparefn_, *undefined*, « _x_, _y_ »)). - 1. If _v_ is *NaN*, return *+0*𝔽. - 1. Return _v_. - 1. [id="step-sortcompare-tostring-x"] Let _xString_ be ? ToString(_x_). - 1. [id="step-sortcompare-tostring-y"] Let _yString_ be ? ToString(_y_). - 1. Let _xSmaller_ be ! IsLessThan(_xString_, _yString_, *true*). - 1. If _xSmaller_ is *true*, return *-1*𝔽. - 1. Let _ySmaller_ be ! IsLessThan(_yString_, _xString_, *true*). - 1. If _ySmaller_ is *true*, return *1*𝔽. - 1. Return *+0*𝔽. - 1. Return ? SortIndexedProperties(_obj_, _len_, _SortCompare_). + 1. Return ? CompareArrayElements(_x_, _y_, _comparefn_). + 1. [id="step-array-sortindexedproperties"] Let _sortedList_ be ? SortIndexedProperties(_obj_, _len_, _SortCompare_, ~skip-holes~). + 1. Let _itemCount_ be the number of elements in _sortedList_. + 1. Let _j_ be 0. + 1. Repeat, while _j_ < _itemCount_, + 1. Perform ? Set(_obj_, ! ToString(𝔽(_j_)), _sortedList_[_j_], *true*). + 1. Set _j_ to _j_ + 1. + 1. NOTE: The call to SortIndexedProperties in step uses ~skip-holes~. The remaining indices are deleted to preserve the number of holes that were detected and excluded from the sort. + 1. Repeat, while _j_ < _len_, + 1. Perform ? DeletePropertyOrThrow(_obj_, ! ToString(𝔽(_j_))). + 1. Set _j_ to _j_ + 1. + 1. Return _obj_. -

        Because non-existent property values always compare greater than *undefined* property values, and *undefined* always compares greater than any other value, *undefined* property values always sort to the end of the result, followed by non-existent property values.

        +

        Because non-existent property values always compare greater than *undefined* property values, and *undefined* always compares greater than any other value (see CompareArrayElements), *undefined* property values always sort to the end of the result, followed by non-existent property values.

        Method calls performed by the ToString abstract operations in steps and have the potential to cause _SortCompare_ to not behave as a consistent comparator.

        @@ -38883,7 +40241,8 @@

        _obj_: an Object, _len_: a non-negative integer, _SortCompare_: an Abstract Closure with two parameters, - ): either a normal completion containing an Object or an abrupt completion + _holes_: ~skip-holes~ or ~read-through-holes~, + ): either a normal completion containing a List of ECMAScript language values or a throw completion

        @@ -38892,21 +40251,17 @@

        1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kPresent_ be ? HasProperty(_obj_, _Pk_). - 1. If _kPresent_ is *true*, then + 1. If _holes_ is ~skip-holes~, then + 1. Let _kRead_ be ? HasProperty(_obj_, _Pk_). + 1. Else, + 1. Assert: _holes_ is ~read-through-holes~. + 1. Let _kRead_ be *true*. + 1. If _kRead_ is *true*, then 1. Let _kValue_ be ? Get(_obj_, _Pk_). 1. Append _kValue_ to _items_. 1. Set _k_ to _k_ + 1. - 1. Let _itemCount_ be the number of elements in _items_. 1. [id="step-array-sort"] Sort _items_ using an implementation-defined sequence of calls to _SortCompare_. If any such call returns an abrupt completion, stop before performing any further calls to _SortCompare_ and return that Completion Record. - 1. Let _j_ be 0. - 1. Repeat, while _j_ < _itemCount_, - 1. Perform ? Set(_obj_, ! ToString(𝔽(_j_)), _items_[_j_], *true*). - 1. Set _j_ to _j_ + 1. - 1. Repeat, while _j_ < _len_, - 1. Perform ? DeletePropertyOrThrow(_obj_, ! ToString(𝔽(_j_))). - 1. Set _j_ to _j_ + 1. - 1. Return _obj_. + 1. Return _items_.

        The sort order is the ordering of _items_ after completion of step of the algorithm above. The sort order is implementation-defined if _SortCompare_ is not a consistent comparator for the elements of _items_. When SortIndexedProperties is invoked by Array.prototype.sort, the sort order is also implementation-defined if _comparefn_ is *undefined*, and all applications of ToString, to any specific value passed as an argument to _SortCompare_, do not produce the same result.

        Unless the sort order is specified to be implementation-defined, it must satisfy all of the following conditions:

        @@ -38947,6 +40302,34 @@

        The above conditions are necessary and sufficient to ensure that _comparator_ divides the set _S_ into equivalence classes and that these equivalence classes are totally ordered.

        + + +

        + CompareArrayElements ( + _x_: an ECMAScript language value, + _y_: an ECMAScript language value, + _comparefn_: a function object or *undefined*, + ): either a normal completion containing a Number or an abrupt completion +

        +
        +
        + + 1. If _x_ and _y_ are both *undefined*, return *+0*𝔽. + 1. If _x_ is *undefined*, return *1*𝔽. + 1. If _y_ is *undefined*, return *-1*𝔽. + 1. If _comparefn_ is not *undefined*, then + 1. Let _v_ be ? ToNumber(? Call(_comparefn_, *undefined*, « _x_, _y_ »)). + 1. If _v_ is *NaN*, return *+0*𝔽. + 1. Return _v_. + 1. [id="step-sortcompare-tostring-x"] Let _xString_ be ? ToString(_x_). + 1. [id="step-sortcompare-tostring-y"] Let _yString_ be ? ToString(_y_). + 1. Let _xSmaller_ be ! IsLessThan(_xString_, _yString_, *true*). + 1. If _xSmaller_ is *true*, return *-1*𝔽. + 1. Let _ySmaller_ be ! IsLessThan(_yString_, _xString_, *true*). + 1. If _ySmaller_ is *true*, return *1*𝔽. + 1. Return *+0*𝔽. + +
        @@ -38959,7 +40342,7 @@

        Array.prototype.splice ( _start_, _deleteCount_, ..._items_ )

        1. Let _O_ be ? ToObject(*this* value). 1. Let _len_ be ? LengthOfArrayLike(_O_). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _actualStart_ be 0. + 1. If _relativeStart_ = -∞, let _actualStart_ be 0. 1. Else if _relativeStart_ < 0, let _actualStart_ be max(_len_ + _relativeStart_, 0). 1. Else, let _actualStart_ be min(_relativeStart_, _len_). 1. Let _itemCount_ be the number of elements in _items_. @@ -38979,7 +40362,7 @@

        Array.prototype.splice ( _start_, _deleteCount_, ..._items_ )

        1. Let _fromValue_ be ? Get(_O_, _from_). 1. Perform ? CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_k_)), _fromValue_). 1. Set _k_ to _k_ + 1. - 1. Perform ? Set(_A_, *"length"*, 𝔽(_actualDeleteCount_), *true*). + 1. [id="step-array-proto-splice-set-length"] Perform ? Set(_A_, *"length"*, 𝔽(_actualDeleteCount_), *true*). 1. If _itemCount_ < _actualDeleteCount_, then 1. Set _k_ to _actualStart_. 1. Repeat, while _k_ < (_len_ - _actualDeleteCount_), @@ -39010,11 +40393,11 @@

        Array.prototype.splice ( _start_, _deleteCount_, ..._items_ )

        1. For each element _E_ of _items_, do 1. Perform ? Set(_O_, ! ToString(𝔽(_k_)), _E_, *true*). 1. Set _k_ to _k_ + 1. - 1. [id="step-array-proto-splice-set-length"] Perform ? Set(_O_, *"length"*, 𝔽(_len_ - _actualDeleteCount_ + _itemCount_), *true*). + 1. [id="step-array-proto-splice-set-length-2"] Perform ? Set(_O_, *"length"*, 𝔽(_len_ - _actualDeleteCount_ + _itemCount_), *true*). 1. Return _A_. -

        The explicit setting of the *"length"* property of the result Array in step was necessary in previous editions of ECMAScript to ensure that its length was correct in situations where the trailing elements of the result Array were not present. Setting *"length"* became unnecessary starting in ES2015 when the result Array was initialized to its proper length rather than an empty Array but is carried forward to preserve backward compatibility.

        +

        The explicit setting of the *"length"* property in steps and is intended to ensure the lengths are correct even when the objects are not built-in Arrays.

        This method is intentionally generic; it does not require that its *this* value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

        @@ -39036,11 +40419,10 @@

        Array.prototype.toLocaleString ( [ _reserved1_ [ , _reserved2_ ] ] )

        1. Let _R_ be the empty String. 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, - 1. If _k_ > 0, then - 1. Set _R_ to the string-concatenation of _R_ and _separator_. - 1. Let _nextElement_ be ? Get(_array_, ! ToString(𝔽(_k_))). - 1. If _nextElement_ is not *undefined* or *null*, then - 1. Let _S_ be ? ToString(? Invoke(_nextElement_, *"toLocaleString"*)). + 1. If _k_ > 0, set _R_ to the string-concatenation of _R_ and _separator_. + 1. Let _element_ be ? Get(_array_, ! ToString(𝔽(_k_))). + 1. If _element_ is neither *undefined* nor *null*, then + 1. Let _S_ be ? ToString(? Invoke(_element_, *"toLocaleString"*)). 1. Set _R_ to the string-concatenation of _R_ and _S_. 1. Set _k_ to _k_ + 1. 1. Return _R_. @@ -39053,6 +40435,86 @@

        Array.prototype.toLocaleString ( [ _reserved1_ [ , _reserved2_ ] ] )

        + +

        Array.prototype.toReversed ( )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be ? ToObject(*this* value). + 1. Let _len_ be ? LengthOfArrayLike(_O_). + 1. Let _A_ be ? ArrayCreate(_len_). + 1. Let _k_ be 0. + 1. Repeat, while _k_ < _len_, + 1. Let _from_ be ! ToString(𝔽(_len_ - _k_ - 1)). + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. Let _fromValue_ be ? Get(_O_, _from_). + 1. Perform ! CreateDataPropertyOrThrow(_A_, _Pk_, _fromValue_). + 1. Set _k_ to _k_ + 1. + 1. Return _A_. + +
        + + +

        Array.prototype.toSorted ( _comparefn_ )

        +

        This method performs the following steps when called:

        + + 1. If _comparefn_ is not *undefined* and IsCallable(_comparefn_) is *false*, throw a *TypeError* exception. + 1. Let _O_ be ? ToObject(*this* value). + 1. Let _len_ be ? LengthOfArrayLike(_O_). + 1. Let _A_ be ? ArrayCreate(_len_). + 1. Let _SortCompare_ be a new Abstract Closure with parameters (_x_, _y_) that captures _comparefn_ and performs the following steps when called: + 1. Return ? CompareArrayElements(_x_, _y_, _comparefn_). + 1. Let _sortedList_ be ? SortIndexedProperties(_O_, _len_, _SortCompare_, ~read-through-holes~). + 1. Let _j_ be 0. + 1. Repeat, while _j_ < _len_, + 1. Perform ! CreateDataPropertyOrThrow(_A_, ! ToString(𝔽(_j_)), _sortedList_[_j_]). + 1. Set _j_ to _j_ + 1. + 1. Return _A_. + +
        + + +

        Array.prototype.toSpliced ( _start_, _skipCount_, ..._items_ )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be ? ToObject(*this* value). + 1. Let _len_ be ? LengthOfArrayLike(_O_). + 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). + 1. If _relativeStart_ = -∞, let _actualStart_ be 0. + 1. Else if _relativeStart_ < 0, let _actualStart_ be max(_len_ + _relativeStart_, 0). + 1. Else, let _actualStart_ be min(_relativeStart_, _len_). + 1. Let _insertCount_ be the number of elements in _items_. + 1. If _start_ is not present, then + 1. Let _actualSkipCount_ be 0. + 1. Else if _skipCount_ is not present, then + 1. Let _actualSkipCount_ be _len_ - _actualStart_. + 1. Else, + 1. Let _sc_ be ? ToIntegerOrInfinity(_skipCount_). + 1. Let _actualSkipCount_ be the result of clamping _sc_ between 0 and _len_ - _actualStart_. + 1. Let _newLen_ be _len_ + _insertCount_ - _actualSkipCount_. + 1. If _newLen_ > 253 - 1, throw a *TypeError* exception. + 1. Let _A_ be ? ArrayCreate(_newLen_). + 1. Let _i_ be 0. + 1. Let _r_ be _actualStart_ + _actualSkipCount_. + 1. Repeat, while _i_ < _actualStart_, + 1. Let _Pi_ be ! ToString(𝔽(_i_)). + 1. Let _iValue_ be ? Get(_O_, _Pi_). + 1. Perform ! CreateDataPropertyOrThrow(_A_, _Pi_, _iValue_). + 1. Set _i_ to _i_ + 1. + 1. For each element _E_ of _items_, do + 1. Let _Pi_ be ! ToString(𝔽(_i_)). + 1. Perform ! CreateDataPropertyOrThrow(_A_, _Pi_, _E_). + 1. Set _i_ to _i_ + 1. + 1. Repeat, while _i_ < _newLen_, + 1. Let _Pi_ be ! ToString(𝔽(_i_)). + 1. Let _from_ be ! ToString(𝔽(_r_)). + 1. Let _fromValue_ be ? Get(_O_, _from_). + 1. Perform ! CreateDataPropertyOrThrow(_A_, _Pi_, _fromValue_). + 1. Set _i_ to _i_ + 1. + 1. Set _r_ to _r_ + 1. + 1. Return _A_. + +
        +

        Array.prototype.toString ( )

        This method performs the following steps when called:

        @@ -39111,6 +40573,28 @@

        Array.prototype.values ( )

        + +

        Array.prototype.with ( _index_, _value_ )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be ? ToObject(*this* value). + 1. Let _len_ be ? LengthOfArrayLike(_O_). + 1. Let _relativeIndex_ be ? ToIntegerOrInfinity(_index_). + 1. If _relativeIndex_ ≥ 0, let _actualIndex_ be _relativeIndex_. + 1. Else, let _actualIndex_ be _len_ + _relativeIndex_. + 1. If _actualIndex_ ≥ _len_ or _actualIndex_ < 0, throw a *RangeError* exception. + 1. Let _A_ be ? ArrayCreate(_len_). + 1. Let _k_ be 0. + 1. Repeat, while _k_ < _len_, + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. If _k_ = _actualIndex_, let _fromValue_ be _value_. + 1. Else, let _fromValue_ be ? Get(_O_, _Pk_). + 1. Perform ! CreateDataPropertyOrThrow(_A_, _Pk_, _fromValue_). + 1. Set _k_ to _k_ + 1. + 1. Return _A_. + +
        +

        Array.prototype [ @@iterator ] ( )

        The initial value of the @@iterator property is %Array.prototype.values%, defined in .

        @@ -39133,12 +40617,16 @@

        Array.prototype [ @@unscopables ]

        1. Perform ! CreateDataPropertyOrThrow(_unscopableList_, *"flatMap"*, *true*). 1. Perform ! CreateDataPropertyOrThrow(_unscopableList_, *"includes"*, *true*). 1. Perform ! CreateDataPropertyOrThrow(_unscopableList_, *"keys"*, *true*). + 1. Perform ! CreateDataPropertyOrThrow(_unscopableList_, *"toReversed"*, *true*). + 1. Perform ! CreateDataPropertyOrThrow(_unscopableList_, *"toSorted"*, *true*). + 1. Perform ! CreateDataPropertyOrThrow(_unscopableList_, *"toSpliced"*, *true*). 1. Perform ! CreateDataPropertyOrThrow(_unscopableList_, *"values"*, *true*). 1. Return _unscopableList_.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        The own property names of this object are property names that were not included as standard properties of `Array.prototype` prior to the ECMAScript 2015 specification. These names are ignored for `with` statement binding purposes in order to preserve the behaviour of existing code that might use one of these names as a binding in an outer scope that is shadowed by a `with` statement whose binding object is an Array.

        +

        The reason that *"with"* is not included in the _unscopableList_ is because it is already a reserved word.

        @@ -39178,20 +40666,24 @@

        1. Let _index_ be 0. 1. Repeat, 1. If _array_ has a [[TypedArrayName]] internal slot, then - 1. If IsDetachedBuffer(_array_.[[ViewedArrayBuffer]]) is *true*, throw a *TypeError* exception. - 1. Let _len_ be _array_.[[ArrayLength]]. + 1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_array_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. Else, 1. Let _len_ be ? LengthOfArrayLike(_array_). 1. If _index_ ≥ _len_, return NormalCompletion(*undefined*). - 1. If _kind_ is ~key~, perform ? GeneratorYield(CreateIterResultObject(𝔽(_index_), *false*)). + 1. Let _indexNumber_ be 𝔽(_index_). + 1. If _kind_ is ~key~, then + 1. Let _result_ be _indexNumber_. 1. Else, - 1. Let _elementKey_ be ! ToString(𝔽(_index_)). + 1. Let _elementKey_ be ! ToString(_indexNumber_). 1. Let _elementValue_ be ? Get(_array_, _elementKey_). - 1. If _kind_ is ~value~, perform ? GeneratorYield(CreateIterResultObject(_elementValue_, *false*)). + 1. If _kind_ is ~value~, then + 1. Let _result_ be _elementValue_. 1. Else, 1. Assert: _kind_ is ~key+value~. - 1. Let _result_ be CreateArrayFromList(« 𝔽(_index_), _elementValue_ »). - 1. Perform ? GeneratorYield(CreateIterResultObject(_result_, *false*)). + 1. Let _result_ be CreateArrayFromList(« _indexNumber_, _elementValue_ »). + 1. Perform ? GeneratorYield(CreateIterResultObject(_result_, *false*)). 1. Set _index_ to _index_ + 1. 1. Return CreateIteratorFromClosure(_closure_, *"%ArrayIteratorPrototype%"*, %ArrayIteratorPrototype%). @@ -39251,7 +40743,7 @@

        TypedArray Objects

        %Int8Array%

        a Boolean indicates whether *"u"* appears in the RegExp's flags
        [[UnicodeSets]]a Booleanindicates whether *"v"* appears in the RegExp's flags
        [[CapturingGroupsCount]] a non-negative integer - ~Int8~ + ~int8~ 1 @@ -39269,7 +40761,7 @@

        TypedArray Objects

        %Uint8Array%
        - ~Uint8~ + ~uint8~ 1 @@ -39287,7 +40779,7 @@

        TypedArray Objects

        %Uint8ClampedArray%
        - ~Uint8C~ + ~uint8clamped~ 1 @@ -39305,7 +40797,7 @@

        TypedArray Objects

        %Int16Array%
        - ~Int16~ + ~int16~ 2 @@ -39323,7 +40815,7 @@

        TypedArray Objects

        %Uint16Array%
        - ~Uint16~ + ~uint16~ 2 @@ -39341,7 +40833,7 @@

        TypedArray Objects

        %Int32Array%
        - ~Int32~ + ~int32~ 4 @@ -39359,7 +40851,7 @@

        TypedArray Objects

        %Uint32Array%
        - ~Uint32~ + ~uint32~ 4 @@ -39377,7 +40869,7 @@

        TypedArray Objects

        %BigInt64Array%
        - ~BigInt64~ + ~bigint64~ 8 @@ -39395,7 +40887,7 @@

        TypedArray Objects

        %BigUint64Array%
        - ~BigUint64~ + ~biguint64~ 8 @@ -39413,7 +40905,7 @@

        TypedArray Objects

        %Float32Array%
        - ~Float32~ + ~float32~ 4 @@ -39430,7 +40922,7 @@

        TypedArray Objects

        %Float64Array%
        - ~Float64~ + ~float64~ 8 @@ -39481,15 +40973,16 @@

        %TypedArray%.from ( _source_ [ , _mapfn_ [ , _thisArg_ ] ] )

        1. Let _C_ be the *this* value. 1. If IsConstructor(_C_) is *false*, throw a *TypeError* exception. - 1. If _mapfn_ is *undefined*, let _mapping_ be *false*. + 1. If _mapfn_ is *undefined*, then + 1. Let _mapping_ be *false*. 1. Else, 1. If IsCallable(_mapfn_) is *false*, throw a *TypeError* exception. 1. Let _mapping_ be *true*. 1. Let _usingIterator_ be ? GetMethod(_source_, @@iterator). 1. If _usingIterator_ is not *undefined*, then - 1. Let _values_ be ? IterableToList(_source_, _usingIterator_). + 1. Let _values_ be ? IteratorToList(? GetIteratorFromMethod(_source_, _usingIterator_)). 1. Let _len_ be the number of elements in _values_. - 1. Let _targetObj_ be ? TypedArrayCreate(_C_, « 𝔽(_len_) »). + 1. Let _targetObj_ be ? TypedArrayCreateFromConstructor(_C_, « 𝔽(_len_) »). 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, 1. Let _Pk_ be ! ToString(𝔽(_k_)). @@ -39497,7 +40990,8 @@

        %TypedArray%.from ( _source_ [ , _mapfn_ [ , _thisArg_ ] ] )

        1. Remove the first element from _values_. 1. If _mapping_ is *true*, then 1. Let _mappedValue_ be ? Call(_mapfn_, _thisArg_, « _kValue_, 𝔽(_k_) »). - 1. Else, let _mappedValue_ be _kValue_. + 1. Else, + 1. Let _mappedValue_ be _kValue_. 1. Perform ? Set(_targetObj_, _Pk_, _mappedValue_, *true*). 1. Set _k_ to _k_ + 1. 1. Assert: _values_ is now an empty List. @@ -39505,14 +40999,15 @@

        %TypedArray%.from ( _source_ [ , _mapfn_ [ , _thisArg_ ] ] )

        1. NOTE: _source_ is not an Iterable so assume it is already an array-like object. 1. Let _arrayLike_ be ! ToObject(_source_). 1. Let _len_ be ? LengthOfArrayLike(_arrayLike_). - 1. Let _targetObj_ be ? TypedArrayCreate(_C_, « 𝔽(_len_) »). + 1. Let _targetObj_ be ? TypedArrayCreateFromConstructor(_C_, « 𝔽(_len_) »). 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, 1. Let _Pk_ be ! ToString(𝔽(_k_)). 1. Let _kValue_ be ? Get(_arrayLike_, _Pk_). 1. If _mapping_ is *true*, then 1. Let _mappedValue_ be ? Call(_mapfn_, _thisArg_, « _kValue_, 𝔽(_k_) »). - 1. Else, let _mappedValue_ be _kValue_. + 1. Else, + 1. Let _mappedValue_ be _kValue_. 1. Perform ? Set(_targetObj_, _Pk_, _mappedValue_, *true*). 1. Set _k_ to _k_ + 1. 1. Return _targetObj_. @@ -39526,7 +41021,7 @@

        %TypedArray%.of ( ..._items_ )

        1. Let _len_ be the number of elements in _items_. 1. Let _C_ be the *this* value. 1. If IsConstructor(_C_) is *false*, throw a *TypeError* exception. - 1. Let _newObj_ be ? TypedArrayCreate(_C_, « 𝔽(_len_) »). + 1. Let _newObj_ be ? TypedArrayCreateFromConstructor(_C_, « 𝔽(_len_) »). 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, 1. Let _kValue_ be _items_[_k_]. @@ -39570,8 +41065,8 @@

        Properties of the %TypedArray% Prototype Object

        %TypedArray%.prototype.at ( _index_ )

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. Let _relativeIndex_ be ? ToIntegerOrInfinity(_index_). 1. If _relativeIndex_ ≥ 0, then 1. Let _k_ be _relativeIndex_. @@ -39601,9 +41096,8 @@

        get %TypedArray%.prototype.byteLength

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[TypedArrayName]]). 1. Assert: _O_ has a [[ViewedArrayBuffer]] internal slot. - 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, return *+0*𝔽. - 1. Let _size_ be _O_.[[ByteLength]]. + 1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. Let _size_ be TypedArrayByteLength(_taRecord_). 1. Return 𝔽(_size_).
        @@ -39615,8 +41109,8 @@

        get %TypedArray%.prototype.byteOffset

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[TypedArrayName]]). 1. Assert: _O_ has a [[ViewedArrayBuffer]] internal slot. - 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, return *+0*𝔽. + 1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, return *+0*𝔽. 1. Let _offset_ be _O_.[[ByteOffset]]. 1. Return 𝔽(_offset_).
        @@ -39633,29 +41127,32 @@

        %TypedArray%.prototype.copyWithin ( _target_, _start_ [ , _end_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. Let _relativeTarget_ be ? ToIntegerOrInfinity(_target_). - 1. If _relativeTarget_ is -∞, let _to_ be 0. - 1. Else if _relativeTarget_ < 0, let _to_ be max(_len_ + _relativeTarget_, 0). - 1. Else, let _to_ be min(_relativeTarget_, _len_). + 1. If _relativeTarget_ = -∞, let _targetIndex_ be 0. + 1. Else if _relativeTarget_ < 0, let _targetIndex_ be max(_len_ + _relativeTarget_, 0). + 1. Else, let _targetIndex_ be min(_relativeTarget_, _len_). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _from_ be 0. - 1. Else if _relativeStart_ < 0, let _from_ be max(_len_ + _relativeStart_, 0). - 1. Else, let _from_ be min(_relativeStart_, _len_). + 1. If _relativeStart_ = -∞, let _startIndex_ be 0. + 1. Else if _relativeStart_ < 0, let _startIndex_ be max(_len_ + _relativeStart_, 0). + 1. Else, let _startIndex_ be min(_relativeStart_, _len_). 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. - 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). - 1. Else, let _final_ be min(_relativeEnd_, _len_). - 1. Let _count_ be min(_final_ - _from_, _len_ - _to_). + 1. If _relativeEnd_ = -∞, let _endIndex_ be 0. + 1. Else if _relativeEnd_ < 0, let _endIndex_ be max(_len_ + _relativeEnd_, 0). + 1. Else, let _endIndex_ be min(_relativeEnd_, _len_). + 1. Let _count_ be min(_endIndex_ - _startIndex_, _len_ - _targetIndex_). 1. If _count_ > 0, then 1. NOTE: The copying must be performed in a manner that preserves the bit-level encoding of the source data. 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. + 1. Set _taRecord_ to MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. + 1. Set _len_ to TypedArrayLength(_taRecord_). 1. Let _elementSize_ be TypedArrayElementSize(_O_). 1. Let _byteOffset_ be _O_.[[ByteOffset]]. - 1. Let _toByteIndex_ be _to_ × _elementSize_ + _byteOffset_. - 1. Let _fromByteIndex_ be _from_ × _elementSize_ + _byteOffset_. + 1. Let _bufferByteLimit_ be (_len_ × _elementSize_) + _byteOffset_. + 1. Let _toByteIndex_ be (_targetIndex_ × _elementSize_) + _byteOffset_. + 1. Let _fromByteIndex_ be (_startIndex_ × _elementSize_) + _byteOffset_. 1. Let _countBytes_ be _count_ × _elementSize_. 1. If _fromByteIndex_ < _toByteIndex_ and _toByteIndex_ < _fromByteIndex_ + _countBytes_, then 1. Let _direction_ be -1. @@ -39664,11 +41161,14 @@

        %TypedArray%.prototype.copyWithin ( _target_, _start_ [ , _end_ ] )

        1. Else, 1. Let _direction_ be 1. 1. Repeat, while _countBytes_ > 0, - 1. Let _value_ be GetValueFromBuffer(_buffer_, _fromByteIndex_, ~Uint8~, *true*, ~Unordered~). - 1. Perform SetValueInBuffer(_buffer_, _toByteIndex_, ~Uint8~, _value_, *true*, ~Unordered~). - 1. Set _fromByteIndex_ to _fromByteIndex_ + _direction_. - 1. Set _toByteIndex_ to _toByteIndex_ + _direction_. - 1. Set _countBytes_ to _countBytes_ - 1. + 1. If _fromByteIndex_ < _bufferByteLimit_ and _toByteIndex_ < _bufferByteLimit_, then + 1. Let _value_ be GetValueFromBuffer(_buffer_, _fromByteIndex_, ~uint8~, *true*, ~unordered~). + 1. Perform SetValueInBuffer(_buffer_, _toByteIndex_, ~uint8~, _value_, *true*, ~unordered~). + 1. Set _fromByteIndex_ to _fromByteIndex_ + _direction_. + 1. Set _toByteIndex_ to _toByteIndex_ + _direction_. + 1. Set _countBytes_ to _countBytes_ - 1. + 1. Else, + 1. Set _countBytes_ to 0. 1. Return _O_.
        @@ -39678,7 +41178,7 @@

        %TypedArray%.prototype.entries ( )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). + 1. Perform ? ValidateTypedArray(_O_, ~seq-cst~). 1. Return CreateArrayIterator(_O_, ~key+value~). @@ -39689,8 +41189,8 @@

        %TypedArray%.prototype.every ( _callbackfn_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, @@ -39710,20 +41210,24 @@

        %TypedArray%.prototype.fill ( _value_ [ , _start_ [ , _end_ ] ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If _O_.[[ContentType]] is ~BigInt~, set _value_ to ? ToBigInt(_value_). + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. If _O_.[[ContentType]] is ~bigint~, set _value_ to ? ToBigInt(_value_). 1. Otherwise, set _value_ to ? ToNumber(_value_). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _k_ be 0. - 1. Else if _relativeStart_ < 0, let _k_ be max(_len_ + _relativeStart_, 0). - 1. Else, let _k_ be min(_relativeStart_, _len_). + 1. If _relativeStart_ = -∞, let _startIndex_ be 0. + 1. Else if _relativeStart_ < 0, let _startIndex_ be max(_len_ + _relativeStart_, 0). + 1. Else, let _startIndex_ be min(_relativeStart_, _len_). 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. - 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). - 1. Else, let _final_ be min(_relativeEnd_, _len_). - 1. If IsDetachedBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, throw a *TypeError* exception. - 1. Repeat, while _k_ < _final_, + 1. If _relativeEnd_ = -∞, let _endIndex_ be 0. + 1. Else if _relativeEnd_ < 0, let _endIndex_ be max(_len_ + _relativeEnd_, 0). + 1. Else, let _endIndex_ be min(_relativeEnd_, _len_). + 1. Set _taRecord_ to MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. + 1. Set _len_ to TypedArrayLength(_taRecord_). + 1. Set _endIndex_ to min(_endIndex_, _len_). + 1. Let _k_ be _startIndex_. + 1. Repeat, while _k_ < _endIndex_, 1. Let _Pk_ be ! ToString(𝔽(_k_)). 1. Perform ! Set(_O_, _Pk_, _value_, *true*). 1. Set _k_ to _k_ + 1. @@ -39737,8 +41241,8 @@

        %TypedArray%.prototype.filter ( _callbackfn_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. 1. Let _kept_ be a new empty List. 1. Let _captured_ be 0. @@ -39767,17 +41271,10 @@

        %TypedArray%.prototype.find ( _predicate_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be 0. - 1. Repeat, while _k_ < _len_, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ! Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return _kValue_. - 1. Set _k_ to _k_ + 1. - 1. Return *undefined*. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~ascending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Value]].

        This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        @@ -39788,17 +41285,10 @@

        %TypedArray%.prototype.findIndex ( _predicate_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be 0. - 1. Repeat, while _k_ < _len_, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ! Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return 𝔽(_k_). - 1. Set _k_ to _k_ + 1. - 1. Return *-1*𝔽. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~ascending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Index]].

        This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        @@ -39809,17 +41299,10 @@

        %TypedArray%.prototype.findLast ( _predicate_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be _len_ - 1. - 1. Repeat, while _k_ ≥ 0, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ! Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return _kValue_. - 1. Set _k_ to _k_ - 1. - 1. Return *undefined*. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~descending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Value]].

        This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        @@ -39830,17 +41313,10 @@

        %TypedArray%.prototype.findLastIndex ( _predicate_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If IsCallable(_predicate_) is *false*, throw a *TypeError* exception. - 1. Let _k_ be _len_ - 1. - 1. Repeat, while _k_ ≥ 0, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ! Get(_O_, _Pk_). - 1. Let _testResult_ be ToBoolean(? Call(_predicate_, _thisArg_, « _kValue_, 𝔽(_k_), _O_ »)). - 1. If _testResult_ is *true*, return 𝔽(_k_). - 1. Set _k_ to _k_ - 1. - 1. Return *-1*𝔽. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. Let _findRec_ be ? FindViaPredicate(_O_, _len_, ~descending~, _predicate_, _thisArg_). + 1. Return _findRec_.[[Index]].

        This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        @@ -39851,8 +41327,8 @@

        %TypedArray%.prototype.forEach ( _callbackfn_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, @@ -39871,13 +41347,13 @@

        %TypedArray%.prototype.includes ( _searchElement_ [ , _fromIndex_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If _len_ is 0, return *false*. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. If _len_ = 0, return *false*. 1. Let _n_ be ? ToIntegerOrInfinity(_fromIndex_). 1. Assert: If _fromIndex_ is *undefined*, then _n_ is 0. - 1. If _n_ is +∞, return *false*. - 1. Else if _n_ is -∞, set _n_ to 0. + 1. If _n_ = +∞, return *false*. + 1. Else if _n_ = -∞, set _n_ to 0. 1. If _n_ ≥ 0, then 1. Let _k_ be _n_. 1. Else, @@ -39898,13 +41374,13 @@

        %TypedArray%.prototype.indexOf ( _searchElement_ [ , _fromIndex_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If _len_ is 0, return *-1*𝔽. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. If _len_ = 0, return *-1*𝔽. 1. Let _n_ be ? ToIntegerOrInfinity(_fromIndex_). 1. Assert: If _fromIndex_ is *undefined*, then _n_ is 0. - 1. If _n_ is +∞, return *-1*𝔽. - 1. Else if _n_ is -∞, set _n_ to 0. + 1. If _n_ = +∞, return *-1*𝔽. + 1. Else if _n_ = -∞, set _n_ to 0. 1. If _n_ ≥ 0, then 1. Let _k_ be _n_. 1. Else, @@ -39914,8 +41390,7 @@

        %TypedArray%.prototype.indexOf ( _searchElement_ [ , _fromIndex_ ] )

        1. Let _kPresent_ be ! HasProperty(_O_, ! ToString(𝔽(_k_))). 1. If _kPresent_ is *true*, then 1. Let _elementK_ be ! Get(_O_, ! ToString(𝔽(_k_))). - 1. Let _same_ be IsStrictlyEqual(_searchElement_, _elementK_). - 1. If _same_ is *true*, return 𝔽(_k_). + 1. If IsStrictlyEqual(_searchElement_, _elementK_) is *true*, return 𝔽(_k_). 1. Set _k_ to _k_ + 1. 1. Return *-1*𝔽.
        @@ -39928,8 +41403,8 @@

        %TypedArray%.prototype.join ( _separator_ )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If _separator_ is *undefined*, let _sep_ be *","*. 1. Else, let _sep_ be ? ToString(_separator_). 1. Let _R_ be the empty String. @@ -39937,8 +41412,9 @@

        %TypedArray%.prototype.join ( _separator_ )

        1. Repeat, while _k_ < _len_, 1. If _k_ > 0, set _R_ to the string-concatenation of _R_ and _sep_. 1. Let _element_ be ! Get(_O_, ! ToString(𝔽(_k_))). - 1. If _element_ is *undefined*, let _next_ be the empty String; otherwise, let _next_ be ! ToString(_element_). - 1. Set _R_ to the string-concatenation of _R_ and _next_. + 1. If _element_ is not *undefined*, then + 1. Let _S_ be ! ToString(_element_). + 1. Set _R_ to the string-concatenation of _R_ and _S_. 1. Set _k_ to _k_ + 1. 1. Return _R_.
        @@ -39950,7 +41426,7 @@

        %TypedArray%.prototype.keys ( )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). + 1. Perform ? ValidateTypedArray(_O_, ~seq-cst~). 1. Return CreateArrayIterator(_O_, ~key~). @@ -39961,11 +41437,11 @@

        %TypedArray%.prototype.lastIndexOf ( _searchElement_ [ , _fromIndex_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. - 1. If _len_ is 0, return *-1*𝔽. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. If _len_ = 0, return *-1*𝔽. 1. If _fromIndex_ is present, let _n_ be ? ToIntegerOrInfinity(_fromIndex_); else let _n_ be _len_ - 1. - 1. If _n_ is -∞, return *-1*𝔽. + 1. If _n_ = -∞, return *-1*𝔽. 1. If _n_ ≥ 0, then 1. Let _k_ be min(_n_, _len_ - 1). 1. Else, @@ -39974,8 +41450,7 @@

        %TypedArray%.prototype.lastIndexOf ( _searchElement_ [ , _fromIndex_ ] )

        𝔽.
        @@ -39989,9 +41464,9 @@

        get %TypedArray%.prototype.length

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[TypedArrayName]]). 1. Assert: _O_ has [[ViewedArrayBuffer]] and [[ArrayLength]] internal slots. - 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, return *+0*𝔽. - 1. Let _length_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, return *+0*𝔽. + 1. Let _length_ be TypedArrayLength(_taRecord_). 1. Return 𝔽(_length_).

        This function is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        @@ -40003,8 +41478,8 @@

        %TypedArray%.prototype.map ( _callbackfn_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. 1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_len_) »). 1. Let _k_ be 0. @@ -40025,8 +41500,8 @@

        %TypedArray%.prototype.reduce ( _callbackfn_ [ , _initialValue_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. 1. If _len_ = 0 and _initialValue_ is not present, throw a *TypeError* exception. 1. Let _k_ be 0. @@ -40053,10 +41528,10 @@

        %TypedArray%.prototype.reduceRight ( _callbackfn_ [ , _initialValue_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. - 1. If _len_ is 0 and _initialValue_ is not present, throw a *TypeError* exception. + 1. If _len_ = 0 and _initialValue_ is not present, throw a *TypeError* exception. 1. Let _k_ be _len_ - 1. 1. Let _accumulator_ be *undefined*. 1. If _initialValue_ is present, then @@ -40081,8 +41556,8 @@

        %TypedArray%.prototype.reverse ( )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. Let _middle_ be floor(_len_ / 2). 1. Let _lower_ be 0. 1. Repeat, while _lower_ ≠ _middle_, @@ -40131,41 +41606,42 @@

        1. Let _targetBuffer_ be _target_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_targetBuffer_) is *true*, throw a *TypeError* exception. - 1. Let _targetLength_ be _target_.[[ArrayLength]]. + 1. Let _targetRecord_ be MakeTypedArrayWithBufferWitnessRecord(_target_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_targetRecord_) is *true*, throw a *TypeError* exception. + 1. Let _targetLength_ be TypedArrayLength(_targetRecord_). 1. Let _srcBuffer_ be _source_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_srcBuffer_) is *true*, throw a *TypeError* exception. + 1. Let _srcRecord_ be MakeTypedArrayWithBufferWitnessRecord(_source_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_srcRecord_) is *true*, throw a *TypeError* exception. + 1. Let _srcLength_ be TypedArrayLength(_srcRecord_). 1. Let _targetType_ be TypedArrayElementType(_target_). 1. Let _targetElementSize_ be TypedArrayElementSize(_target_). 1. Let _targetByteOffset_ be _target_.[[ByteOffset]]. 1. Let _srcType_ be TypedArrayElementType(_source_). 1. Let _srcElementSize_ be TypedArrayElementSize(_source_). - 1. Let _srcLength_ be _source_.[[ArrayLength]]. 1. Let _srcByteOffset_ be _source_.[[ByteOffset]]. - 1. If _targetOffset_ is +∞, throw a *RangeError* exception. + 1. If _targetOffset_ = +∞, throw a *RangeError* exception. 1. If _srcLength_ + _targetOffset_ > _targetLength_, throw a *RangeError* exception. - 1. If _target_.[[ContentType]] ≠ _source_.[[ContentType]], throw a *TypeError* exception. - 1. If both IsSharedArrayBuffer(_srcBuffer_) and IsSharedArrayBuffer(_targetBuffer_) are *true*, then - 1. If _srcBuffer_.[[ArrayBufferData]] and _targetBuffer_.[[ArrayBufferData]] are the same Shared Data Block values, let _same_ be *true*; else let _same_ be *false*. - 1. Else, let _same_ be SameValue(_srcBuffer_, _targetBuffer_). - 1. If _same_ is *true*, then - 1. Let _srcByteLength_ be _source_.[[ByteLength]]. + 1. If _target_.[[ContentType]] is not _source_.[[ContentType]], throw a *TypeError* exception. + 1. If IsSharedArrayBuffer(_srcBuffer_) is *true*, IsSharedArrayBuffer(_targetBuffer_) is *true*, and _srcBuffer_.[[ArrayBufferData]] is _targetBuffer_.[[ArrayBufferData]], let _sameSharedArrayBuffer_ be *true*; otherwise, let _sameSharedArrayBuffer_ be *false*. + 1. If SameValue(_srcBuffer_, _targetBuffer_) is *true* or _sameSharedArrayBuffer_ is *true*, then + 1. Let _srcByteLength_ be TypedArrayByteLength(_srcRecord_). 1. Set _srcBuffer_ to ? CloneArrayBuffer(_srcBuffer_, _srcByteOffset_, _srcByteLength_). 1. Let _srcByteIndex_ be 0. - 1. Else, let _srcByteIndex_ be _srcByteOffset_. - 1. Let _targetByteIndex_ be _targetOffset_ × _targetElementSize_ + _targetByteOffset_. - 1. Let _limit_ be _targetByteIndex_ + _targetElementSize_ × _srcLength_. - 1. If _srcType_ is the same as _targetType_, then - 1. NOTE: If _srcType_ and _targetType_ are the same, the transfer must be performed in a manner that preserves the bit-level encoding of the source data. + 1. Else, + 1. Let _srcByteIndex_ be _srcByteOffset_. + 1. Let _targetByteIndex_ be (_targetOffset_ × _targetElementSize_) + _targetByteOffset_. + 1. Let _limit_ be _targetByteIndex_ + (_targetElementSize_ × _srcLength_). + 1. If _srcType_ is _targetType_, then + 1. NOTE: The transfer must be performed in a manner that preserves the bit-level encoding of the source data. 1. Repeat, while _targetByteIndex_ < _limit_, - 1. Let _value_ be GetValueFromBuffer(_srcBuffer_, _srcByteIndex_, ~Uint8~, *true*, ~Unordered~). - 1. Perform SetValueInBuffer(_targetBuffer_, _targetByteIndex_, ~Uint8~, _value_, *true*, ~Unordered~). + 1. Let _value_ be GetValueFromBuffer(_srcBuffer_, _srcByteIndex_, ~uint8~, *true*, ~unordered~). + 1. Perform SetValueInBuffer(_targetBuffer_, _targetByteIndex_, ~uint8~, _value_, *true*, ~unordered~). 1. Set _srcByteIndex_ to _srcByteIndex_ + 1. 1. Set _targetByteIndex_ to _targetByteIndex_ + 1. 1. Else, 1. Repeat, while _targetByteIndex_ < _limit_, - 1. Let _value_ be GetValueFromBuffer(_srcBuffer_, _srcByteIndex_, _srcType_, *true*, ~Unordered~). - 1. Perform SetValueInBuffer(_targetBuffer_, _targetByteIndex_, _targetType_, _value_, *true*, ~Unordered~). + 1. Let _value_ be GetValueFromBuffer(_srcBuffer_, _srcByteIndex_, _srcType_, *true*, ~unordered~). + 1. Perform SetValueInBuffer(_targetBuffer_, _targetByteIndex_, _targetType_, _value_, *true*, ~unordered~). 1. Set _srcByteIndex_ to _srcByteIndex_ + _srcElementSize_. 1. Set _targetByteIndex_ to _targetByteIndex_ + _targetElementSize_. 1. Return ~unused~. @@ -40185,19 +41661,19 @@

        It sets multiple values in _target_, starting at index _targetOffset_, reading the values from _source_.
        - 1. Let _targetBuffer_ be _target_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_targetBuffer_) is *true*, throw a *TypeError* exception. - 1. Let _targetLength_ be _target_.[[ArrayLength]]. + 1. Let _targetRecord_ be MakeTypedArrayWithBufferWitnessRecord(_target_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_targetRecord_) is *true*, throw a *TypeError* exception. + 1. Let _targetLength_ be TypedArrayLength(_targetRecord_). 1. Let _src_ be ? ToObject(_source_). 1. Let _srcLength_ be ? LengthOfArrayLike(_src_). - 1. If _targetOffset_ is +∞, throw a *RangeError* exception. + 1. If _targetOffset_ = +∞, throw a *RangeError* exception. 1. If _srcLength_ + _targetOffset_ > _targetLength_, throw a *RangeError* exception. 1. Let _k_ be 0. 1. Repeat, while _k_ < _srcLength_, 1. Let _Pk_ be ! ToString(𝔽(_k_)). 1. Let _value_ be ? Get(_src_, _Pk_). 1. Let _targetIndex_ be 𝔽(_targetOffset_ + _k_). - 1. Perform ? IntegerIndexedElementSet(_target_, _targetIndex_, _value_). + 1. Perform ? TypedArraySetElement(_target_, _targetIndex_, _value_). 1. Set _k_ to _k_ + 1. 1. Return ~unused~. @@ -40210,44 +41686,48 @@

        %TypedArray%.prototype.slice ( _start_, _end_ )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _srcArrayLength_ be TypedArrayLength(_taRecord_). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _k_ be 0. - 1. Else if _relativeStart_ < 0, let _k_ be max(_len_ + _relativeStart_, 0). - 1. Else, let _k_ be min(_relativeStart_, _len_). - 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. - 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). - 1. Else, let _final_ be min(_relativeEnd_, _len_). - 1. Let _count_ be max(_final_ - _k_, 0). - 1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_count_) »). - 1. If _count_ > 0, then - 1. If IsDetachedBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, throw a *TypeError* exception. + 1. If _relativeStart_ = -∞, let _startIndex_ be 0. + 1. Else if _relativeStart_ < 0, let _startIndex_ be max(_srcArrayLength_ + _relativeStart_, 0). + 1. Else, let _startIndex_ be min(_relativeStart_, _srcArrayLength_). + 1. If _end_ is *undefined*, let _relativeEnd_ be _srcArrayLength_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). + 1. If _relativeEnd_ = -∞, let _endIndex_ be 0. + 1. Else if _relativeEnd_ < 0, let _endIndex_ be max(_srcArrayLength_ + _relativeEnd_, 0). + 1. Else, let _endIndex_ be min(_relativeEnd_, _srcArrayLength_). + 1. Let _countBytes_ be max(_endIndex_ - _startIndex_, 0). + 1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_countBytes_) »). + 1. If _countBytes_ > 0, then + 1. Set _taRecord_ to MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. + 1. Set _endIndex_ to min(_endIndex_, TypedArrayLength(_taRecord_)). + 1. Set _countBytes_ to max(_endIndex_ - _startIndex_, 0). 1. Let _srcType_ be TypedArrayElementType(_O_). 1. Let _targetType_ be TypedArrayElementType(_A_). - 1. If _srcType_ is different from _targetType_, then - 1. Let _n_ be 0. - 1. Repeat, while _k_ < _final_, - 1. Let _Pk_ be ! ToString(𝔽(_k_)). - 1. Let _kValue_ be ! Get(_O_, _Pk_). - 1. Perform ! Set(_A_, ! ToString(𝔽(_n_)), _kValue_, *true*). - 1. Set _k_ to _k_ + 1. - 1. Set _n_ to _n_ + 1. - 1. Else, + 1. If _srcType_ is _targetType_, then + 1. NOTE: The transfer must be performed in a manner that preserves the bit-level encoding of the source data. 1. Let _srcBuffer_ be _O_.[[ViewedArrayBuffer]]. 1. Let _targetBuffer_ be _A_.[[ViewedArrayBuffer]]. 1. Let _elementSize_ be TypedArrayElementSize(_O_). - 1. NOTE: If _srcType_ and _targetType_ are the same, the transfer must be performed in a manner that preserves the bit-level encoding of the source data. 1. Let _srcByteOffset_ be _O_.[[ByteOffset]]. - 1. Let _srcByteIndex_ be (_k_ × _elementSize_) + _srcByteOffset_. + 1. Let _srcByteIndex_ be (_startIndex_ × _elementSize_) + _srcByteOffset_. 1. Let _targetByteIndex_ be _A_.[[ByteOffset]]. - 1. Let _limit_ be _targetByteIndex_ + _count_ × _elementSize_. - 1. Repeat, while _targetByteIndex_ < _limit_, - 1. Let _value_ be GetValueFromBuffer(_srcBuffer_, _srcByteIndex_, ~Uint8~, *true*, ~Unordered~). - 1. Perform SetValueInBuffer(_targetBuffer_, _targetByteIndex_, ~Uint8~, _value_, *true*, ~Unordered~). + 1. Let _endByteIndex_ be _targetByteIndex_ + (_countBytes_ × _elementSize_). + 1. Repeat, while _targetByteIndex_ < _endByteIndex_, + 1. Let _value_ be GetValueFromBuffer(_srcBuffer_, _srcByteIndex_, ~uint8~, *true*, ~unordered~). + 1. Perform SetValueInBuffer(_targetBuffer_, _targetByteIndex_, ~uint8~, _value_, *true*, ~unordered~). 1. Set _srcByteIndex_ to _srcByteIndex_ + 1. 1. Set _targetByteIndex_ to _targetByteIndex_ + 1. + 1. Else, + 1. Let _n_ be 0. + 1. Let _k_ be _startIndex_. + 1. Repeat, while _k_ < _endIndex_, + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. Let _kValue_ be ! Get(_O_, _Pk_). + 1. Perform ! Set(_A_, ! ToString(𝔽(_n_)), _kValue_, *true*). + 1. Set _k_ to _k_ + 1. + 1. Set _n_ to _n_ + 1. 1. Return _A_.

        This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        @@ -40259,8 +41739,8 @@

        %TypedArray%.prototype.some ( _callbackfn_ [ , _thisArg_ ] )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). - 1. Let _len_ be _O_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. 1. Let _k_ be 0. 1. Repeat, while _k_ < _len_, @@ -40276,59 +41756,59 @@

        %TypedArray%.prototype.some ( _callbackfn_ [ , _thisArg_ ] )

        %TypedArray%.prototype.sort ( _comparefn_ )

        -

        This is a distinct method that, except as described below, implements the same requirements as those of `Array.prototype.sort` as defined in . The implementation of this method may be optimized with the knowledge that the *this* value is an object that has a fixed length and whose integer-indexed properties are not sparse.

        +

        This is a distinct method that, except as described below, implements the same requirements as those of `Array.prototype.sort` as defined in . The implementation of this method may be optimized with the knowledge that the *this* value is an object that has a fixed length and whose integer-indexed properties are not sparse.

        This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        It performs the following steps when called:

        1. If _comparefn_ is not *undefined* and IsCallable(_comparefn_) is *false*, throw a *TypeError* exception. 1. Let _obj_ be the *this* value. - 1. Perform ? ValidateTypedArray(_obj_). - 1. Let _len_ be _obj_.[[ArrayLength]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_obj_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). 1. NOTE: The following closure performs a numeric comparison rather than the string comparison used in . 1. Let _SortCompare_ be a new Abstract Closure with parameters (_x_, _y_) that captures _comparefn_ and performs the following steps when called: - 1. Assert: _x_ is a Number and _y_ is a Number, or _x_ is a BigInt and _y_ is a BigInt. - 1. If _comparefn_ is not *undefined*, then - 1. Let _v_ be ? ToNumber(? Call(_comparefn_, *undefined*, « _x_, _y_ »)). - 1. If _v_ is *NaN*, return *+0*𝔽. - 1. Return _v_. - 1. If _x_ and _y_ are both *NaN*, return *+0*𝔽. - 1. If _x_ is *NaN*, return *1*𝔽. - 1. If _y_ is *NaN*, return *-1*𝔽. - 1. If _x_ < _y_, return *-1*𝔽. - 1. If _x_ > _y_, return *1*𝔽. - 1. If _x_ is *-0*𝔽 and _y_ is *+0*𝔽, return *-1*𝔽. - 1. If _x_ is *+0*𝔽 and _y_ is *-0*𝔽, return *1*𝔽. - 1. Return *+0*𝔽. - 1. Return ? SortIndexedProperties(_obj_, _len_, _SortCompare_). + 1. Return ? CompareTypedArrayElements(_x_, _y_, _comparefn_). + 1. Let _sortedList_ be ? SortIndexedProperties(_obj_, _len_, _SortCompare_, ~read-through-holes~). + 1. Let _j_ be 0. + 1. Repeat, while _j_ < _len_, + 1. Perform ! Set(_obj_, ! ToString(𝔽(_j_)), _sortedList_[_j_], *true*). + 1. Set _j_ to _j_ + 1. + 1. Return _obj_. -

        Because *NaN* always compares greater than any other value, *NaN* property values always sort to the end of the result when _comparefn_ is not provided.

        +

        Because *NaN* always compares greater than any other value (see CompareTypedArrayElements), *NaN* property values always sort to the end of the result when _comparefn_ is not provided.

        -

        %TypedArray%.prototype.subarray ( _begin_, _end_ )

        -

        This method returns a new _TypedArray_ whose element type is the same as this _TypedArray_ and whose ArrayBuffer is the same as the ArrayBuffer of this _TypedArray_, referencing the elements in the interval from _begin_ (inclusive) to _end_ (exclusive). If either _begin_ or _end_ is negative, it refers to an index from the end of the array, as opposed to from the beginning.

        +

        %TypedArray%.prototype.subarray ( _start_, _end_ )

        +

        This method returns a new _TypedArray_ whose element type is the element type of this _TypedArray_ and whose ArrayBuffer is the ArrayBuffer of this _TypedArray_, referencing the elements in the interval from _start_ (inclusive) to _end_ (exclusive). If either _start_ or _end_ is negative, it refers to an index from the end of the array, as opposed to from the beginning.

        It performs the following steps when called:

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[TypedArrayName]]). 1. Assert: _O_ has a [[ViewedArrayBuffer]] internal slot. 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. Let _srcLength_ be _O_.[[ArrayLength]]. - 1. Let _relativeBegin_ be ? ToIntegerOrInfinity(_begin_). - 1. If _relativeBegin_ is -∞, let _beginIndex_ be 0. - 1. Else if _relativeBegin_ < 0, let _beginIndex_ be max(_srcLength_ + _relativeBegin_, 0). - 1. Else, let _beginIndex_ be min(_relativeBegin_, _srcLength_). - 1. If _end_ is *undefined*, let _relativeEnd_ be _srcLength_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _endIndex_ be 0. - 1. Else if _relativeEnd_ < 0, let _endIndex_ be max(_srcLength_ + _relativeEnd_, 0). - 1. Else, let _endIndex_ be min(_relativeEnd_, _srcLength_). - 1. Let _newLength_ be max(_endIndex_ - _beginIndex_, 0). + 1. Let _srcRecord_ be MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_srcRecord_) is *true*, then + 1. Let _srcLength_ be 0. + 1. Else, + 1. Let _srcLength_ be TypedArrayLength(_srcRecord_). + 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). + 1. If _relativeStart_ = -∞, let _startIndex_ be 0. + 1. Else if _relativeStart_ < 0, let _startIndex_ be max(_srcLength_ + _relativeStart_, 0). + 1. Else, let _startIndex_ be min(_relativeStart_, _srcLength_). 1. Let _elementSize_ be TypedArrayElementSize(_O_). 1. Let _srcByteOffset_ be _O_.[[ByteOffset]]. - 1. Let _beginByteOffset_ be _srcByteOffset_ + _beginIndex_ × _elementSize_. - 1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_), 𝔽(_newLength_) ». + 1. Let _beginByteOffset_ be _srcByteOffset_ + (_startIndex_ × _elementSize_). + 1. If _O_.[[ArrayLength]] is ~auto~ and _end_ is *undefined*, then + 1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_) ». + 1. Else, + 1. If _end_ is *undefined*, let _relativeEnd_ be _srcLength_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). + 1. If _relativeEnd_ = -∞, let _endIndex_ be 0. + 1. Else if _relativeEnd_ < 0, let _endIndex_ be max(_srcLength_ + _relativeEnd_, 0). + 1. Else, let _endIndex_ be min(_relativeEnd_, _srcLength_). + 1. Let _newLength_ be max(_endIndex_ - _startIndex_, 0). + 1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_), 𝔽(_newLength_) ». 1. Return ? TypedArraySpeciesCreate(_O_, _argumentsList_).

        This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.

        @@ -40336,13 +41816,53 @@

        %TypedArray%.prototype.subarray ( _begin_, _end_ )

        %TypedArray%.prototype.toLocaleString ( [ _reserved1_ [ , _reserved2_ ] ] )

        -

        This is a distinct method that implements the same algorithm as `Array.prototype.toLocaleString` as defined in except that the *this* value's [[ArrayLength]] internal slot is accessed in place of performing a [[Get]] of *"length"*. The implementation of the algorithm may be optimized with the knowledge that the *this* value is an object that has a fixed length and whose integer-indexed properties are not sparse. However, such optimization must not introduce any observable changes in the specified behaviour of the algorithm.

        -

        This method is not generic. ValidateTypedArray is applied to the *this* value prior to evaluating the algorithm. If its result is an abrupt completion that exception is thrown instead of evaluating the algorithm.

        +

        This is a distinct method that implements the same algorithm as `Array.prototype.toLocaleString` as defined in except that TypedArrayLength is called in place of performing a [[Get]] of *"length"*. The implementation of the algorithm may be optimized with the knowledge that the *this* value has a fixed length when the underlying buffer is not resizable and whose integer-indexed properties are not sparse. However, such optimization must not introduce any observable changes in the specified behaviour of the algorithm.

        +

        This method is not generic. ValidateTypedArray is called with the *this* value and ~seq-cst~ as arguments prior to evaluating the algorithm. If its result is an abrupt completion that exception is thrown instead of evaluating the algorithm.

        If the ECMAScript implementation includes the ECMA-402 Internationalization API this method is based upon the algorithm for `Array.prototype.toLocaleString` that is in the ECMA-402 specification.

        + +

        %TypedArray%.prototype.toReversed ( )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _length_ be TypedArrayLength(_taRecord_). + 1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_length_) »). + 1. Let _k_ be 0. + 1. Repeat, while _k_ < _length_, + 1. Let _from_ be ! ToString(𝔽(_length_ - _k_ - 1)). + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. Let _fromValue_ be ! Get(_O_, _from_). + 1. Perform ! Set(_A_, _Pk_, _fromValue_, *true*). + 1. Set _k_ to _k_ + 1. + 1. Return _A_. + +
        + + +

        %TypedArray%.prototype.toSorted ( _comparefn_ )

        +

        This method performs the following steps when called:

        + + 1. If _comparefn_ is not *undefined* and IsCallable(_comparefn_) is *false*, throw a *TypeError* exception. + 1. Let _O_ be the *this* value. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_len_) »). + 1. NOTE: The following closure performs a numeric comparison rather than the string comparison used in . + 1. Let _SortCompare_ be a new Abstract Closure with parameters (_x_, _y_) that captures _comparefn_ and performs the following steps when called: + 1. Return ? CompareTypedArrayElements(_x_, _y_, _comparefn_). + 1. Let _sortedList_ be ? SortIndexedProperties(_O_, _len_, _SortCompare_, ~read-through-holes~). + 1. Let _j_ be 0. + 1. Repeat, while _j_ < _len_, + 1. Perform ! Set(_A_, ! ToString(𝔽(_j_)), _sortedList_[_j_], *true*). + 1. Set _j_ to _j_ + 1. + 1. Return _A_. + +
        +

        %TypedArray%.prototype.toString ( )

        The initial value of the *"toString"* property is %Array.prototype.toString%, defined in .

        @@ -40353,11 +41873,36 @@

        %TypedArray%.prototype.values ( )

        This method performs the following steps when called:

        1. Let _O_ be the *this* value. - 1. Perform ? ValidateTypedArray(_O_). + 1. Perform ? ValidateTypedArray(_O_, ~seq-cst~). 1. Return CreateArrayIterator(_O_, ~value~).
        + +

        %TypedArray%.prototype.with ( _index_, _value_ )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~). + 1. Let _len_ be TypedArrayLength(_taRecord_). + 1. Let _relativeIndex_ be ? ToIntegerOrInfinity(_index_). + 1. If _relativeIndex_ ≥ 0, let _actualIndex_ be _relativeIndex_. + 1. Else, let _actualIndex_ be _len_ + _relativeIndex_. + 1. If _O_.[[ContentType]] is ~bigint~, let _numericValue_ be ? ToBigInt(_value_). + 1. Else, let _numericValue_ be ? ToNumber(_value_). + 1. If IsValidIntegerIndex(_O_, 𝔽(_actualIndex_)) is *false*, throw a *RangeError* exception. + 1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_len_) »). + 1. Let _k_ be 0. + 1. Repeat, while _k_ < _len_, + 1. Let _Pk_ be ! ToString(𝔽(_k_)). + 1. If _k_ = _actualIndex_, let _fromValue_ be _numericValue_. + 1. Else, let _fromValue_ be ! Get(_O_, _Pk_). + 1. Perform ! Set(_A_, _Pk_, _fromValue_, *true*). + 1. Set _k_ to _k_ + 1. + 1. Return _A_. + +
        +

        %TypedArray%.prototype [ @@iterator ] ( )

        The initial value of the @@iterator property is %TypedArray.prototype.values%, defined in .

        @@ -40394,18 +41939,18 @@

        It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. Unlike ArraySpeciesCreate, which can create non-Array objects through the use of @@species, this operation enforces that the constructor function creates an actual TypedArray.
        - 1. Let _defaultConstructor_ be the intrinsic object listed in column one of for _exemplar_.[[TypedArrayName]]. + 1. Let _defaultConstructor_ be the intrinsic object associated with the constructor name _exemplar_.[[TypedArrayName]] in . 1. Let _constructor_ be ? SpeciesConstructor(_exemplar_, _defaultConstructor_). - 1. Let _result_ be ? TypedArrayCreate(_constructor_, _argumentList_). + 1. Let _result_ be ? TypedArrayCreateFromConstructor(_constructor_, _argumentList_). 1. Assert: _result_ has [[TypedArrayName]] and [[ContentType]] internal slots. - 1. If _result_.[[ContentType]] ≠ _exemplar_.[[ContentType]], throw a *TypeError* exception. + 1. If _result_.[[ContentType]] is not _exemplar_.[[ContentType]], throw a *TypeError* exception. 1. Return _result_. - +

        - TypedArrayCreate ( + TypedArrayCreateFromConstructor ( _constructor_: a constructor, _argumentList_: a List of ECMAScript language values, ): either a normal completion containing a TypedArray or a throw completion @@ -40416,27 +41961,50 @@

        1. Let _newTypedArray_ be ? Construct(_constructor_, _argumentList_). - 1. Perform ? ValidateTypedArray(_newTypedArray_). - 1. If _argumentList_ is a List of a single Number, then - 1. If _newTypedArray_.[[ArrayLength]] < ℝ(_argumentList_[0]), throw a *TypeError* exception. + 1. Let _taRecord_ be ? ValidateTypedArray(_newTypedArray_, ~seq-cst~). + 1. If the number of elements in _argumentList_ is 1 and _argumentList_[0] is a Number, then + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. + 1. Let _length_ be TypedArrayLength(_taRecord_). + 1. If _length_ < ℝ(_argumentList_[0]), throw a *TypeError* exception. 1. Return _newTypedArray_. + +

        + TypedArrayCreateSameType ( + _exemplar_: a TypedArray, + _argumentList_: a List of ECMAScript language values, + ): either a normal completion containing a TypedArray or a throw completion +

        +
        +
        description
        +
        It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. Unlike TypedArraySpeciesCreate, which can construct custom TypedArray subclasses through the use of @@species, this operation always uses one of the built-in TypedArray constructors.
        +
        + + 1. Let _constructor_ be the intrinsic object associated with the constructor name _exemplar_.[[TypedArrayName]] in . + 1. Let _result_ be ? TypedArrayCreateFromConstructor(_constructor_, _argumentList_). + 1. Assert: _result_ has [[TypedArrayName]] and [[ContentType]] internal slots. + 1. Assert: _result_.[[ContentType]] is _exemplar_.[[ContentType]]. + 1. Return _result_. + +
        +

        ValidateTypedArray ( _O_: an ECMAScript language value, - ): either a normal completion containing ~unused~ or a throw completion + _order_: ~seq-cst~ or ~unordered~, + ): either a normal completion containing a TypedArray With Buffer Witness Record or a throw completion

        1. Perform ? RequireInternalSlot(_O_, [[TypedArrayName]]). 1. Assert: _O_ has a [[ViewedArrayBuffer]] internal slot. - 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. Return ~unused~. + 1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_O_, _order_). + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. + 1. Return _taRecord_.
        @@ -40465,6 +42033,36 @@

        1. Return the Element Type value specified in for _O_.[[TypedArrayName]]. + + +

        + CompareTypedArrayElements ( + _x_: a Number or a BigInt, + _y_: a Number or a BigInt, + _comparefn_: a function object or *undefined*, + ): either a normal completion containing a Number or an abrupt completion +

        +
        +
        + + 1. Assert: _x_ is a Number and _y_ is a Number, or _x_ is a BigInt and _y_ is a BigInt. + 1. If _comparefn_ is not *undefined*, then + 1. Let _v_ be ? ToNumber(? Call(_comparefn_, *undefined*, « _x_, _y_ »)). + 1. If _v_ is *NaN*, return *+0*𝔽. + 1. Return _v_. + 1. If _x_ and _y_ are both *NaN*, return *+0*𝔽. + 1. If _x_ is *NaN*, return *1*𝔽. + 1. If _y_ is *NaN*, return *-1*𝔽. + 1. If _x_ < _y_, return *-1*𝔽. + 1. If _x_ > _y_, return *1*𝔽. + 1. If _x_ is *-0*𝔽 and _y_ is *+0*𝔽, return *-1*𝔽. + 1. If _x_ is *+0*𝔽 and _y_ is *-0*𝔽, return *1*𝔽. + 1. Return *+0*𝔽. + + + This performs a numeric comparison rather than the string comparison used in . + +
        @@ -40475,7 +42073,6 @@

        The _TypedArray_ Constructors

      • is a function whose behaviour differs based upon the number and types of its arguments. The actual behaviour of a call of _TypedArray_ depends upon the number and kind of arguments that are passed to it.
      • is not intended to be called as a function and will throw an exception when called in that manner.
      • may be used as the value of an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified _TypedArray_ behaviour must include a `super` call to the _TypedArray_ constructor to create and initialize the subclass instance with the internal state necessary to support the %TypedArray%`.prototype` built-in methods.
      • -
      • has a *"length"* property whose value is *3*𝔽.
      • @@ -40502,7 +42099,7 @@

        _TypedArray_ ( ..._args_ )

        1. Assert: _firstArgument_ is an Object and _firstArgument_ does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] internal slot. 1. Let _usingIterator_ be ? GetMethod(_firstArgument_, @@iterator). 1. If _usingIterator_ is not *undefined*, then - 1. Let _values_ be ? IterableToList(_firstArgument_, _usingIterator_). + 1. Let _values_ be ? IteratorToList(? GetIteratorFromMethod(_firstArgument_, _usingIterator_)). 1. Perform ? InitializeTypedArrayFromList(_O_, _values_). 1. Else, 1. NOTE: _firstArgument_ is not an Iterable so assume it is already an array-like object. @@ -40529,11 +42126,11 @@

        1. Let _proto_ be ? GetPrototypeFromConstructor(_newTarget_, _defaultProto_). - 1. Let _obj_ be IntegerIndexedObjectCreate(_proto_). + 1. Let _obj_ be TypedArrayCreate(_proto_). 1. Assert: _obj_.[[ViewedArrayBuffer]] is *undefined*. 1. Set _obj_.[[TypedArrayName]] to _constructorName_. - 1. If _constructorName_ is *"BigInt64Array"* or *"BigUint64Array"*, set _obj_.[[ContentType]] to ~BigInt~. - 1. Otherwise, set _obj_.[[ContentType]] to ~Number~. + 1. If _constructorName_ is either *"BigInt64Array"* or *"BigUint64Array"*, set _obj_.[[ContentType]] to ~bigint~. + 1. Otherwise, set _obj_.[[ContentType]] to ~number~. 1. If _length_ is not present, then 1. Set _obj_.[[ByteLength]] to 0. 1. Set _obj_.[[ByteOffset]] to 0. @@ -40555,25 +42152,26 @@

        1. Let _srcData_ be _srcArray_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_srcData_) is *true*, throw a *TypeError* exception. 1. Let _elementType_ be TypedArrayElementType(_O_). 1. Let _elementSize_ be TypedArrayElementSize(_O_). 1. Let _srcType_ be TypedArrayElementType(_srcArray_). 1. Let _srcElementSize_ be TypedArrayElementSize(_srcArray_). 1. Let _srcByteOffset_ be _srcArray_.[[ByteOffset]]. - 1. Let _elementLength_ be _srcArray_.[[ArrayLength]]. + 1. Let _srcRecord_ be MakeTypedArrayWithBufferWitnessRecord(_srcArray_, ~seq-cst~). + 1. If IsTypedArrayOutOfBounds(_srcRecord_) is *true*, throw a *TypeError* exception. + 1. Let _elementLength_ be TypedArrayLength(_srcRecord_). 1. Let _byteLength_ be _elementSize_ × _elementLength_. - 1. If _elementType_ is the same as _srcType_, then + 1. If _elementType_ is _srcType_, then 1. Let _data_ be ? CloneArrayBuffer(_srcData_, _srcByteOffset_, _byteLength_). 1. Else, 1. Let _data_ be ? AllocateArrayBuffer(%ArrayBuffer%, _byteLength_). - 1. If _srcArray_.[[ContentType]] ≠ _O_.[[ContentType]], throw a *TypeError* exception. + 1. If _srcArray_.[[ContentType]] is not _O_.[[ContentType]], throw a *TypeError* exception. 1. Let _srcByteIndex_ be _srcByteOffset_. 1. Let _targetByteIndex_ be 0. 1. Let _count_ be _elementLength_. 1. Repeat, while _count_ > 0, - 1. Let _value_ be GetValueFromBuffer(_srcData_, _srcByteIndex_, _srcType_, *true*, ~Unordered~). - 1. Perform SetValueInBuffer(_data_, _targetByteIndex_, _elementType_, _value_, *true*, ~Unordered~). + 1. Let _value_ be GetValueFromBuffer(_srcData_, _srcByteIndex_, _srcType_, *true*, ~unordered~). + 1. Perform SetValueInBuffer(_data_, _targetByteIndex_, _elementType_, _value_, *true*, ~unordered~). 1. Set _srcByteIndex_ to _srcByteIndex_ + _srcElementSize_. 1. Set _targetByteIndex_ to _targetByteIndex_ + _elementSize_. 1. Set _count_ to _count_ - 1. @@ -40600,21 +42198,27 @@

        1. Let _elementSize_ be TypedArrayElementSize(_O_). 1. Let _offset_ be ? ToIndex(_byteOffset_). 1. If _offset_ modulo _elementSize_ ≠ 0, throw a *RangeError* exception. + 1. Let _bufferIsFixedLength_ be IsFixedLengthArrayBuffer(_buffer_). 1. If _length_ is not *undefined*, then 1. Let _newLength_ be ? ToIndex(_length_). 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. Let _bufferByteLength_ be _buffer_.[[ArrayBufferByteLength]]. - 1. If _length_ is *undefined*, then - 1. If _bufferByteLength_ modulo _elementSize_ ≠ 0, throw a *RangeError* exception. - 1. Let _newByteLength_ be _bufferByteLength_ - _offset_. - 1. If _newByteLength_ < 0, throw a *RangeError* exception. + 1. Let _bufferByteLength_ be ArrayBufferByteLength(_buffer_, ~seq-cst~). + 1. If _length_ is *undefined* and _bufferIsFixedLength_ is *false*, then + 1. If _offset_ > _bufferByteLength_, throw a *RangeError* exception. + 1. Set _O_.[[ByteLength]] to ~auto~. + 1. Set _O_.[[ArrayLength]] to ~auto~. 1. Else, - 1. Let _newByteLength_ be _newLength_ × _elementSize_. - 1. If _offset_ + _newByteLength_ > _bufferByteLength_, throw a *RangeError* exception. + 1. If _length_ is *undefined*, then + 1. If _bufferByteLength_ modulo _elementSize_ ≠ 0, throw a *RangeError* exception. + 1. Let _newByteLength_ be _bufferByteLength_ - _offset_. + 1. If _newByteLength_ < 0, throw a *RangeError* exception. + 1. Else, + 1. Let _newByteLength_ be _newLength_ × _elementSize_. + 1. If _offset_ + _newByteLength_ > _bufferByteLength_, throw a *RangeError* exception. + 1. Set _O_.[[ByteLength]] to _newByteLength_. + 1. Set _O_.[[ArrayLength]] to _newByteLength_ / _elementSize_. 1. Set _O_.[[ViewedArrayBuffer]] to _buffer_. - 1. Set _O_.[[ByteLength]] to _newByteLength_. 1. Set _O_.[[ByteOffset]] to _offset_. - 1. Set _O_.[[ArrayLength]] to _newByteLength_ / _elementSize_. 1. Return ~unused~. @@ -40696,6 +42300,7 @@

        Properties of the _TypedArray_ Constructors

        Each _TypedArray_ constructor:

        • has a [[Prototype]] internal slot whose value is %TypedArray%.
        • +
        • has a *"length"* property whose value is *3*𝔽.
        • has a *"name"* property whose value is the String value of the constructor name specified for it in .
        • has the following properties:
        @@ -40730,13 +42335,13 @@

        _TypedArray_.prototype.BYTES_PER_ELEMENT

        _TypedArray_.prototype.constructor

        -

        The initial value of a _TypedArray_`.prototype.constructor` is the corresponding %TypedArray% intrinsic object.

        +

        The initial value of the *"constructor"* property of the prototype for a given _TypedArray_ constructor is the constructor itself.

        Properties of _TypedArray_ Instances

        -

        _TypedArray_ instances are Integer-Indexed exotic objects. Each _TypedArray_ instance inherits properties from the corresponding _TypedArray_ prototype object. Each _TypedArray_ instance has the following internal slots: [[TypedArrayName]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]], and [[ArrayLength]].

        +

        _TypedArray_ instances are TypedArrays. Each _TypedArray_ instance inherits properties from the corresponding _TypedArray_ prototype object. Each _TypedArray_ instance has the following internal slots: [[TypedArrayName]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]], and [[ArrayLength]].

        @@ -40790,17 +42395,16 @@

        _adder_ will be invoked, with _target_ as the receiver.
        - 1. Let _iteratorRecord_ be ? GetIterator(_iterable_). + 1. Let _iteratorRecord_ be ? GetIterator(_iterable_, ~sync~). 1. Repeat, - 1. Let _next_ be ? IteratorStep(_iteratorRecord_). - 1. If _next_ is *false*, return _target_. - 1. Let _nextItem_ be ? IteratorValue(_next_). - 1. If _nextItem_ is not an Object, then + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, return _target_. + 1. If _next_ is not an Object, then 1. Let _error_ be ThrowCompletion(a newly created *TypeError* object). 1. Return ? IteratorClose(_iteratorRecord_, _error_). - 1. Let _k_ be Completion(Get(_nextItem_, *"0"*)). + 1. Let _k_ be Completion(Get(_next_, *"0"*)). 1. IfAbruptCloseIterator(_k_, _iteratorRecord_). - 1. Let _v_ be Completion(Get(_nextItem_, *"1"*)). + 1. Let _v_ be Completion(Get(_next_, *"1"*)). 1. IfAbruptCloseIterator(_v_, _iteratorRecord_). 1. Let _status_ be Completion(Call(_adder_, _target_, « _k_, _v_ »)). 1. IfAbruptCloseIterator(_status_, _iteratorRecord_). @@ -40819,6 +42423,25 @@

        Properties of the Map Constructor

      • has the following properties:
      • + +

        Map.groupBy ( _items_, _callbackfn_ )

        + +

        _callbackfn_ should be a function that accepts two arguments. `groupBy` calls _callbackfn_ once for each element in _items_, in ascending order, and constructs a new Map. Each value returned by _callbackfn_ is used as a key in the Map. For each such key, the result Map has an entry whose key is that key and whose value is an array containing all the elements for which _callbackfn_ returned that key.

        +

        _callbackfn_ is called with two arguments: the value of the element and the index of the element.

        +

        The return value of `groupBy` is a Map.

        +
        +

        This function performs the following steps when called:

        + + 1. Let _groups_ be ? GroupBy(_items_, _callbackfn_, ~zero~). + 1. Let _map_ be ! Construct(%Map%). + 1. For each Record { [[Key]], [[Elements]] } _g_ of _groups_, do + 1. Let _elements_ be CreateArrayFromList(_g_.[[Elements]]). + 1. Let _entry_ be the Record { [[Key]]: _g_.[[Key]], [[Value]]: _elements_ }. + 1. Append _entry_ to _map_.[[MapData]]. + 1. Return _map_. + +
        +

        Map.prototype

        The initial value of `Map.prototype` is the Map prototype object.

        @@ -40854,8 +42477,7 @@

        Map.prototype.clear ( )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[MapData]]). - 1. Let _entries_ be the List that is _M_.[[MapData]]. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do 1. Set _p_.[[Key]] to ~empty~. 1. Set _p_.[[Value]] to ~empty~. 1. Return *undefined*. @@ -40876,8 +42498,7 @@

        Map.prototype.delete ( _key_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[MapData]]). - 1. Let _entries_ be the List that is _M_.[[MapData]]. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, then 1. Set _p_.[[Key]] to ~empty~. 1. Set _p_.[[Value]] to ~empty~. @@ -40905,11 +42526,11 @@

        Map.prototype.forEach ( _callbackfn_ [ , _thisArg_ ] )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[MapData]]). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. - 1. Let _entries_ be the List that is _M_.[[MapData]]. + 1. Let _entries_ be _M_.[[MapData]]. 1. Let _numEntries_ be the number of elements in _entries_. 1. Let _index_ be 0. 1. Repeat, while _index_ < _numEntries_, - 1. Let _e_ be the Record { [[Key]], [[Value]] } that is the value of _entries_[_index_]. + 1. Let _e_ be _entries_[_index_]. 1. Set _index_ to _index_ + 1. 1. If _e_.[[Key]] is not ~empty~, then 1. Perform ? Call(_callbackfn_, _thisArg_, « _e_.[[Value]], _e_.[[Key]], _M_ »). @@ -40931,8 +42552,7 @@

        Map.prototype.get ( _key_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[MapData]]). - 1. Let _entries_ be the List that is _M_.[[MapData]]. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]]. 1. Return *undefined*. @@ -40944,8 +42564,7 @@

        Map.prototype.has ( _key_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[MapData]]). - 1. Let _entries_ be the List that is _M_.[[MapData]]. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, return *true*. 1. Return *false*. @@ -40966,14 +42585,13 @@

        Map.prototype.set ( _key_, _value_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[MapData]]). - 1. Let _entries_ be the List that is _M_.[[MapData]]. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, then 1. Set _p_.[[Value]] to _value_. 1. Return _M_. 1. If _key_ is *-0*𝔽, set _key_ to *+0*𝔽. 1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }. - 1. Append _p_ to _entries_. + 1. Append _p_ to _M_.[[MapData]]. 1. Return _M_.
        @@ -40984,9 +42602,8 @@

        get Map.prototype.size

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[MapData]]). - 1. Let _entries_ be the List that is _M_.[[MapData]]. 1. Let _count_ be 0. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do 1. If _p_.[[Key]] is not ~empty~, set _count_ to _count_ + 1. 1. Return 𝔽(_count_). @@ -41036,15 +42653,17 @@

        1. Perform ? RequireInternalSlot(_map_, [[MapData]]). 1. Let _closure_ be a new Abstract Closure with no parameters that captures _map_ and _kind_ and performs the following steps when called: - 1. Let _entries_ be the List that is _map_.[[MapData]]. + 1. Let _entries_ be _map_.[[MapData]]. 1. Let _index_ be 0. 1. Let _numEntries_ be the number of elements in _entries_. 1. Repeat, while _index_ < _numEntries_, - 1. Let _e_ be the Record { [[Key]], [[Value]] } that is the value of _entries_[_index_]. + 1. Let _e_ be _entries_[_index_]. 1. Set _index_ to _index_ + 1. 1. If _e_.[[Key]] is not ~empty~, then - 1. If _kind_ is ~key~, let _result_ be _e_.[[Key]]. - 1. Else if _kind_ is ~value~, let _result_ be _e_.[[Value]]. + 1. If _kind_ is ~key~, then + 1. Let _result_ be _e_.[[Key]]. + 1. Else if _kind_ is ~value~, then + 1. Let _result_ be _e_.[[Value]]. 1. Else, 1. Assert: _kind_ is ~key+value~. 1. Let _result_ be CreateArrayFromList(« _e_.[[Key]], _e_.[[Value]] »). @@ -41108,12 +42727,11 @@

        Set ( [ _iterable_ ] )

        1. If _iterable_ is either *undefined* or *null*, return _set_. 1. Let _adder_ be ? Get(_set_, *"add"*). 1. If IsCallable(_adder_) is *false*, throw a *TypeError* exception. - 1. Let _iteratorRecord_ be ? GetIterator(_iterable_). + 1. Let _iteratorRecord_ be ? GetIterator(_iterable_, ~sync~). 1. Repeat, - 1. Let _next_ be ? IteratorStep(_iteratorRecord_). - 1. If _next_ is *false*, return _set_. - 1. Let _nextValue_ be ? IteratorValue(_next_). - 1. Let _status_ be Completion(Call(_adder_, _set_, « _nextValue_ »)). + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, return _set_. + 1. Let _status_ be Completion(Call(_adder_, _set_, « _next_ »)). 1. IfAbruptCloseIterator(_status_, _iteratorRecord_).
        @@ -41162,12 +42780,11 @@

        Set.prototype.add ( _value_ )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). - 1. Let _entries_ be the List that is _S_.[[SetData]]. - 1. For each element _e_ of _entries_, do + 1. For each element _e_ of _S_.[[SetData]], do 1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then 1. Return _S_. 1. If _value_ is *-0*𝔽, set _value_ to *+0*𝔽. - 1. Append _value_ to _entries_. + 1. Append _value_ to _S_.[[SetData]]. 1. Return _S_. @@ -41178,9 +42795,8 @@

        Set.prototype.clear ( )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). - 1. Let _entries_ be the List that is _S_.[[SetData]]. - 1. For each element _e_ of _entries_, do - 1. Replace the element of _entries_ whose value is _e_ with an element whose value is ~empty~. + 1. For each element _e_ of _S_.[[SetData]], do + 1. Replace the element of _S_.[[SetData]] whose value is _e_ with an element whose value is ~empty~. 1. Return *undefined*. @@ -41199,10 +42815,9 @@

        Set.prototype.delete ( _value_ )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). - 1. Let _entries_ be the List that is _S_.[[SetData]]. - 1. For each element _e_ of _entries_, do + 1. For each element _e_ of _S_.[[SetData]], do 1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then - 1. Replace the element of _entries_ whose value is _e_ with an element whose value is ~empty~. + 1. Replace the element of _S_.[[SetData]] whose value is _e_ with an element whose value is ~empty~. 1. Return *true*. 1. Return *false*. @@ -41230,7 +42845,7 @@

        Set.prototype.forEach ( _callbackfn_ [ , _thisArg_ ] )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). 1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception. - 1. Let _entries_ be the List that is _S_.[[SetData]]. + 1. Let _entries_ be _S_.[[SetData]]. 1. Let _numEntries_ be the number of elements in _entries_. 1. Let _index_ be 0. 1. Repeat, while _index_ < _numEntries_, @@ -41258,8 +42873,7 @@

        Set.prototype.has ( _value_ )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). - 1. Let _entries_ be the List that is _S_.[[SetData]]. - 1. For each element _e_ of _entries_, do + 1. For each element _e_ of _S_.[[SetData]], do 1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, return *true*. 1. Return *false*. @@ -41279,9 +42893,8 @@

        get Set.prototype.size

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). - 1. Let _entries_ be the List that is _S_.[[SetData]]. 1. Let _count_ be 0. - 1. For each element _e_ of _entries_, do + 1. For each element _e_ of _S_.[[SetData]], do 1. If _e_ is not ~empty~, set _count_ to _count_ + 1. 1. Return 𝔽(_count_). @@ -41332,7 +42945,7 @@

        1. Perform ? RequireInternalSlot(_set_, [[SetData]]). 1. Let _closure_ be a new Abstract Closure with no parameters that captures _set_ and _kind_ and performs the following steps when called: 1. Let _index_ be 0. - 1. Let _entries_ be the List that is _set_.[[SetData]]. + 1. Let _entries_ be _set_.[[SetData]]. 1. Let _numEntries_ be the number of elements in _entries_. 1. Repeat, while _index_ < _numEntries_, 1. Let _e_ be _entries_[_index_]. @@ -41379,11 +42992,11 @@

        %SetIteratorPrototype% [ @@toStringTag ]

        WeakMap Objects

        -

        WeakMaps are collections of key/value pairs where the keys are objects and values may be arbitrary ECMAScript language values. A WeakMap may be queried to see if it contains a key/value pair with a specific key, but no mechanism is provided for enumerating the objects it holds as keys. In certain conditions, objects which are not live are removed as WeakMap keys, as described in .

        +

        WeakMaps are collections of key/value pairs where the keys are objects and/or symbols and values may be arbitrary ECMAScript language values. A WeakMap may be queried to see if it contains a key/value pair with a specific key, but no mechanism is provided for enumerating the values it holds as keys. In certain conditions, values which are not live are removed as WeakMap keys, as described in .

        An implementation may impose an arbitrarily determined latency between the time a key/value pair of a WeakMap becomes inaccessible and the time when the key/value pair is removed from the WeakMap. If this latency was observable to ECMAScript program, it would be a source of indeterminacy that could impact program execution. For that reason, an ECMAScript implementation must not provide any means to observe a key of a WeakMap that does not require the observer to present the observed key.

        WeakMaps must be implemented using either hash tables or other mechanisms that, on average, provide access times that are sublinear on the number of key/value pairs in the collection. The data structure used in this specification is only intended to describe the required observable semantics of WeakMaps. It is not intended to be a viable implementation model.

        -

        WeakMap and WeakSets are intended to provide mechanisms for dynamically associating state with an object in a manner that does not “leak” memory resources if, in the absence of the WeakMap or WeakSet, the object otherwise became inaccessible and subject to resource reclamation by the implementation's garbage collection mechanisms. This characteristic can be achieved by using an inverted per-object mapping of weak map instances to keys. Alternatively each weak map may internally store its key to value mappings but this approach requires coordination between the WeakMap or WeakSet implementation and the garbage collector. The following references describe mechanism that may be useful to implementations of WeakMap and WeakSets:

        +

        WeakMap and WeakSet are intended to provide mechanisms for dynamically associating state with an object or symbol in a manner that does not “leak” memory resources if, in the absence of the WeakMap or WeakSet instance, the object or symbol otherwise became inaccessible and subject to resource reclamation by the implementation's garbage collection mechanisms. This characteristic can be achieved by using an inverted per-object/symbol mapping of WeakMap or WeakSet instances to keys. Alternatively, each WeakMap or WeakSet instance may internally store its key and value data, but this approach requires coordination between the WeakMap or WeakSet implementation and the garbage collector. The following references describe mechanism that may be useful to implementations of WeakMap and WeakSet:

        Barry Hayes. 1997. Ephemerons: a new finalization mechanism. In Proceedings of the 12th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications (OOPSLA '97), A. Michael Berman (Ed.). ACM, New York, NY, USA, 176-183, http://doi.acm.org/10.1145/263698.263733.

        Alexandra Barros, Roberto Ierusalimschy, Eliminating Cycles in Weak Tables. Journal of Universal Computer Science - J.UCS, vol. 14, no. 21, pp. 3481-3497, 2008, http://www.jucs.org/jucs_14_21/eliminating_cycles_in_weak

        @@ -41453,9 +43066,8 @@

        WeakMap.prototype.delete ( _key_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[WeakMapData]]). - 1. Let _entries_ be the List that is _M_.[[WeakMapData]]. - 1. If _key_ is not an Object, return *false*. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. If CanBeHeldWeakly(_key_) is *false*, return *false*. + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, then 1. Set _p_.[[Key]] to ~empty~. 1. Set _p_.[[Value]] to ~empty~. @@ -41473,9 +43085,8 @@

        WeakMap.prototype.get ( _key_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[WeakMapData]]). - 1. Let _entries_ be the List that is _M_.[[WeakMapData]]. - 1. If _key_ is not an Object, return *undefined*. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. If CanBeHeldWeakly(_key_) is *false*, return *undefined*. + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]]. 1. Return *undefined*. @@ -41487,9 +43098,8 @@

        WeakMap.prototype.has ( _key_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[WeakMapData]]). - 1. Let _entries_ be the List that is _M_.[[WeakMapData]]. - 1. If _key_ is not an Object, return *false*. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. If CanBeHeldWeakly(_key_) is *false*, return *false*. + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return *true*. 1. Return *false*. @@ -41501,14 +43111,13 @@

        WeakMap.prototype.set ( _key_, _value_ )

        1. Let _M_ be the *this* value. 1. Perform ? RequireInternalSlot(_M_, [[WeakMapData]]). - 1. Let _entries_ be the List that is _M_.[[WeakMapData]]. - 1. If _key_ is not an Object, throw a *TypeError* exception. - 1. For each Record { [[Key]], [[Value]] } _p_ of _entries_, do + 1. If CanBeHeldWeakly(_key_) is *false*, throw a *TypeError* exception. + 1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do 1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, then 1. Set _p_.[[Value]] to _value_. 1. Return _M_. 1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }. - 1. Append _p_ to _entries_. + 1. Append _p_ to _M_.[[WeakMapData]]. 1. Return _M_.
        @@ -41528,8 +43137,8 @@

        Properties of WeakMap Instances

        WeakSet Objects

        -

        WeakSets are collections of objects. A distinct object may only occur once as an element of a WeakSet's collection. A WeakSet may be queried to see if it contains a specific object, but no mechanism is provided for enumerating the objects it holds. In certain conditions, objects which are not live are removed as WeakSet elements, as described in .

        -

        An implementation may impose an arbitrarily determined latency between the time an object contained in a WeakSet becomes inaccessible and the time when the object is removed from the WeakSet. If this latency was observable to ECMAScript program, it would be a source of indeterminacy that could impact program execution. For that reason, an ECMAScript implementation must not provide any means to determine if a WeakSet contains a particular object that does not require the observer to present the observed object.

        +

        WeakSets are collections of objects and/or symbols. A distinct object or symbol may only occur once as an element of a WeakSet's collection. A WeakSet may be queried to see if it contains a specific value, but no mechanism is provided for enumerating the values it holds. In certain conditions, values which are not live are removed as WeakSet elements, as described in .

        +

        An implementation may impose an arbitrarily determined latency between the time a value contained in a WeakSet becomes inaccessible and the time when the value is removed from the WeakSet. If this latency was observable to ECMAScript program, it would be a source of indeterminacy that could impact program execution. For that reason, an ECMAScript implementation must not provide any means to determine if a WeakSet contains a particular value that does not require the observer to present the observed value.

        WeakSets must be implemented using either hash tables or other mechanisms that, on average, provide access times that are sublinear on the number of elements in the collection. The data structure used in this specification is only intended to describe the required observable semantics of WeakSets. It is not intended to be a viable implementation model.

        See the NOTE in .

        @@ -41556,12 +43165,11 @@

        WeakSet ( [ _iterable_ ] )

        1. If _iterable_ is either *undefined* or *null*, return _set_. 1. Let _adder_ be ? Get(_set_, *"add"*). 1. If IsCallable(_adder_) is *false*, throw a *TypeError* exception. - 1. Let _iteratorRecord_ be ? GetIterator(_iterable_). + 1. Let _iteratorRecord_ be ? GetIterator(_iterable_, ~sync~). 1. Repeat, - 1. Let _next_ be ? IteratorStep(_iteratorRecord_). - 1. If _next_ is *false*, return _set_. - 1. Let _nextValue_ be ? IteratorValue(_next_). - 1. Let _status_ be Completion(Call(_adder_, _set_, « _nextValue_ »)). + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, return _set_. + 1. Let _status_ be Completion(Call(_adder_, _set_, « _next_ »)). 1. IfAbruptCloseIterator(_status_, _iteratorRecord_).
        @@ -41598,12 +43206,11 @@

        WeakSet.prototype.add ( _value_ )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[WeakSetData]]). - 1. If _value_ is not an Object, throw a *TypeError* exception. - 1. Let _entries_ be the List that is _S_.[[WeakSetData]]. - 1. For each element _e_ of _entries_, do + 1. If CanBeHeldWeakly(_value_) is *false*, throw a *TypeError* exception. + 1. For each element _e_ of _S_.[[WeakSetData]], do 1. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, then 1. Return _S_. - 1. Append _value_ to _entries_. + 1. Append _value_ to _S_.[[WeakSetData]]. 1. Return _S_. @@ -41619,11 +43226,10 @@

        WeakSet.prototype.delete ( _value_ )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[WeakSetData]]). - 1. If _value_ is not an Object, return *false*. - 1. Let _entries_ be the List that is _S_.[[WeakSetData]]. - 1. For each element _e_ of _entries_, do + 1. If CanBeHeldWeakly(_value_) is *false*, return *false*. + 1. For each element _e_ of _S_.[[WeakSetData]], do 1. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, then - 1. Replace the element of _entries_ whose value is _e_ with an element whose value is ~empty~. + 1. Replace the element of _S_.[[WeakSetData]] whose value is _e_ with an element whose value is ~empty~. 1. Return *true*. 1. Return *false*. @@ -41638,9 +43244,8 @@

        WeakSet.prototype.has ( _value_ )

        1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[WeakSetData]]). - 1. Let _entries_ be the List that is _S_.[[WeakSetData]]. - 1. If _value_ is not an Object, return *false*. - 1. For each element _e_ of _entries_, do + 1. If CanBeHeldWeakly(_value_) is *false*, return *false*. + 1. For each element _e_ of _S_.[[WeakSetData]], do 1. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, return *true*. 1. Return *false*. @@ -41683,6 +43288,13 @@

        Notation

        + +

        Fixed-length and Resizable ArrayBuffer Objects

        +

        A fixed-length ArrayBuffer is an ArrayBuffer whose byte length cannot change after creation.

        +

        A resizable ArrayBuffer is an ArrayBuffer whose byte length may change after creation via calls to .

        +

        The kind of ArrayBuffer object that is created depends on the arguments passed to .

        +
        +

        Abstract Operations For ArrayBuffer Objects

        @@ -41691,6 +43303,7 @@

        AllocateArrayBuffer ( _constructor_: a constructor, _byteLength_: a non-negative integer, + optional _maxByteLength_: a non-negative integer or ~empty~, ): either a normal completion containing an ArrayBuffer or a throw completion

        @@ -41698,14 +43311,77 @@

        It is used to create an ArrayBuffer.

        - 1. Let _obj_ be ? OrdinaryCreateFromConstructor(_constructor_, *"%ArrayBuffer.prototype%"*, « [[ArrayBufferData]], [[ArrayBufferByteLength]], [[ArrayBufferDetachKey]] »). + 1. Let _slots_ be « [[ArrayBufferData]], [[ArrayBufferByteLength]], [[ArrayBufferDetachKey]] ». + 1. If _maxByteLength_ is present and _maxByteLength_ is not ~empty~, let _allocatingResizableBuffer_ be *true*; otherwise let _allocatingResizableBuffer_ be *false*. + 1. If _allocatingResizableBuffer_ is *true*, then + 1. If _byteLength_ > _maxByteLength_, throw a *RangeError* exception. + 1. Append [[ArrayBufferMaxByteLength]] to _slots_. + 1. Let _obj_ be ? OrdinaryCreateFromConstructor(_constructor_, *"%ArrayBuffer.prototype%"*, _slots_). 1. Let _block_ be ? CreateByteDataBlock(_byteLength_). 1. Set _obj_.[[ArrayBufferData]] to _block_. 1. Set _obj_.[[ArrayBufferByteLength]] to _byteLength_. + 1. If _allocatingResizableBuffer_ is *true*, then + 1. If it is not possible to create a Data Block _block_ consisting of _maxByteLength_ bytes, throw a *RangeError* exception. + 1. NOTE: Resizable ArrayBuffers are designed to be implementable with in-place growth. Implementations may throw if, for example, virtual memory cannot be reserved up front. + 1. Set _obj_.[[ArrayBufferMaxByteLength]] to _maxByteLength_. 1. Return _obj_.
        + +

        + ArrayBufferByteLength ( + _arrayBuffer_: an ArrayBuffer or SharedArrayBuffer, + _order_: ~seq-cst~ or ~unordered~, + ): a non-negative integer +

        +
        +
        + + 1. If IsSharedArrayBuffer(_arrayBuffer_) is *true* and _arrayBuffer_ has an [[ArrayBufferByteLengthData]] internal slot, then + 1. Let _bufferByteLengthBlock_ be _arrayBuffer_.[[ArrayBufferByteLengthData]]. + 1. Let _rawLength_ be GetRawBytesFromSharedBlock(_bufferByteLengthBlock_, 0, ~biguint64~, *true*, _order_). + 1. Let _isLittleEndian_ be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record. + 1. Return ℝ(RawBytesToNumeric(~biguint64~, _rawLength_, _isLittleEndian_)). + 1. Assert: IsDetachedBuffer(_arrayBuffer_) is *false*. + 1. Return _arrayBuffer_.[[ArrayBufferByteLength]]. + +
        + + +

        + ArrayBufferCopyAndDetach ( + _arrayBuffer_: an ECMAScript language value, + _newLength_: an ECMAScript language value, + _preserveResizability_: ~preserve-resizability~ or ~fixed-length~, + ): either a normal completion containing an ArrayBuffer or a throw completion +

        +
        +
        + + 1. Perform ? RequireInternalSlot(_arrayBuffer_, [[ArrayBufferData]]). + 1. If IsSharedArrayBuffer(_arrayBuffer_) is *true*, throw a *TypeError* exception. + 1. If _newLength_ is *undefined*, then + 1. Let _newByteLength_ be _arrayBuffer_.[[ArrayBufferByteLength]]. + 1. Else, + 1. Let _newByteLength_ be ? ToIndex(_newLength_). + 1. If IsDetachedBuffer(_arrayBuffer_) is *true*, throw a *TypeError* exception. + 1. If _preserveResizability_ is ~preserve-resizability~ and IsFixedLengthArrayBuffer(_arrayBuffer_) is *false*, then + 1. Let _newMaxByteLength_ be _arrayBuffer_.[[ArrayBufferMaxByteLength]]. + 1. Else, + 1. Let _newMaxByteLength_ be ~empty~. + 1. If _arrayBuffer_.[[ArrayBufferDetachKey]] is not *undefined*, throw a *TypeError* exception. + 1. Let _newBuffer_ be ? AllocateArrayBuffer(%ArrayBuffer%, _newByteLength_, _newMaxByteLength_). + 1. Let _copyLength_ be min(_newByteLength_, _arrayBuffer_.[[ArrayBufferByteLength]]). + 1. Let _fromBlock_ be _arrayBuffer_.[[ArrayBufferData]]. + 1. Let _toBlock_ be _newBuffer_.[[ArrayBufferData]]. + 1. Perform CopyDataBlockBytes(_toBlock_, 0, _fromBlock_, 0, _copyLength_). + 1. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as a zero-copy move or a `realloc`. + 1. Perform ! DetachArrayBuffer(_arrayBuffer_). + 1. Return _newBuffer_. + +
        +

        IsDetachedBuffer ( @@ -41728,6 +43404,8 @@

        ): either a normal completion containing ~unused~ or a throw completion

        +
        skip global checks
        +
        true
        1. Assert: IsSharedArrayBuffer(_arrayBuffer_) is *false*. @@ -41738,7 +43416,7 @@

        1. Return ~unused~. -

        Detaching an ArrayBuffer instance disassociates the Data Block used as its backing store from the instance and sets the byte length of the buffer to 0. No operations defined by this specification use the DetachArrayBuffer abstract operation. However, an ECMAScript host or implementation may define such operations.

        +

        Detaching an ArrayBuffer instance disassociates the Data Block used as its backing store from the instance and sets the byte length of the buffer to 0.

        @@ -41764,6 +43442,57 @@

        + +

        + GetArrayBufferMaxByteLengthOption ( + _options_: an ECMAScript language value, + ): either a normal completion containing either a non-negative integer or ~empty~, or a throw completion +

        +
        +
        + + 1. If _options_ is not an Object, return ~empty~. + 1. Let _maxByteLength_ be ? Get(_options_, *"maxByteLength"*). + 1. If _maxByteLength_ is *undefined*, return ~empty~. + 1. Return ? ToIndex(_maxByteLength_). + +
        + + +

        + HostResizeArrayBuffer ( + _buffer_: an ArrayBuffer, + _newByteLength_: a non-negative integer, + ): either a normal completion containing either ~handled~ or ~unhandled~, or a throw completion +

        +
        +
        description
        +
        It gives the host an opportunity to perform implementation-defined resizing of _buffer_. If the host chooses not to handle resizing of _buffer_, it may return ~unhandled~ for the default behaviour.
        +
        + +

        The implementation of HostResizeArrayBuffer must conform to the following requirements:

        +
          +
        • The abstract operation does not detach _buffer_.
        • +
        • If the abstract operation completes normally with ~handled~, _buffer_.[[ArrayBufferByteLength]] is _newByteLength_.
        • +
        + +

        The default implementation of HostResizeArrayBuffer is to return NormalCompletion(~unhandled~).

        +
        + + +

        + IsFixedLengthArrayBuffer ( + _arrayBuffer_: an ArrayBuffer or a SharedArrayBuffer, + ): a Boolean +

        +
        +
        + + 1. If _arrayBuffer_ has an [[ArrayBufferMaxByteLength]] internal slot, return *false*. + 1. Return *true*. + +
        +

        IsUnsignedElementType ( @@ -41775,7 +43504,7 @@

        It verifies if the argument _type_ is an unsigned TypedArray element type.
        - 1. If _type_ is ~Uint8~, ~Uint8C~, ~Uint16~, ~Uint32~, or ~BigUint64~, return *true*. + 1. If _type_ is one of ~uint8~, ~uint8clamped~, ~uint16~, ~uint32~, or ~biguint64~, return *true*. 1. Return *false*. @@ -41788,10 +43517,10 @@

        description
        -
        It verifies if the argument _type_ is an Integer TypedArray element type not including ~Uint8C~.
        +
        It verifies if the argument _type_ is an Integer TypedArray element type not including ~uint8clamped~.
        - 1. If _type_ is ~Int8~, ~Uint8~, ~Int16~, ~Uint16~, ~Int32~, or ~Uint32~, return *true*. + 1. If _type_ is one of ~int8~, ~uint8~, ~int16~, ~uint16~, ~int32~, or ~uint32~, return *true*. 1. Return *false*.
        @@ -41807,7 +43536,7 @@

        It verifies if the argument _type_ is a BigInt TypedArray element type.
        - 1. If _type_ is ~BigUint64~ or ~BigInt64~, return *true*. + 1. If _type_ is either ~biguint64~ or ~bigint64~, return *true*. 1. Return *false*. @@ -41816,14 +43545,14 @@

        IsNoTearConfiguration ( _type_: a TypedArray element type, - _order_: ~SeqCst~, ~Unordered~, or ~Init~, + _order_: ~seq-cst~, ~unordered~, or ~init~, ): a Boolean

        1. If IsUnclampedIntegerElementType(_type_) is *true*, return *true*. - 1. If IsBigIntElementType(_type_) is *true* and _order_ is not ~Init~ or ~Unordered~, return *true*. + 1. If IsBigIntElementType(_type_) is *true* and _order_ is neither ~init~ nor ~unordered~, return *true*. 1. Return *false*.
        @@ -41841,11 +43570,11 @@

        1. Let _elementSize_ be the Element Size value specified in for Element Type _type_. 1. If _isLittleEndian_ is *false*, reverse the order of the elements of _rawBytes_. - 1. If _type_ is ~Float32~, then + 1. If _type_ is ~float32~, then 1. Let _value_ be the byte elements of _rawBytes_ concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2019 binary32 value. 1. If _value_ is an IEEE 754-2019 binary32 NaN value, return the *NaN* Number value. 1. Return the Number value that corresponds to _value_. - 1. If _type_ is ~Float64~, then + 1. If _type_ is ~float64~, then 1. Let _value_ be the byte elements of _rawBytes_ concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2019 binary64 value. 1. If _value_ is an IEEE 754-2019 binary64 NaN value, return the *NaN* Number value. 1. Return the Number value that corresponds to _value_. @@ -41858,6 +43587,32 @@

        + +

        + GetRawBytesFromSharedBlock ( + _block_: a Shared Data Block, + _byteIndex_: a non-negative integer, + _type_: a TypedArray element type, + _isTypedArray_: a Boolean, + _order_: ~seq-cst~ or ~unordered~, + ): a List of byte values +

        +
        +
        + + 1. Let _elementSize_ be the Element Size value specified in for Element Type _type_. + 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. + 1. Let _eventsRecord_ be the Agent Events Record of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). + 1. If _isTypedArray_ is *true* and IsNoTearConfiguration(_type_, _order_) is *true*, let _noTear_ be *true*; otherwise let _noTear_ be *false*. + 1. Let _rawValue_ be a List of length _elementSize_ whose elements are nondeterministically chosen byte values. + 1. NOTE: In implementations, _rawValue_ is the result of a non-atomic or atomic read instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency. + 1. Let _readEvent_ be ReadSharedMemory { [[Order]]: _order_, [[NoTear]]: _noTear_, [[Block]]: _block_, [[ByteIndex]]: _byteIndex_, [[ElementSize]]: _elementSize_ }. + 1. Append _readEvent_ to _eventsRecord_.[[EventList]]. + 1. Append Chosen Value Record { [[Event]]: _readEvent_, [[ChosenValue]]: _rawValue_ } to _execution_.[[ChosenValues]]. + 1. Return _rawValue_. + +
        +

        GetValueFromBuffer ( @@ -41865,7 +43620,7 @@

        _byteIndex_: a non-negative integer, _type_: a TypedArray element type, _isTypedArray_: a Boolean, - _order_: ~SeqCst~ or ~Unordered~, + _order_: ~seq-cst~ or ~unordered~, optional _isLittleEndian_: a Boolean, ): a Number or a BigInt

        @@ -41877,15 +43632,10 @@

        1. Let _block_ be _arrayBuffer_.[[ArrayBufferData]]. 1. Let _elementSize_ be the Element Size value specified in for Element Type _type_. 1. If IsSharedArrayBuffer(_arrayBuffer_) is *true*, then - 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. - 1. Let _eventList_ be the [[EventList]] field of the element of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). - 1. If _isTypedArray_ is *true* and IsNoTearConfiguration(_type_, _order_) is *true*, let _noTear_ be *true*; otherwise let _noTear_ be *false*. - 1. Let _rawValue_ be a List of length _elementSize_ whose elements are nondeterministically chosen byte values. - 1. NOTE: In implementations, _rawValue_ is the result of a non-atomic or atomic read instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency. - 1. Let _readEvent_ be ReadSharedMemory { [[Order]]: _order_, [[NoTear]]: _noTear_, [[Block]]: _block_, [[ByteIndex]]: _byteIndex_, [[ElementSize]]: _elementSize_ }. - 1. Append _readEvent_ to _eventList_. - 1. Append Chosen Value Record { [[Event]]: _readEvent_, [[ChosenValue]]: _rawValue_ } to _execution_.[[ChosenValues]]. - 1. Else, let _rawValue_ be a List whose elements are bytes from _block_ at indices in the interval from _byteIndex_ (inclusive) to _byteIndex_ + _elementSize_ (exclusive). + 1. Assert: _block_ is a Shared Data Block. + 1. Let _rawValue_ be GetRawBytesFromSharedBlock(_block_, _byteIndex_, _type_, _isTypedArray_, _order_). + 1. Else, + 1. Let _rawValue_ be a List whose elements are bytes from _block_ at indices in the interval from _byteIndex_ (inclusive) to _byteIndex_ + _elementSize_ (exclusive). 1. Assert: The number of elements in _rawValue_ is _elementSize_. 1. If _isLittleEndian_ is not present, set _isLittleEndian_ to the value of the [[LittleEndian]] field of the surrounding agent's Agent Record. 1. Return RawBytesToNumeric(_type_, _rawValue_, _isLittleEndian_). @@ -41903,9 +43653,9 @@

        - 1. If _type_ is ~Float32~, then + 1. If _type_ is ~float32~, then 1. Let _rawBytes_ be a List whose elements are the 4 bytes that are the result of converting _value_ to IEEE 754-2019 binary32 format using roundTiesToEven mode. The bytes are arranged in little endian order. If _value_ is *NaN*, _rawBytes_ may be set to any implementation chosen IEEE 754-2019 binary32 format Not-a-Number encoding. An implementation must always choose the same encoding for each implementation distinguishable *NaN* value. - 1. Else if _type_ is ~Float64~, then + 1. Else if _type_ is ~float64~, then 1. Let _rawBytes_ be a List whose elements are the 8 bytes that are the IEEE 754-2019 binary64 format encoding of _value_. The bytes are arranged in little endian order. If _value_ is *NaN*, _rawBytes_ may be set to any implementation chosen IEEE 754-2019 binary64 format Not-a-Number encoding. An implementation must always choose the same encoding for each implementation distinguishable *NaN* value. 1. Else, 1. Let _n_ be the Element Size value specified in for Element Type _type_. @@ -41928,7 +43678,7 @@

        _type_: a TypedArray element type, _value_: a Number or a BigInt, _isTypedArray_: a Boolean, - _order_: ~SeqCst~, ~Unordered~, or ~Init~, + _order_: ~seq-cst~, ~unordered~, or ~init~, optional _isLittleEndian_: a Boolean, ): ~unused~

        @@ -41944,10 +43694,11 @@

        1. Let _rawBytes_ be NumericToRawBytes(_type_, _value_, _isLittleEndian_). 1. If IsSharedArrayBuffer(_arrayBuffer_) is *true*, then 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. - 1. Let _eventList_ be the [[EventList]] field of the element of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). + 1. Let _eventsRecord_ be the Agent Events Record of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). 1. If _isTypedArray_ is *true* and IsNoTearConfiguration(_type_, _order_) is *true*, let _noTear_ be *true*; otherwise let _noTear_ be *false*. - 1. Append WriteSharedMemory { [[Order]]: _order_, [[NoTear]]: _noTear_, [[Block]]: _block_, [[ByteIndex]]: _byteIndex_, [[ElementSize]]: _elementSize_, [[Payload]]: _rawBytes_ } to _eventList_. - 1. Else, store the individual bytes of _rawBytes_ into _block_, starting at _block_[_byteIndex_]. + 1. Append WriteSharedMemory { [[Order]]: _order_, [[NoTear]]: _noTear_, [[Block]]: _block_, [[ByteIndex]]: _byteIndex_, [[ElementSize]]: _elementSize_, [[Payload]]: _rawBytes_ } to _eventsRecord_.[[EventList]]. + 1. Else, + 1. Store the individual bytes of _rawBytes_ into _block_, starting at _block_[_byteIndex_]. 1. Return ~unused~. @@ -41960,7 +43711,6 @@

        _type_: a TypedArray element type, _value_: a Number or a BigInt, _op_: a read-modify-write modification function, - optional _isLittleEndian_: a Boolean, ): a Number or a BigInt

        @@ -41971,15 +43721,15 @@

        1. Assert: _value_ is a BigInt if IsBigIntElementType(_type_) is *true*; otherwise, _value_ is a Number. 1. Let _block_ be _arrayBuffer_.[[ArrayBufferData]]. 1. Let _elementSize_ be the Element Size value specified in for Element Type _type_. - 1. If _isLittleEndian_ is not present, set _isLittleEndian_ to the value of the [[LittleEndian]] field of the surrounding agent's Agent Record. + 1. Let _isLittleEndian_ be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record. 1. Let _rawBytes_ be NumericToRawBytes(_type_, _value_, _isLittleEndian_). 1. If IsSharedArrayBuffer(_arrayBuffer_) is *true*, then 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. - 1. Let _eventList_ be the [[EventList]] field of the element of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). + 1. Let _eventsRecord_ be the Agent Events Record of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). 1. Let _rawBytesRead_ be a List of length _elementSize_ whose elements are nondeterministically chosen byte values. 1. NOTE: In implementations, _rawBytesRead_ is the result of a load-link, of a load-exclusive, or of an operand of a read-modify-write instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency. - 1. Let _rmwEvent_ be ReadModifyWriteSharedMemory { [[Order]]: ~SeqCst~, [[NoTear]]: *true*, [[Block]]: _block_, [[ByteIndex]]: _byteIndex_, [[ElementSize]]: _elementSize_, [[Payload]]: _rawBytes_, [[ModifyOp]]: _op_ }. - 1. Append _rmwEvent_ to _eventList_. + 1. Let _rmwEvent_ be ReadModifyWriteSharedMemory { [[Order]]: ~seq-cst~, [[NoTear]]: *true*, [[Block]]: _block_, [[ByteIndex]]: _byteIndex_, [[ElementSize]]: _elementSize_, [[Payload]]: _rawBytes_, [[ModifyOp]]: _op_ }. + 1. Append _rmwEvent_ to _eventsRecord_.[[EventList]]. 1. Append Chosen Value Record { [[Event]]: _rmwEvent_, [[ChosenValue]]: _rawBytesRead_ } to _execution_.[[ChosenValues]]. 1. Else, 1. Let _rawBytesRead_ be a List of length _elementSize_ whose elements are the sequence of _elementSize_ bytes starting with _block_[_byteIndex_]. @@ -42002,12 +43752,13 @@

        The ArrayBuffer Constructor

        -

        ArrayBuffer ( _length_ )

        +

        ArrayBuffer ( _length_ [ , _options_ ] )

        This function performs the following steps when called:

        1. If NewTarget is *undefined*, throw a *TypeError* exception. 1. Let _byteLength_ be ? ToIndex(_length_). - 1. Return ? AllocateArrayBuffer(NewTarget, _byteLength_). + 1. Let _requestedMaxByteLength_ be ? GetArrayBufferMaxByteLengthOption(_options_). + 1. Return ? AllocateArrayBuffer(NewTarget, _byteLength_, _requestedMaxByteLength_).
        @@ -42044,7 +43795,7 @@

        get ArrayBuffer [ @@species ]

        The value of the *"name"* property of this function is *"get [Symbol.species]"*.

        -

        ArrayBuffer prototype methods normally use their *this* value's constructor to create a derived object. However, a subclass constructor may over-ride that default behaviour by redefining its @@species property.

        +

        normally uses its *this* value's constructor to create a derived object. However, a subclass constructor may over-ride that default behaviour for the method by redefining its @@species property.

        @@ -42077,6 +43828,67 @@

        ArrayBuffer.prototype.constructor

        The initial value of `ArrayBuffer.prototype.constructor` is %ArrayBuffer%.

        + +

        get ArrayBuffer.prototype.detached

        +

        `ArrayBuffer.prototype.detached` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). + 1. If IsSharedArrayBuffer(_O_) is *true*, throw a *TypeError* exception. + 1. Return IsDetachedBuffer(_O_). + +
        + + +

        get ArrayBuffer.prototype.maxByteLength

        +

        `ArrayBuffer.prototype.maxByteLength` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). + 1. If IsSharedArrayBuffer(_O_) is *true*, throw a *TypeError* exception. + 1. If IsDetachedBuffer(_O_) is *true*, return *+0*𝔽. + 1. If IsFixedLengthArrayBuffer(_O_) is *true*, then + 1. Let _length_ be _O_.[[ArrayBufferByteLength]]. + 1. Else, + 1. Let _length_ be _O_.[[ArrayBufferMaxByteLength]]. + 1. Return 𝔽(_length_). + +
        + + +

        get ArrayBuffer.prototype.resizable

        +

        `ArrayBuffer.prototype.resizable` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). + 1. If IsSharedArrayBuffer(_O_) is *true*, throw a *TypeError* exception. + 1. If IsFixedLengthArrayBuffer(_O_) is *false*, return *true*; otherwise return *false*. + +
        + + +

        ArrayBuffer.prototype.resize ( _newLength_ )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferMaxByteLength]]). + 1. If IsSharedArrayBuffer(_O_) is *true*, throw a *TypeError* exception. + 1. Let _newByteLength_ be ? ToIndex(_newLength_). + 1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception. + 1. If _newByteLength_ > _O_.[[ArrayBufferMaxByteLength]], throw a *RangeError* exception. + 1. Let _hostHandled_ be ? HostResizeArrayBuffer(_O_, _newByteLength_). + 1. If _hostHandled_ is ~handled~, return *undefined*. + 1. Let _oldBlock_ be _O_.[[ArrayBufferData]]. + 1. Let _newBlock_ be ? CreateByteDataBlock(_newByteLength_). + 1. Let _copyLength_ be min(_newByteLength_, _O_.[[ArrayBufferByteLength]]). + 1. Perform CopyDataBlockBytes(_newBlock_, 0, _oldBlock_, 0, _copyLength_). + 1. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as in-place growth or shrinkage. + 1. Set _O_.[[ArrayBufferData]] to _newBlock_. + 1. Set _O_.[[ArrayBufferByteLength]] to _newByteLength_. + 1. Return *undefined*. + +
        +

        ArrayBuffer.prototype.slice ( _start_, _end_ )

        This method performs the following steps when called:

        @@ -42087,11 +43899,11 @@

        ArrayBuffer.prototype.slice ( _start_, _end_ )

        1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception. 1. Let _len_ be _O_.[[ArrayBufferByteLength]]. 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _first_ be 0. + 1. If _relativeStart_ = -∞, let _first_ be 0. 1. Else if _relativeStart_ < 0, let _first_ be max(_len_ + _relativeStart_, 0). 1. Else, let _first_ be min(_relativeStart_, _len_). 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. + 1. If _relativeEnd_ = -∞, let _final_ be 0. 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). 1. Else, let _final_ be min(_relativeEnd_, _len_). 1. Let _newLen_ be max(_final_ - _first_, 0). @@ -42102,15 +43914,36 @@

        ArrayBuffer.prototype.slice ( _start_, _end_ )

        1. If IsDetachedBuffer(_new_) is *true*, throw a *TypeError* exception. 1. If SameValue(_new_, _O_) is *true*, throw a *TypeError* exception. 1. If _new_.[[ArrayBufferByteLength]] < _newLen_, throw a *TypeError* exception. - 1. NOTE: Side-effects of the above steps may have detached _O_. + 1. NOTE: Side-effects of the above steps may have detached or resized _O_. 1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception. 1. Let _fromBuf_ be _O_.[[ArrayBufferData]]. 1. Let _toBuf_ be _new_.[[ArrayBufferData]]. - 1. Perform CopyDataBlockBytes(_toBuf_, 0, _fromBuf_, _first_, _newLen_). + 1. Let _currentLen_ be _O_.[[ArrayBufferByteLength]]. + 1. If _first_ < _currentLen_, then + 1. Let _count_ be min(_newLen_, _currentLen_ - _first_). + 1. Perform CopyDataBlockBytes(_toBuf_, 0, _fromBuf_, _first_, _count_). 1. Return _new_.
        + +

        ArrayBuffer.prototype.transfer ( [ _newLength_ ] )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Return ? ArrayBufferCopyAndDetach(_O_, _newLength_, ~preserve-resizability~). + +
        + + +

        ArrayBuffer.prototype.transferToFixedLength ( [ _newLength_ ] )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Return ? ArrayBufferCopyAndDetach(_O_, _newLength_, ~fixed-length~). + +
        +

        ArrayBuffer.prototype [ @@toStringTag ]

        The initial value of the @@toStringTag property is the String value *"ArrayBuffer"*.

        @@ -42120,15 +43953,39 @@

        ArrayBuffer.prototype [ @@toStringTag ]

        Properties of ArrayBuffer Instances

        -

        ArrayBuffer instances inherit properties from the ArrayBuffer prototype object. ArrayBuffer instances each have an [[ArrayBufferData]] internal slot, an [[ArrayBufferByteLength]] internal slot, and an [[ArrayBufferDetachKey]] internal slot.

        +

        ArrayBuffer instances inherit properties from the ArrayBuffer prototype object. ArrayBuffer instances each have an [[ArrayBufferData]] internal slot, an [[ArrayBufferByteLength]] internal slot, and an [[ArrayBufferDetachKey]] internal slot. ArrayBuffer instances which are resizable each have an [[ArrayBufferMaxByteLength]] internal slot.

        ArrayBuffer instances whose [[ArrayBufferData]] is *null* are considered to be detached and all operators to access or modify data contained in the ArrayBuffer instance will fail.

        ArrayBuffer instances whose [[ArrayBufferDetachKey]] is set to a value other than *undefined* need to have all DetachArrayBuffer calls passing that same "detach key" as an argument, otherwise a TypeError will result. This internal slot is only ever set by certain embedding environments, not by algorithms in this specification.

        + + +

        Resizable ArrayBuffer Guidelines

        + +

        The following are guidelines for ECMAScript programmers working with resizable ArrayBuffer.

        +

        We recommend that programs be tested in their deployment environments where possible. The amount of available physical memory differs greatly between hardware devices. Similarly, virtual memory subsystems also differ greatly between hardware devices as well as operating systems. An application that runs without out-of-memory errors on a 64-bit desktop web browser could run out of memory on a 32-bit mobile web browser.

        +

        When choosing a value for the *"maxByteLength"* option for resizable ArrayBuffer, we recommend that the smallest possible size for the application be chosen. We recommend that *"maxByteLength"* does not exceed 1,073,741,824 (230 bytes or 1GiB).

        +

        Please note that successfully constructing a resizable ArrayBuffer for a particular maximum size does not guarantee that future resizes will succeed.

        +
        + + +

        The following are guidelines for ECMAScript implementers implementing resizable ArrayBuffer.

        +

        Resizable ArrayBuffer can be implemented as copying upon resize, as in-place growth via reserving virtual memory up front, or as a combination of both for different values of the constructor's *"maxByteLength"* option.

        +

        If a host is multi-tenanted (i.e. it runs many ECMAScript applications simultaneously), such as a web browser, and its implementations choose to implement in-place growth by reserving virtual memory, we recommend that both 32-bit and 64-bit implementations throw for values of *"maxByteLength"* ≥ 1GiB to 1.5GiB. This is to reduce the likelihood a single application can exhaust the virtual memory address space and to reduce interoperability risk.

        +

        If a host does not have virtual memory, such as those running on embedded devices without an MMU, or if a host only implements resizing by copying, it may accept any Number value for the *"maxByteLength"* option. However, we recommend a *RangeError* be thrown if a memory block of the requested size can never be allocated. For example, if the requested size is greater than the maximium amount of usable memory on the device.

        +
        +

        SharedArrayBuffer Objects

        + +

        Fixed-length and Growable SharedArrayBuffer Objects

        +

        A fixed-length SharedArrayBuffer is a SharedArrayBuffer whose byte length cannot change after creation.

        +

        A growable SharedArrayBuffer is a SharedArrayBuffer whose byte length may increase after creation via calls to .

        +

        The kind of SharedArrayBuffer object that is created depends on the arguments passed to .

        +
        +

        Abstract Operations for SharedArrayBuffer Objects

        @@ -42137,6 +43994,7 @@

        AllocateSharedArrayBuffer ( _constructor_: a constructor, _byteLength_: a non-negative integer, + optional _maxByteLength_: a non-negative integer or ~empty~, ): either a normal completion containing a SharedArrayBuffer or a throw completion

        @@ -42144,10 +44002,25 @@

        It is used to create a SharedArrayBuffer.

        - 1. Let _obj_ be ? OrdinaryCreateFromConstructor(_constructor_, *"%SharedArrayBuffer.prototype%"*, « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). - 1. Let _block_ be ? CreateSharedByteDataBlock(_byteLength_). + 1. Let _slots_ be « [[ArrayBufferData]] ». + 1. If _maxByteLength_ is present and _maxByteLength_ is not ~empty~, let _allocatingGrowableBuffer_ be *true*; otherwise let _allocatingGrowableBuffer_ be *false*. + 1. If _allocatingGrowableBuffer_ is *true*, then + 1. If _byteLength_ > _maxByteLength_, throw a *RangeError* exception. + 1. Append [[ArrayBufferByteLengthData]] and [[ArrayBufferMaxByteLength]] to _slots_. + 1. Else, + 1. Append [[ArrayBufferByteLength]] to _slots_. + 1. Let _obj_ be ? OrdinaryCreateFromConstructor(_constructor_, *"%SharedArrayBuffer.prototype%"*, _slots_). + 1. If _allocatingGrowableBuffer_ is *true*, let _allocLength_ be _maxByteLength_; otherwise let _allocLength_ be _byteLength_. + 1. Let _block_ be ? CreateSharedByteDataBlock(_allocLength_). 1. Set _obj_.[[ArrayBufferData]] to _block_. - 1. Set _obj_.[[ArrayBufferByteLength]] to _byteLength_. + 1. If _allocatingGrowableBuffer_ is *true*, then + 1. Assert: _byteLength_ ≤ _maxByteLength_. + 1. Let _byteLengthBlock_ be ? CreateSharedByteDataBlock(8). + 1. Perform SetValueInBuffer(_byteLengthBlock_, 0, ~biguint64~, ℤ(_byteLength_), *true*, ~seq-cst~). + 1. Set _obj_.[[ArrayBufferByteLengthData]] to _byteLengthBlock_. + 1. Set _obj_.[[ArrayBufferMaxByteLength]] to _maxByteLength_. + 1. Else, + 1. Set _obj_.[[ArrayBufferByteLength]] to _byteLength_. 1. Return _obj_.
        @@ -42170,6 +44043,31 @@

        1. Return *true*. + + +

        + HostGrowSharedArrayBuffer ( + _buffer_: a SharedArrayBuffer, + _newByteLength_: a non-negative integer, + ): either a normal completion containing either ~handled~ or ~unhandled~, or a throw completion +

        +
        +
        description
        +
        It gives the host an opportunity to perform implementation-defined growing of _buffer_. If the host chooses not to handle growing of _buffer_, it may return ~unhandled~ for the default behaviour.
        +
        +

        The implementation of HostGrowSharedArrayBuffer must conform to the following requirements:

        +
          +
        • If the abstract operation does not complete normally with ~unhandled~, and _newByteLength_ < the current byte length of the _buffer_ or _newByteLength_ > _buffer_.[[ArrayBufferMaxByteLength]], throw a *RangeError* exception.
        • +
        • Let _isLittleEndian_ be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record. If the abstract operation completes normally with ~handled~, a WriteSharedMemory or ReadModifyWriteSharedMemory event whose [[Order]] is ~seq-cst~, [[Payload]] is NumericToRawBytes(~biguint64~, _newByteLength_, _isLittleEndian_), [[Block]] is _buffer_.[[ArrayBufferByteLengthData]], [[ByteIndex]] is 0, and [[ElementSize]] is 8 is added to the surrounding agent's candidate execution such that racing calls to `SharedArrayBuffer.prototype.grow` are not "lost", i.e. silently do nothing.
        • +
        + + +

        The second requirement above is intentionally vague about how or when the current byte length of _buffer_ is read. Because the byte length must be updated via an atomic read-modify-write operation on the underlying hardware, architectures that use load-link/store-conditional or load-exclusive/store-exclusive instruction pairs may wish to keep the paired instructions close in the instruction stream. As such, SharedArrayBuffer.prototype.grow itself does not perform bounds checking on _newByteLength_ before calling HostGrowSharedArrayBuffer, nor is there a requirement on when the current byte length is read.

        +

        This is in contrast with HostResizeArrayBuffer, which is guaranteed that the value of _newByteLength_ is ≥ 0 and ≤ _buffer_.[[ArrayBufferMaxByteLength]].

        +
        + +

        The default implementation of HostGrowSharedArrayBuffer is to return NormalCompletion(~unhandled~).

        +
        @@ -42190,12 +44088,13 @@

        The SharedArrayBuffer Constructor

        -

        SharedArrayBuffer ( _length_ )

        +

        SharedArrayBuffer ( _length_ [ , _options_ ] )

        This function performs the following steps when called:

        1. If NewTarget is *undefined*, throw a *TypeError* exception. 1. Let _byteLength_ be ? ToIndex(_length_). - 1. Return ? AllocateSharedArrayBuffer(NewTarget, _byteLength_). + 1. Let _requestedMaxByteLength_ be ? GetArrayBufferMaxByteLengthOption(_options_). + 1. Return ? AllocateSharedArrayBuffer(NewTarget, _byteLength_, _requestedMaxByteLength_).
        @@ -42241,7 +44140,7 @@

        get SharedArrayBuffer.prototype.byteLength

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). 1. If IsSharedArrayBuffer(_O_) is *false*, throw a *TypeError* exception. - 1. Let _length_ be _O_.[[ArrayBufferByteLength]]. + 1. Let _length_ be ArrayBufferByteLength(_O_, ~seq-cst~). 1. Return 𝔽(_length_).
        @@ -42251,6 +44150,64 @@

        SharedArrayBuffer.prototype.constructor

        The initial value of `SharedArrayBuffer.prototype.constructor` is %SharedArrayBuffer%.

        + +

        SharedArrayBuffer.prototype.grow ( _newLength_ )

        +

        This method performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferMaxByteLength]]). + 1. If IsSharedArrayBuffer(_O_) is *false*, throw a *TypeError* exception. + 1. Let _newByteLength_ be ? ToIndex(_newLength_). + 1. Let _hostHandled_ be ? HostGrowSharedArrayBuffer(_O_, _newByteLength_). + 1. If _hostHandled_ is ~handled~, return *undefined*. + 1. Let _isLittleEndian_ be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record. + 1. Let _byteLengthBlock_ be _O_.[[ArrayBufferByteLengthData]]. + 1. Let _currentByteLengthRawBytes_ be GetRawBytesFromSharedBlock(_byteLengthBlock_, 0, ~biguint64~, *true*, ~seq-cst~). + 1. Let _newByteLengthRawBytes_ be NumericToRawBytes(~biguint64~, ℤ(_newByteLength_), _isLittleEndian_). + 1. Repeat, + 1. NOTE: This is a compare-and-exchange loop to ensure that parallel, racing grows of the same buffer are totally ordered, are not lost, and do not silently do nothing. The loop exits if it was able to attempt to grow uncontended. + 1. Let _currentByteLength_ be ℝ(RawBytesToNumeric(~biguint64~, _currentByteLengthRawBytes_, _isLittleEndian_)). + 1. If _newByteLength_ = _currentByteLength_, return *undefined*. + 1. If _newByteLength_ < _currentByteLength_ or _newByteLength_ > _O_.[[ArrayBufferMaxByteLength]], throw a *RangeError* exception. + 1. Let _byteLengthDelta_ be _newByteLength_ - _currentByteLength_. + 1. If it is impossible to create a new Shared Data Block value consisting of _byteLengthDelta_ bytes, throw a *RangeError* exception. + 1. NOTE: No new Shared Data Block is constructed and used here. The observable behaviour of growable SharedArrayBuffers is specified by allocating a max-sized Shared Data Block at construction time, and this step captures the requirement that implementations that run out of memory must throw a *RangeError*. + 1. Let _readByteLengthRawBytes_ be AtomicCompareExchangeInSharedBlock(_byteLengthBlock_, 0, 8, _currentByteLengthRawBytes_, _newByteLengthRawBytes_). + 1. If ByteListEqual(_readByteLengthRawBytes_, _currentByteLengthRawBytes_) is *true*, return *undefined*. + 1. Set _currentByteLengthRawBytes_ to _readByteLengthRawBytes_. + + +

        Spurious failures of the compare-exchange to update the length are prohibited. If the bounds checking for the new length passes and the implementation is not out of memory, a ReadModifyWriteSharedMemory event (i.e. a successful compare-exchange) is always added into the candidate execution.

        +

        Parallel calls to SharedArrayBuffer.prototype.grow are totally ordered. For example, consider two racing calls: `sab.grow(10)` and `sab.grow(20)`. One of the two calls is guaranteed to win the race. The call to `sab.grow(10)` will never shrink `sab` even if `sab.grow(20)` happened first; in that case it will instead throw a RangeError.

        +
        +
        + + +

        get SharedArrayBuffer.prototype.growable

        +

        `SharedArrayBuffer.prototype.growable` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). + 1. If IsSharedArrayBuffer(_O_) is *false*, throw a *TypeError* exception. + 1. If IsFixedLengthArrayBuffer(_O_) is *false*, return *true*; otherwise return *false*. + +
        + + +

        get SharedArrayBuffer.prototype.maxByteLength

        +

        `SharedArrayBuffer.prototype.maxByteLength` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        + + 1. Let _O_ be the *this* value. + 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). + 1. If IsSharedArrayBuffer(_O_) is *false*, throw a *TypeError* exception. + 1. If IsFixedLengthArrayBuffer(_O_) is *true*, then + 1. Let _length_ be _O_.[[ArrayBufferByteLength]]. + 1. Else, + 1. Let _length_ be _O_.[[ArrayBufferMaxByteLength]]. + 1. Return 𝔽(_length_). + +
        +

        SharedArrayBuffer.prototype.slice ( _start_, _end_ )

        This method performs the following steps when called:

        @@ -42258,13 +44215,13 @@

        SharedArrayBuffer.prototype.slice ( _start_, _end_ )

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]). 1. If IsSharedArrayBuffer(_O_) is *false*, throw a *TypeError* exception. - 1. Let _len_ be _O_.[[ArrayBufferByteLength]]. + 1. Let _len_ be ArrayBufferByteLength(_O_, ~seq-cst~). 1. Let _relativeStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _relativeStart_ is -∞, let _first_ be 0. + 1. If _relativeStart_ = -∞, let _first_ be 0. 1. Else if _relativeStart_ < 0, let _first_ be max(_len_ + _relativeStart_, 0). 1. Else, let _first_ be min(_relativeStart_, _len_). 1. If _end_ is *undefined*, let _relativeEnd_ be _len_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_). - 1. If _relativeEnd_ is -∞, let _final_ be 0. + 1. If _relativeEnd_ = -∞, let _final_ be 0. 1. Else if _relativeEnd_ < 0, let _final_ be max(_len_ + _relativeEnd_, 0). 1. Else, let _final_ be min(_relativeEnd_, _len_). 1. Let _newLen_ be max(_final_ - _first_, 0). @@ -42272,8 +44229,8 @@

        SharedArrayBuffer.prototype.slice ( _start_, _end_ )

        1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »). 1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]). 1. If IsSharedArrayBuffer(_new_) is *false*, throw a *TypeError* exception. - 1. If _new_.[[ArrayBufferData]] and _O_.[[ArrayBufferData]] are the same Shared Data Block values, throw a *TypeError* exception. - 1. If _new_.[[ArrayBufferByteLength]] < _newLen_, throw a *TypeError* exception. + 1. If _new_.[[ArrayBufferData]] is _O_.[[ArrayBufferData]], throw a *TypeError* exception. + 1. If ArrayBufferByteLength(_new_, ~seq-cst~) < _newLen_, throw a *TypeError* exception. 1. Let _fromBuf_ be _O_.[[ArrayBufferData]]. 1. Let _toBuf_ be _new_.[[ArrayBufferData]]. 1. Perform CopyDataBlockBytes(_toBuf_, 0, _fromBuf_, _first_, _newLen_). @@ -42281,7 +44238,7 @@

        SharedArrayBuffer.prototype.slice ( _start_, _end_ )

        - +

        SharedArrayBuffer.prototype [ @@toStringTag ]

        The initial value of the @@toStringTag property is the String value *"SharedArrayBuffer"*.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        @@ -42290,12 +44247,32 @@

        SharedArrayBuffer.prototype [ @@toStringTag ]

        Properties of SharedArrayBuffer Instances

        -

        SharedArrayBuffer instances inherit properties from the SharedArrayBuffer prototype object. SharedArrayBuffer instances each have an [[ArrayBufferData]] internal slot and an [[ArrayBufferByteLength]] internal slot.

        +

        SharedArrayBuffer instances inherit properties from the SharedArrayBuffer prototype object. SharedArrayBuffer instances each have an [[ArrayBufferData]] internal slot. SharedArrayBuffer instances which are not growable each have an [[ArrayBufferByteLength]] internal slot. SharedArrayBuffer instances which are growable each have an [[ArrayBufferByteLengthData]] internal slot and an [[ArrayBufferMaxByteLength]] internal slot.

        SharedArrayBuffer instances, unlike ArrayBuffer instances, are never detached.

        + + +

        Growable SharedArrayBuffer Guidelines

        + +

        The following are guidelines for ECMAScript programmers working with growable SharedArrayBuffer.

        +

        We recommend that programs be tested in their deployment environments where possible. The amount of available physical memory differ greatly between hardware devices. Similarly, virtual memory subsystems also differ greatly between hardware devices as well as operating systems. An application that runs without out-of-memory errors on a 64-bit desktop web browser could run out of memory on a 32-bit mobile web browser.

        +

        When choosing a value for the *"maxByteLength"* option for growable SharedArrayBuffer, we recommend that the smallest possible size for the application be chosen. We recommend that *"maxByteLength"* does not exceed 1073741824, or 1GiB.

        +

        Please note that successfully constructing a growable SharedArrayBuffer for a particular maximum size does not guarantee that future grows will succeed.

        +

        Not all loads of a growable SharedArrayBuffer's length are synchronizing ~seq-cst~ loads. Loads of the length that are for bounds-checking of an integer-indexed property access, e.g. `u8[idx]`, are not synchronizing. In general, in the absence of explicit synchronization, one property access being in-bound does not imply a subsequent property access in the same agent is also in-bound. In contrast, explicit loads of the length via the `length` and `byteLength` getters on SharedArrayBuffer, %TypedArray%.prototype, and DataView.prototype are synchronizing. Loads of the length that are performed by built-in methods to check if a TypedArray is entirely out-of-bounds are also synchronizing.

        +
        + + +

        The following are guidelines for ECMAScript implementers implementing growable SharedArrayBuffer.

        +

        We recommend growable SharedArrayBuffer be implemented as in-place growth via reserving virtual memory up front.

        +

        Because grow operations can happen in parallel with memory accesses on a growable SharedArrayBuffer, the constraints of the memory model require that even unordered accesses do not "tear" (bits of their values will not be mixed). In practice, this means the underlying data block of a growable SharedArrayBuffer cannot be grown by being copied without stopping the world. We do not recommend stopping the world as an implementation strategy because it introduces a serialization point and is slow.

        +

        Grown memory must appear zeroed from the moment of its creation, including to any racy accesses in parallel. This can be accomplished via zero-filled-on-demand virtual memory pages, or careful synchronization if manually zeroing memory.

        +

        Integer-indexed property access on TypedArray views of growable SharedArrayBuffers is intended to be optimizable similarly to access on TypedArray views of non-growable SharedArrayBuffers, because integer-indexed property loads on are not synchronizing on the underlying buffer's length (see programmer guidelines above). For example, bounds checks for property accesses may still be hoisted out of loops.

        +

        In practice it is difficult to implement growable SharedArrayBuffer by copying on hosts that do not have virtual memory, such as those running on embedded devices without an MMU. Memory usage behaviour of growable SharedArrayBuffers on such hosts may significantly differ from that of hosts with virtual memory. Such hosts should clearly communicate memory usage expectations to users.

        +
        +
        @@ -42304,6 +44281,112 @@

        DataView Objects

        Abstract Operations For DataView Objects

        + +

        DataView With Buffer Witness Records

        +

        A DataView With Buffer Witness Record is a Record value used to encapsulate a DataView along with a cached byte length of the viewed buffer. It is used to help ensure there is a single shared memory read event of the byte length data block when the viewed buffer is a growable SharedArrayBuffers.

        +

        DataView With Buffer Witness Records have the fields listed in .

        + + + + + + + + + + + + + + + + + +
        + Field Name + + Value + + Meaning +
        + [[Object]] + + a DataView + + The DataView object whose buffer's byte length is loaded. +
        + [[CachedBufferByteLength]] + + a non-negative integer or ~detached~ + + The byte length of the object's [[ViewedArrayBuffer]] when the Record was created. +
        +
        +
        + + +

        + MakeDataViewWithBufferWitnessRecord ( + _obj_: a DataView, + _order_: ~seq-cst~ or ~unordered~, + ): a DataView With Buffer Witness Record +

        +
        +
        + + 1. Let _buffer_ be _obj_.[[ViewedArrayBuffer]]. + 1. If IsDetachedBuffer(_buffer_) is *true*, then + 1. Let _byteLength_ be ~detached~. + 1. Else, + 1. Let _byteLength_ be ArrayBufferByteLength(_buffer_, _order_). + 1. Return the DataView With Buffer Witness Record { [[Object]]: _obj_, [[CachedBufferByteLength]]: _byteLength_ }. + +
        + + +

        + GetViewByteLength ( + _viewRecord_: a DataView With Buffer Witness Record, + ): a non-negative integer +

        +
        +
        + + 1. Assert: IsViewOutOfBounds(_viewRecord_) is *false*. + 1. Let _view_ be _viewRecord_.[[Object]]. + 1. If _view_.[[ByteLength]] is not ~auto~, return _view_.[[ByteLength]]. + 1. Assert: IsFixedLengthArrayBuffer(_view_.[[ViewedArrayBuffer]]) is *false*. + 1. Let _byteOffset_ be _view_.[[ByteOffset]]. + 1. Let _byteLength_ be _viewRecord_.[[CachedBufferByteLength]]. + 1. Assert: _byteLength_ is not ~detached~. + 1. Return _byteLength_ - _byteOffset_. + +
        + + +

        + IsViewOutOfBounds ( + _viewRecord_: a DataView With Buffer Witness Record, + ): a Boolean +

        +
        +
        + + 1. Let _view_ be _viewRecord_.[[Object]]. + 1. Let _bufferByteLength_ be _viewRecord_.[[CachedBufferByteLength]]. + 1. Assert: IsDetachedBuffer(_view_.[[ViewedArrayBuffer]]) is *true* if and only if _bufferByteLength_ is ~detached~. + 1. If _bufferByteLength_ is ~detached~, return *true*. + 1. Let _byteOffsetStart_ be _view_.[[ByteOffset]]. + 1. If _view_.[[ByteLength]] is ~auto~, then + 1. Let _byteOffsetEnd_ be _bufferByteLength_. + 1. Else, + 1. Let _byteOffsetEnd_ be _byteOffsetStart_ + _view_.[[ByteLength]]. + 1. If _byteOffsetStart_ > _bufferByteLength_ or _byteOffsetEnd_ > _bufferByteLength_, return *true*. + 1. NOTE: 0-length DataViews are not considered out-of-bounds. + 1. Return *false*. + +
        +

        GetViewValue ( @@ -42322,14 +44405,15 @@

        1. Assert: _view_ has a [[ViewedArrayBuffer]] internal slot. 1. Let _getIndex_ be ? ToIndex(_requestIndex_). 1. Set _isLittleEndian_ to ToBoolean(_isLittleEndian_). - 1. Let _buffer_ be _view_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. 1. Let _viewOffset_ be _view_.[[ByteOffset]]. - 1. Let _viewSize_ be _view_.[[ByteLength]]. + 1. Let _viewRecord_ be MakeDataViewWithBufferWitnessRecord(_view_, ~unordered~). + 1. NOTE: Bounds checking is not a synchronizing operation when _view_'s backing buffer is a growable SharedArrayBuffer. + 1. If IsViewOutOfBounds(_viewRecord_) is *true*, throw a *TypeError* exception. + 1. Let _viewSize_ be GetViewByteLength(_viewRecord_). 1. Let _elementSize_ be the Element Size value specified in for Element Type _type_. 1. If _getIndex_ + _elementSize_ > _viewSize_, throw a *RangeError* exception. 1. Let _bufferIndex_ be _getIndex_ + _viewOffset_. - 1. Return GetValueFromBuffer(_buffer_, _bufferIndex_, _type_, *false*, ~Unordered~, _isLittleEndian_). + 1. Return GetValueFromBuffer(_view_.[[ViewedArrayBuffer]], _bufferIndex_, _type_, *false*, ~unordered~, _isLittleEndian_). @@ -42354,14 +44438,15 @@

        1. If IsBigIntElementType(_type_) is *true*, let _numberValue_ be ? ToBigInt(_value_). 1. Otherwise, let _numberValue_ be ? ToNumber(_value_). 1. Set _isLittleEndian_ to ToBoolean(_isLittleEndian_). - 1. Let _buffer_ be _view_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. 1. Let _viewOffset_ be _view_.[[ByteOffset]]. - 1. Let _viewSize_ be _view_.[[ByteLength]]. + 1. Let _viewRecord_ be MakeDataViewWithBufferWitnessRecord(_view_, ~unordered~). + 1. NOTE: Bounds checking is not a synchronizing operation when _view_'s backing buffer is a growable SharedArrayBuffer. + 1. If IsViewOutOfBounds(_viewRecord_) is *true*, throw a *TypeError* exception. + 1. Let _viewSize_ be GetViewByteLength(_viewRecord_). 1. Let _elementSize_ be the Element Size value specified in for Element Type _type_. 1. If _getIndex_ + _elementSize_ > _viewSize_, throw a *RangeError* exception. 1. Let _bufferIndex_ be _getIndex_ + _viewOffset_. - 1. Perform SetValueInBuffer(_buffer_, _bufferIndex_, _type_, _numberValue_, *false*, ~Unordered~, _isLittleEndian_). + 1. Perform SetValueInBuffer(_view_.[[ViewedArrayBuffer]], _bufferIndex_, _type_, _numberValue_, *false*, ~unordered~, _isLittleEndian_). 1. Return *undefined*. @@ -42386,15 +44471,23 @@

        DataView ( _buffer_ [ , _byteOffset_ [ , _byteLength_ ] ] )

        1. Perform ? RequireInternalSlot(_buffer_, [[ArrayBufferData]]). 1. Let _offset_ be ? ToIndex(_byteOffset_). 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. Let _bufferByteLength_ be _buffer_.[[ArrayBufferByteLength]]. + 1. Let _bufferByteLength_ be ArrayBufferByteLength(_buffer_, ~seq-cst~). 1. If _offset_ > _bufferByteLength_, throw a *RangeError* exception. + 1. Let _bufferIsFixedLength_ be IsFixedLengthArrayBuffer(_buffer_). 1. If _byteLength_ is *undefined*, then - 1. Let _viewByteLength_ be _bufferByteLength_ - _offset_. + 1. If _bufferIsFixedLength_ is *true*, then + 1. Let _viewByteLength_ be _bufferByteLength_ - _offset_. + 1. Else, + 1. Let _viewByteLength_ be ~auto~. 1. Else, 1. Let _viewByteLength_ be ? ToIndex(_byteLength_). 1. If _offset_ + _viewByteLength_ > _bufferByteLength_, throw a *RangeError* exception. 1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%DataView.prototype%"*, « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »). 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. + 1. Set _bufferByteLength_ to ArrayBufferByteLength(_buffer_, ~seq-cst~). + 1. If _offset_ > _bufferByteLength_, throw a *RangeError* exception. + 1. If _byteLength_ is not *undefined*, then + 1. If _offset_ + _viewByteLength_ > _bufferByteLength_, throw a *RangeError* exception. 1. Set _O_.[[ViewedArrayBuffer]] to _buffer_. 1. Set _O_.[[ByteLength]] to _viewByteLength_. 1. Set _O_.[[ByteOffset]] to _offset_. @@ -42447,9 +44540,9 @@

        get DataView.prototype.byteLength

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[DataView]]). 1. Assert: _O_ has a [[ViewedArrayBuffer]] internal slot. - 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. Let _size_ be _O_.[[ByteLength]]. + 1. Let _viewRecord_ be MakeDataViewWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsViewOutOfBounds(_viewRecord_) is *true*, throw a *TypeError* exception. + 1. Let _size_ be GetViewByteLength(_viewRecord_). 1. Return 𝔽(_size_).
        @@ -42461,8 +44554,8 @@

        get DataView.prototype.byteOffset

        1. Let _O_ be the *this* value. 1. Perform ? RequireInternalSlot(_O_, [[DataView]]). 1. Assert: _O_ has a [[ViewedArrayBuffer]] internal slot. - 1. Let _buffer_ be _O_.[[ViewedArrayBuffer]]. - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. + 1. Let _viewRecord_ be MakeDataViewWithBufferWitnessRecord(_O_, ~seq-cst~). + 1. If IsViewOutOfBounds(_viewRecord_) is *true*, throw a *TypeError* exception. 1. Let _offset_ be _O_.[[ByteOffset]]. 1. Return 𝔽(_offset_). @@ -42478,7 +44571,7 @@

        DataView.prototype.getBigInt64 ( _byteOffset_ [ , _littleEndian_ ] )

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~BigInt64~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~bigint64~).
        @@ -42487,7 +44580,7 @@

        DataView.prototype.getBigUint64 ( _byteOffset_ [ , _littleEndian_ ] )

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~BigUint64~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~biguint64~).
        @@ -42497,7 +44590,7 @@

        DataView.prototype.getFloat32 ( _byteOffset_ [ , _littleEndian_ ] )

        1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~Float32~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~float32~).
        @@ -42507,7 +44600,7 @@

        DataView.prototype.getFloat64 ( _byteOffset_ [ , _littleEndian_ ] )

        1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~Float64~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~float64~). @@ -42516,7 +44609,7 @@

        DataView.prototype.getInt8 ( _byteOffset_ )

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? GetViewValue(_v_, _byteOffset_, *true*, ~Int8~). + 1. Return ? GetViewValue(_v_, _byteOffset_, *true*, ~int8~). @@ -42526,7 +44619,7 @@

        DataView.prototype.getInt16 ( _byteOffset_ [ , _littleEndian_ ] )

        1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~Int16~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~int16~). @@ -42536,7 +44629,7 @@

        DataView.prototype.getInt32 ( _byteOffset_ [ , _littleEndian_ ] )

        1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~Int32~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~int32~). @@ -42545,7 +44638,7 @@

        DataView.prototype.getUint8 ( _byteOffset_ )

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? GetViewValue(_v_, _byteOffset_, *true*, ~Uint8~). + 1. Return ? GetViewValue(_v_, _byteOffset_, *true*, ~uint8~). @@ -42555,7 +44648,7 @@

        DataView.prototype.getUint16 ( _byteOffset_ [ , _littleEndian_ ] )

        1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~Uint16~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~uint16~). @@ -42565,7 +44658,7 @@

        DataView.prototype.getUint32 ( _byteOffset_ [ , _littleEndian_ ] )

        1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~Uint32~). + 1. Return ? GetViewValue(_v_, _byteOffset_, _littleEndian_, ~uint32~). @@ -42574,7 +44667,7 @@

        DataView.prototype.setBigInt64 ( _byteOffset_, _value_ [ , _littleEndian_ ]

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~BigInt64~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~bigint64~, _value_). @@ -42583,7 +44676,7 @@

        DataView.prototype.setBigUint64 ( _byteOffset_, _value_ [ , _littleEndian_ ]

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~BigUint64~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~biguint64~, _value_). @@ -42593,7 +44686,7 @@

        DataView.prototype.setFloat32 ( _byteOffset_, _value_ [ , _littleEndian_ ] ) 1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~Float32~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~float32~, _value_). @@ -42603,7 +44696,7 @@

        DataView.prototype.setFloat64 ( _byteOffset_, _value_ [ , _littleEndian_ ] ) 1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~Float64~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~float64~, _value_). @@ -42612,7 +44705,7 @@

        DataView.prototype.setInt8 ( _byteOffset_, _value_ )

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? SetViewValue(_v_, _byteOffset_, *true*, ~Int8~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, *true*, ~int8~, _value_). @@ -42622,7 +44715,7 @@

        DataView.prototype.setInt16 ( _byteOffset_, _value_ [ , _littleEndian_ ] ) 1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~Int16~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~int16~, _value_). @@ -42632,7 +44725,7 @@

        DataView.prototype.setInt32 ( _byteOffset_, _value_ [ , _littleEndian_ ] ) 1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~Int32~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~int32~, _value_). @@ -42641,7 +44734,7 @@

        DataView.prototype.setUint8 ( _byteOffset_, _value_ )

        This method performs the following steps when called:

        1. Let _v_ be the *this* value. - 1. Return ? SetViewValue(_v_, _byteOffset_, *true*, ~Uint8~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, *true*, ~uint8~, _value_). @@ -42651,7 +44744,7 @@

        DataView.prototype.setUint16 ( _byteOffset_, _value_ [ , _littleEndian_ ] )< 1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~Uint16~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~uint16~, _value_). @@ -42661,7 +44754,7 @@

        DataView.prototype.setUint32 ( _byteOffset_, _value_ [ , _littleEndian_ ] )< 1. Let _v_ be the *this* value. 1. If _littleEndian_ is not present, set _littleEndian_ to *false*. - 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~Uint32~, _value_). + 1. Return ? SetViewValue(_v_, _byteOffset_, _littleEndian_, ~uint32~, _value_). @@ -42697,12 +44790,115 @@

        The Atomics Object

        For informative guidelines for programming and implementing shared memory in ECMAScript, please see the notes at the end of the memory model section.

        - -

        WaiterList Objects

        -

        A WaiterList is a semantic object that contains an ordered list of agent signifiers for those agents that are waiting on a location (_block_, _i_) in shared memory; _block_ is a Shared Data Block and _i_ a byte offset into the memory of _block_. A WaiterList object also optionally contains a Synchronize event denoting the previous leaving of its critical section.

        -

        Initially a WaiterList object has an empty list and no Synchronize event.

        -

        The agent cluster has a store of WaiterList objects; the store is indexed by (_block_, _i_). WaiterLists are agent-independent: a lookup in the store of WaiterLists by (_block_, _i_) will result in the same WaiterList object in any agent in the agent cluster.

        -

        Each WaiterList has a critical section that controls exclusive access to that WaiterList during evaluation. Only a single agent may enter a WaiterList's critical section at one time. Entering and leaving a WaiterList's critical section is controlled by the abstract operations EnterCriticalSection and LeaveCriticalSection. Operations on a WaiterList—adding and removing waiting agents, traversing the list of agents, suspending and notifying agents on the list, setting and retrieving the Synchronize event—may only be performed by agents that have entered the WaiterList's critical section.

        + +

        Waiter Record

        +

        A Waiter Record is a Record value used to denote a particular call to `Atomics.wait` or `Atomics.waitAsync`.

        +

        A Waiter Record has fields listed in .

        + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + Field Name + + Value + + Meaning +
        + [[AgentSignifier]] + + an agent signifier + + The agent that called `Atomics.wait` or `Atomics.waitAsync`. +
        + [[PromiseCapability]] + + a PromiseCapability Record or ~blocking~ + + If denoting a call to `Atomics.waitAsync`, the resulting promise, otherwise ~blocking~. +
        + [[TimeoutTime]] + + a non-negative extended mathematical value + + The earliest time by which timeout may be triggered; computed using time values. +
        + [[Result]] + + *"ok"* or *"timed-out"* + + The return value of the call. +
        +
        +
        + + +

        WaiterList Records

        +

        A WaiterList Record is used to explain waiting and notification of agents via `Atomics.wait`, `Atomics.waitAsync`, and `Atomics.notify`.

        +

        A WaiterList Record has fields listed in .

        + + + + + + + + + + + + + + + + + +
        + Field Name + + Value + + Meaning +
        + [[Waiters]] + + a List of Waiter Records + + The calls to `Atomics.wait` or `Atomics.waitAsync` that are waiting on the location with which this WaiterList is associated. +
        + [[MostRecentLeaveEvent]] + + a Synchronize event or ~empty~ + + The event of the most recent leaving of its critical section, or ~empty~ if its critical section has never been entered. +
        +
        +

        There can be multiple Waiter Records in a WaiterList with the same agent signifier.

        +

        The agent cluster has a store of WaiterList Records; the store is indexed by (_block_, _i_), where _block_ is a Shared Data Block and _i_ a byte offset into the memory of _block_. WaiterList Records are agent-independent: a lookup in the store of WaiterList Records by (_block_, _i_) will result in the same WaiterList Record in any agent in the agent cluster.

        +

        Each WaiterList Record has a critical section that controls exclusive access to that WaiterList Record during evaluation. Only a single agent may enter a WaiterList Record's critical section at one time. Entering and leaving a WaiterList Record's critical section is controlled by the abstract operations EnterCriticalSection and LeaveCriticalSection. Operations on a WaiterList Record—adding and removing waiting agents, traversing the list of agents, suspending and notifying agents on the list, setting and retrieving the Synchronize event—may only be performed by agents that have entered the WaiterList Record's critical section.

        @@ -42712,79 +44908,115 @@

        Abstract Operations for Atomics

        ValidateIntegerTypedArray ( _typedArray_: an ECMAScript language value, - optional _waitable_: a Boolean, - ): either a normal completion containing either an ArrayBuffer or a SharedArrayBuffer, or a throw completion + _waitable_: a Boolean, + ): either a normal completion containing a TypedArray With Buffer Witness Record, or a throw completion

        - 1. If _waitable_ is not present, set _waitable_ to *false*. - 1. Perform ? ValidateTypedArray(_typedArray_). - 1. Let _buffer_ be _typedArray_.[[ViewedArrayBuffer]]. + 1. Let _taRecord_ be ? ValidateTypedArray(_typedArray_, ~unordered~). + 1. NOTE: Bounds checking is not a synchronizing operation when _typedArray_'s backing buffer is a growable SharedArrayBuffer. 1. If _waitable_ is *true*, then - 1. If _typedArray_.[[TypedArrayName]] is not *"Int32Array"* or *"BigInt64Array"*, throw a *TypeError* exception. + 1. If _typedArray_.[[TypedArrayName]] is neither *"Int32Array"* nor *"BigInt64Array"*, throw a *TypeError* exception. 1. Else, 1. Let _type_ be TypedArrayElementType(_typedArray_). 1. If IsUnclampedIntegerElementType(_type_) is *false* and IsBigIntElementType(_type_) is *false*, throw a *TypeError* exception. - 1. Return _buffer_. + 1. Return _taRecord_.

        ValidateAtomicAccess ( - _typedArray_: a TypedArray, + _taRecord_: a TypedArray With Buffer Witness Record, _requestIndex_: an ECMAScript language value, ): either a normal completion containing an integer or a throw completion

        - 1. Let _length_ be _typedArray_.[[ArrayLength]]. + 1. Let _length_ be TypedArrayLength(_taRecord_). 1. Let _accessIndex_ be ? ToIndex(_requestIndex_). 1. Assert: _accessIndex_ ≥ 0. 1. If _accessIndex_ ≥ _length_, throw a *RangeError* exception. + 1. Let _typedArray_ be _taRecord_.[[Object]]. 1. Let _elementSize_ be TypedArrayElementSize(_typedArray_). 1. Let _offset_ be _typedArray_.[[ByteOffset]]. 1. Return (_accessIndex_ × _elementSize_) + _offset_.
        + +

        + ValidateAtomicAccessOnIntegerTypedArray ( + _typedArray_: an ECMAScript language value, + _requestIndex_: an ECMAScript language value, + optional _waitable_: a Boolean, + ): either a normal completion containing an integer or a throw completion +

        +
        +
        + + 1. If _waitable_ is not present, set _waitable_ to *false*. + 1. Let _taRecord_ be ? ValidateIntegerTypedArray(_typedArray_, _waitable_). + 1. Return ? ValidateAtomicAccess(_taRecord_, _requestIndex_). + +
        + + +

        + RevalidateAtomicAccess ( + _typedArray_: a TypedArray, + _byteIndexInBuffer_: an integer, + ): either a normal completion containing ~unused~ or a throw completion +

        +
        +
        description
        +
        This operation revalidates the index within the backing buffer for atomic operations after all argument coercions are performed in Atomics methods, as argument coercions can have arbitrary side effects, which could cause the buffer to become out of bounds. This operation does not throw when _typedArray_'s backing buffer is a SharedArrayBuffer.
        +
        + + 1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_typedArray_, ~unordered~). + 1. NOTE: Bounds checking is not a synchronizing operation when _typedArray_'s backing buffer is a growable SharedArrayBuffer. + 1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception. + 1. Assert: _byteIndexInBuffer_ ≥ _typedArray_.[[ByteOffset]]. + 1. If _byteIndexInBuffer_ ≥ _taRecord_.[[CachedBufferByteLength]], throw a *RangeError* exception. + 1. Return ~unused~. + +
        +

        GetWaiterList ( _block_: a Shared Data Block, _i_: a non-negative integer that is evenly divisible by 4, - ): a WaiterList + ): a WaiterList Record

        1. Assert: _i_ and _i_ + 3 are valid byte offsets within the memory of _block_. - 1. Return the WaiterList that is referenced by the pair (_block_, _i_). + 1. Return the WaiterList Record that is referenced by the pair (_block_, _i_).

        EnterCriticalSection ( - _WL_: a WaiterList, + _WL_: a WaiterList Record, ): ~unused~

        - 1. Assert: The surrounding agent is not in the critical section for any WaiterList. + 1. Assert: The surrounding agent is not in the critical section for any WaiterList Record. 1. Wait until no agent is in the critical section for _WL_, then enter the critical section for _WL_ (without allowing any other agent to enter). - 1. If _WL_ has a Synchronize event, then + 1. If _WL_.[[MostRecentLeaveEvent]] is not ~empty~, then 1. NOTE: A _WL_ whose critical section has been entered at least once has a Synchronize event set by LeaveCriticalSection. 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. - 1. Let _eventsRecord_ be the Agent Events Record in _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). - 1. Let _entererEventList_ be _eventsRecord_.[[EventList]]. + 1. Let _eventsRecord_ be the Agent Events Record of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). 1. Let _enterEvent_ be a new Synchronize event. - 1. Append _enterEvent_ to _entererEventList_. - 1. Let _leaveEvent_ be the Synchronize event in _WL_. - 1. Append (_leaveEvent_, _enterEvent_) to _eventsRecord_.[[AgentSynchronizesWith]]. + 1. Append _enterEvent_ to _eventsRecord_.[[EventList]]. + 1. Append (_WL_.[[MostRecentLeaveEvent]], _enterEvent_) to _eventsRecord_.[[AgentSynchronizesWith]]. 1. Return ~unused~.

        EnterCriticalSection has contention when an agent attempting to enter the critical section must wait for another agent to leave it. When there is no contention, FIFO order of EnterCriticalSection calls is observable. When there is contention, an implementation may choose an arbitrary order but may not cause an agent to wait indefinitely.

        @@ -42793,7 +45025,7 @@

        LeaveCriticalSection ( - _WL_: a WaiterList, + _WL_: a WaiterList Record, ): ~unused~

        @@ -42801,11 +45033,10 @@

        1. Assert: The surrounding agent is in the critical section for _WL_. 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. - 1. Let _eventsRecord_ be the Agent Events Record in _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). - 1. Let _leaverEventList_ be _eventsRecord_.[[EventList]]. + 1. Let _eventsRecord_ be the Agent Events Record of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). 1. Let _leaveEvent_ be a new Synchronize event. - 1. Append _leaveEvent_ to _leaverEventList_. - 1. Set the Synchronize event in _WL_ to _leaveEvent_. + 1. Append _leaveEvent_ to _eventsRecord_.[[EventList]]. + 1. Set _WL_.[[MostRecentLeaveEvent]] to _leaveEvent_. 1. Leave the critical section for _WL_. 1. Return ~unused~. @@ -42814,16 +45045,16 @@

        AddWaiter ( - _WL_: a WaiterList, - _W_: an agent signifier, + _WL_: a WaiterList Record, + _waiterRecord_: a Waiter Record, ): ~unused~

        1. Assert: The surrounding agent is in the critical section for _WL_. - 1. Assert: _W_ is not on the list of waiters in any WaiterList. - 1. Append _W_ to _WL_. + 1. Assert: There is no Waiter Record in _WL_.[[Waiters]] whose [[PromiseCapability]] field is _waiterRecord_.[[PromiseCapability]] and whose [[AgentSignifier]] field is _waiterRecord_.[[AgentSignifier]]. + 1. Append _waiterRecord_ to _WL_.[[Waiters]]. 1. Return ~unused~.
        @@ -42831,16 +45062,16 @@

        RemoveWaiter ( - _WL_: a WaiterList, - _W_: an agent signifier, + _WL_: a WaiterList Record, + _waiterRecord_: a Waiter Record, ): ~unused~

        1. Assert: The surrounding agent is in the critical section for _WL_. - 1. Assert: _W_ is on the list of waiters in _WL_. - 1. Remove _W_ from the list of waiters in _WL_. + 1. Assert: _WL_.[[Waiters]] contains _waiterRecord_. + 1. Remove _waiterRecord_ from _WL_.[[Waiters]]. 1. Return ~unused~.
        @@ -42848,70 +45079,219 @@

        RemoveWaiters ( - _WL_: a WaiterList, + _WL_: a WaiterList Record, _c_: a non-negative integer or +∞, - ): a List of agent signifiers + ): a List of Waiter Records

        1. Assert: The surrounding agent is in the critical section for _WL_. - 1. Let _S_ be a reference to the list of waiters in _WL_. - 1. Let _len_ be the number of elements in _S_. + 1. Let _len_ be the number of elements in _WL_.[[Waiters]]. 1. Let _n_ be min(_c_, _len_). - 1. Let _L_ be a List whose elements are the first _n_ elements of _S_. - 1. Remove the first _n_ elements of _S_. + 1. Let _L_ be a List whose elements are the first _n_ elements of _WL_.[[Waiters]]. + 1. Remove the first _n_ elements of _WL_.[[Waiters]]. 1. Return _L_.
        - +

        - SuspendAgent ( - _WL_: a WaiterList, - _W_: an agent signifier, - _minimumTimeout_: a non-negative extended mathematical value, - ): a Boolean + SuspendThisAgent ( + _WL_: a WaiterList Record, + _waiterRecord_: a Waiter Record, + ): ~unused~

        1. Assert: The surrounding agent is in the critical section for _WL_. - 1. Assert: _W_ is equivalent to AgentSignifier(). - 1. Assert: _W_ is on the list of waiters in _WL_. + 1. Assert: _WL_.[[Waiters]] contains _waiterRecord_. + 1. Let _thisAgent_ be AgentSignifier(). + 1. Assert: _waiterRecord_.[[AgentSignifier]] is _thisAgent_. + 1. Assert: _waiterRecord_.[[PromiseCapability]] is ~blocking~. 1. Assert: AgentCanSuspend() is *true*. - 1. Let _additionalTimeout_ be an implementation-defined non-negative mathematical value. - 1. Let _timeout_ be _minimumTimeout_ + _additionalTimeout_. - 1. NOTE: When _minimumTimeout_ is +∞, _timeout_ is also +∞ and the following step can terminate only by another agent calling NotifyWaiter. - 1. Perform LeaveCriticalSection(_WL_) and suspend _W_ for up to _timeout_ milliseconds, performing the combined operation in such a way that a notification that arrives after the critical section is exited but before the suspension takes effect is not lost. _W_ can wake from suspension either because the timeout expired or because it was notified explicitly by another agent calling NotifyWaiter with arguments _WL_ and _W_, and not for any other reasons at all. + 1. Perform LeaveCriticalSection(_WL_) and suspend the surrounding agent until the time is _waiterRecord_.[[TimeoutTime]], performing the combined operation in such a way that a notification that arrives after the critical section is exited but before the suspension takes effect is not lost. The surrounding agent can only wake from suspension due to a timeout or due to another agent calling NotifyWaiter with arguments _WL_ and _thisAgent_ (i.e. via a call to `Atomics.notify`). 1. Perform EnterCriticalSection(_WL_). - 1. If _W_ was notified explicitly by another agent calling NotifyWaiter with arguments _WL_ and _W_, return *true*. - 1. Return *false*. + 1. Return ~unused~. - -

        _additionalTimeout_ allows implementations to pad timeouts as necessary, such as for reducing power consumption or coarsening timer resolution to mitigate timing attacks. This value may differ from call to call of SuspendAgent.

        -

        NotifyWaiter ( - _WL_: a WaiterList, - _W_: an agent signifier, + _WL_: a WaiterList Record, + _waiterRecord_: a Waiter Record, ): ~unused~

        1. Assert: The surrounding agent is in the critical section for _WL_. - 1. Notify the agent _W_. + 1. If _waiterRecord_.[[PromiseCapability]] is ~blocking~, then + 1. Wake the agent whose signifier is _waiterRecord_.[[AgentSignifier]] from suspension. + 1. NOTE: This causes the agent to resume execution in SuspendThisAgent. + 1. Else if AgentSignifier() is _waiterRecord_.[[AgentSignifier]], then + 1. Let _promiseCapability_ be _waiterRecord_.[[PromiseCapability]]. + 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _waiterRecord_.[[Result]] »). + 1. Else, + 1. Perform EnqueueResolveInAgentJob(_waiterRecord_.[[AgentSignifier]], _waiterRecord_.[[PromiseCapability]], _waiterRecord_.[[Result]]). + 1. Return ~unused~. + + +

        An agent must not access another agent's promise capability in any capacity beyond passing it to the host.

        +
        +
        + + +

        + EnqueueResolveInAgentJob ( + _agentSignifier_: an agent signifier, + _promiseCapability_: a PromiseCapability Record, + _resolution_: an ECMAScript language value, + ): ~unused~ +

        +
        +
        + + 1. Let _resolveJob_ be a new Job Abstract Closure with no parameters that captures _agentSignifier_, _promiseCapability_, and _resolution_ and performs the following steps when called: + 1. Assert: AgentSignifier() is _agentSignifier_. + 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _resolution_ »). + 1. Return ~unused~. + 1. Let _realmInTargetAgent_ be ! GetFunctionRealm(_promiseCapability_.[[Resolve]]). + 1. Assert: _agentSignifier_ is _realmInTargetAgent_.[[AgentSignifier]]. + 1. Perform HostEnqueueGenericJob(_resolveJob_, _realmInTargetAgent_). 1. Return ~unused~. +
        + + +

        + DoWait ( + _mode_: ~sync~ or ~async~, + _typedArray_: an ECMAScript language value, + _index_: an ECMAScript language value, + _value_: an ECMAScript language value, + _timeout_: an ECMAScript language value, + ): either a normal completion containing either an Object, *"not-equal"*, *"timed-out"*, or *"ok"*, or a throw completion +

        +
        +
        + + 1. Let _taRecord_ be ? ValidateIntegerTypedArray(_typedArray_, *true*). + 1. Let _buffer_ be _taRecord_.[[Object]].[[ViewedArrayBuffer]]. + 1. If IsSharedArrayBuffer(_buffer_) is *false*, throw a *TypeError* exception. + 1. Let _i_ be ? ValidateAtomicAccess(_taRecord_, _index_). + 1. Let _arrayTypeName_ be _typedArray_.[[TypedArrayName]]. + 1. If _arrayTypeName_ is *"BigInt64Array"*, let _v_ be ? ToBigInt64(_value_). + 1. Else, let _v_ be ? ToInt32(_value_). + 1. Let _q_ be ? ToNumber(_timeout_). + 1. If _q_ is either *NaN* or *+∞*𝔽, let _t_ be +∞; else if _q_ is *-∞*𝔽, let _t_ be 0; else let _t_ be max(ℝ(_q_), 0). + 1. If _mode_ is ~sync~ and AgentCanSuspend() is *false*, throw a *TypeError* exception. + 1. Let _block_ be _buffer_.[[ArrayBufferData]]. + 1. Let _offset_ be _typedArray_.[[ByteOffset]]. + 1. Let _byteIndexInBuffer_ be (_i_ × 4) + _offset_. + 1. Let _WL_ be GetWaiterList(_block_, _byteIndexInBuffer_). + 1. If _mode_ is ~sync~, then + 1. Let _promiseCapability_ be ~blocking~. + 1. Let _resultObject_ be *undefined*. + 1. Else, + 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%). + 1. Let _resultObject_ be OrdinaryObjectCreate(%Object.prototype%). + 1. Perform EnterCriticalSection(_WL_). + 1. Let _elementType_ be TypedArrayElementType(_typedArray_). + 1. Let _w_ be GetValueFromBuffer(_buffer_, _byteIndexInBuffer_, _elementType_, *true*, ~seq-cst~). + 1. If _v_ ≠ _w_, then + 1. Perform LeaveCriticalSection(_WL_). + 1. If _mode_ is ~sync~, return *"not-equal"*. + 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"async"*, *false*). + 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"value"*, *"not-equal"*). + 1. Return _resultObject_. + 1. If _t_ = 0 and _mode_ is ~async~, then + 1. NOTE: There is no special handling of synchronous immediate timeouts. Asynchronous immediate timeouts have special handling in order to fail fast and avoid unnecessary Promise jobs. + 1. Perform LeaveCriticalSection(_WL_). + 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"async"*, *false*). + 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"value"*, *"timed-out"*). + 1. Return _resultObject_. + 1. Let _thisAgent_ be AgentSignifier(). + 1. Let _now_ be the time value (UTC) identifying the current time. + 1. Let _additionalTimeout_ be an implementation-defined non-negative mathematical value. + 1. Let _timeoutTime_ be ℝ(_now_) + _t_ + _additionalTimeout_. + 1. NOTE: When _t_ is +∞, _timeoutTime_ is also +∞. + 1. Let _waiterRecord_ be a new Waiter Record { [[AgentSignifier]]: _thisAgent_, [[PromiseCapability]]: _promiseCapability_, [[TimeoutTime]]: _timeoutTime_, [[Result]]: *"ok"* }. + 1. Perform AddWaiter(_WL_, _waiterRecord_). + 1. If _mode_ is ~sync~, then + 1. Perform SuspendThisAgent(_WL_, _waiterRecord_). + 1. Else if _timeoutTime_ is finite, then + 1. Perform EnqueueAtomicsWaitAsyncTimeoutJob(_WL_, _waiterRecord_). + 1. Perform LeaveCriticalSection(_WL_). + 1. If _mode_ is ~sync~, return _waiterRecord_.[[Result]]. + 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"async"*, *true*). + 1. Perform ! CreateDataPropertyOrThrow(_resultObject_, *"value"*, _promiseCapability_.[[Promise]]). + 1. Return _resultObject_. + -

        The embedding may delay notifying _W_, e.g. for resource management reasons, but _W_ must eventually be notified in order to guarantee forward progress.

        +

        _additionalTimeout_ allows implementations to pad timeouts as necessary, such as for reducing power consumption or coarsening timer resolution to mitigate timing attacks. This value may differ from call to call of DoWait.

        + +

        + EnqueueAtomicsWaitAsyncTimeoutJob ( + _WL_: a WaiterList Record, + _waiterRecord_: a Waiter Record, + ): ~unused~ +

        +
        +
        + + 1. Let _timeoutJob_ be a new Job Abstract Closure with no parameters that captures _WL_ and _waiterRecord_ and performs the following steps when called: + 1. Perform EnterCriticalSection(_WL_). + 1. If _WL_.[[Waiters]] contains _waiterRecord_, then + 1. Let _timeOfJobExecution_ be the time value (UTC) identifying the current time. + 1. Assert: ℝ(_timeOfJobExecution_) ≥ _waiterRecord_.[[TimeoutTime]] (ignoring potential non-monotonicity of time values). + 1. Set _waiterRecord_.[[Result]] to *"timed-out"*. + 1. Perform RemoveWaiter(_WL_, _waiterRecord_). + 1. Perform NotifyWaiter(_WL_, _waiterRecord_). + 1. Perform LeaveCriticalSection(_WL_). + 1. Return ~unused~. + 1. Let _now_ be the time value (UTC) identifying the current time. + 1. Let _currentRealm_ be the current Realm Record. + 1. Perform HostEnqueueTimeoutJob(_timeoutJob_, _currentRealm_, 𝔽(_waiterRecord_.[[TimeoutTime]]) - _now_). + 1. Return ~unused~. + +
        + + +

        + AtomicCompareExchangeInSharedBlock ( + _block_: a Shared Data Block, + _byteIndexInBuffer_: an integer, + _elementSize_: a non-negative integer, + _expectedBytes_: a List of byte values, + _replacementBytes_: a List of byte values, + ): a List of byte values +

        +
        +
        + + 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. + 1. Let _eventsRecord_ be the Agent Events Record of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). + 1. Let _rawBytesRead_ be a List of length _elementSize_ whose elements are nondeterministically chosen byte values. + 1. NOTE: In implementations, _rawBytesRead_ is the result of a load-link, of a load-exclusive, or of an operand of a read-modify-write instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency. + 1. NOTE: The comparison of the expected value and the read value is performed outside of the read-modify-write modification function to avoid needlessly strong synchronization when the expected value is not equal to the read value. + 1. If ByteListEqual(_rawBytesRead_, _expectedBytes_) is *true*, then + 1. Let _second_ be a new read-modify-write modification function with parameters (_oldBytes_, _newBytes_) that captures nothing and performs the following steps atomically when called: + 1. Return _newBytes_. + 1. Let _event_ be ReadModifyWriteSharedMemory { [[Order]]: ~seq-cst~, [[NoTear]]: *true*, [[Block]]: _block_, [[ByteIndex]]: _byteIndexInBuffer_, [[ElementSize]]: _elementSize_, [[Payload]]: _replacementBytes_, [[ModifyOp]]: _second_ }. + 1. Else, + 1. Let _event_ be ReadSharedMemory { [[Order]]: ~seq-cst~, [[NoTear]]: *true*, [[Block]]: _block_, [[ByteIndex]]: _byteIndexInBuffer_, [[ElementSize]]: _elementSize_ }. + 1. Append _event_ to _eventsRecord_.[[EventList]]. + 1. Append Chosen Value Record { [[Event]]: _event_, [[ChosenValue]]: _rawBytesRead_ } to _execution_.[[ChosenValues]]. + 1. Return _rawBytesRead_. + +
        +

        AtomicReadModifyWrite ( @@ -42926,14 +45306,13 @@

        _op_ takes two List of byte values arguments and returns a List of byte values. This operation atomically loads a value, combines it with another value, and stores the result of the combination. It returns the loaded value.

        - 1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_). - 1. Let _indexedPosition_ be ? ValidateAtomicAccess(_typedArray_, _index_). - 1. If _typedArray_.[[ContentType]] is ~BigInt~, let _v_ be ? ToBigInt(_value_). + 1. Let _byteIndexInBuffer_ be ? ValidateAtomicAccessOnIntegerTypedArray(_typedArray_, _index_). + 1. If _typedArray_.[[ContentType]] is ~bigint~, let _v_ be ? ToBigInt(_value_). 1. Otherwise, let _v_ be 𝔽(? ToIntegerOrInfinity(_value_)). - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToIntegerOrInfinity on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached. + 1. Perform ? RevalidateAtomicAccess(_typedArray_, _byteIndexInBuffer_). + 1. Let _buffer_ be _typedArray_.[[ViewedArrayBuffer]]. 1. Let _elementType_ be TypedArrayElementType(_typedArray_). - 1. Return GetModifySetValueInBuffer(_buffer_, _indexedPosition_, _elementType_, _v_, _op_). + 1. Return GetModifySetValueInBuffer(_buffer_, _byteIndexInBuffer_, _elementType_, _v_, _op_).
        @@ -42955,9 +45334,13 @@

        1. Let _i_ be 0. 1. For each element _xByte_ of _xBytes_, do 1. Let _yByte_ be _yBytes_[_i_]. - 1. If _op_ is `&`, let _resultByte_ be the result of applying the bitwise AND operation to _xByte_ and _yByte_. - 1. Else if _op_ is `^`, let _resultByte_ be the result of applying the bitwise exclusive OR (XOR) operation to _xByte_ and _yByte_. - 1. Else, _op_ is `|`. Let _resultByte_ be the result of applying the bitwise inclusive OR operation to _xByte_ and _yByte_. + 1. If _op_ is `&`, then + 1. Let _resultByte_ be the result of applying the bitwise AND operation to _xByte_ and _yByte_. + 1. Else if _op_ is `^`, then + 1. Let _resultByte_ be the result of applying the bitwise exclusive OR (XOR) operation to _xByte_ and _yByte_. + 1. Else, + 1. Assert: _op_ is `|`. + 1. Let _resultByte_ be the result of applying the bitwise inclusive OR operation to _xByte_ and _yByte_. 1. Set _i_ to _i_ + 1. 1. Append _resultByte_ to _result_. 1. Return _result_. @@ -43020,40 +45403,27 @@

        Atomics.and ( _typedArray_, _index_, _value_ )

        Atomics.compareExchange ( _typedArray_, _index_, _expectedValue_, _replacementValue_ )

        This function performs the following steps when called:

        - 1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_). + 1. Let _byteIndexInBuffer_ be ? ValidateAtomicAccessOnIntegerTypedArray(_typedArray_, _index_). + 1. Let _buffer_ be _typedArray_.[[ViewedArrayBuffer]]. 1. Let _block_ be _buffer_.[[ArrayBufferData]]. - 1. Let _indexedPosition_ be ? ValidateAtomicAccess(_typedArray_, _index_). - 1. If _typedArray_.[[ContentType]] is ~BigInt~, then + 1. If _typedArray_.[[ContentType]] is ~bigint~, then 1. Let _expected_ be ? ToBigInt(_expectedValue_). 1. Let _replacement_ be ? ToBigInt(_replacementValue_). 1. Else, 1. Let _expected_ be 𝔽(? ToIntegerOrInfinity(_expectedValue_)). 1. Let _replacement_ be 𝔽(? ToIntegerOrInfinity(_replacementValue_)). - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToIntegerOrInfinity on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached. + 1. Perform ? RevalidateAtomicAccess(_typedArray_, _byteIndexInBuffer_). 1. Let _elementType_ be TypedArrayElementType(_typedArray_). 1. Let _elementSize_ be TypedArrayElementSize(_typedArray_). 1. Let _isLittleEndian_ be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record. 1. Let _expectedBytes_ be NumericToRawBytes(_elementType_, _expected_, _isLittleEndian_). 1. Let _replacementBytes_ be NumericToRawBytes(_elementType_, _replacement_, _isLittleEndian_). 1. If IsSharedArrayBuffer(_buffer_) is *true*, then - 1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record. - 1. Let _eventList_ be the [[EventList]] field of the element of _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier(). - 1. Let _rawBytesRead_ be a List of length _elementSize_ whose elements are nondeterministically chosen byte values. - 1. NOTE: In implementations, _rawBytesRead_ is the result of a load-link, of a load-exclusive, or of an operand of a read-modify-write instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency. - 1. NOTE: The comparison of the expected value and the read value is performed outside of the read-modify-write modification function to avoid needlessly strong synchronization when the expected value is not equal to the read value. - 1. If ByteListEqual(_rawBytesRead_, _expectedBytes_) is *true*, then - 1. Let _second_ be a new read-modify-write modification function with parameters (_oldBytes_, _newBytes_) that captures nothing and performs the following steps atomically when called: - 1. Return _newBytes_. - 1. Let _event_ be ReadModifyWriteSharedMemory { [[Order]]: ~SeqCst~, [[NoTear]]: *true*, [[Block]]: _block_, [[ByteIndex]]: _indexedPosition_, [[ElementSize]]: _elementSize_, [[Payload]]: _replacementBytes_, [[ModifyOp]]: _second_ }. - 1. Else, - 1. Let _event_ be ReadSharedMemory { [[Order]]: ~SeqCst~, [[NoTear]]: *true*, [[Block]]: _block_, [[ByteIndex]]: _indexedPosition_, [[ElementSize]]: _elementSize_ }. - 1. Append _event_ to _eventList_. - 1. Append Chosen Value Record { [[Event]]: _event_, [[ChosenValue]]: _rawBytesRead_ } to _execution_.[[ChosenValues]]. + 1. Let _rawBytesRead_ be AtomicCompareExchangeInSharedBlock(_block_, _byteIndexInBuffer_, _elementSize_, _expectedBytes_, _replacementBytes_). 1. Else, - 1. Let _rawBytesRead_ be a List of length _elementSize_ whose elements are the sequence of _elementSize_ bytes starting with _block_[_indexedPosition_]. + 1. Let _rawBytesRead_ be a List of length _elementSize_ whose elements are the sequence of _elementSize_ bytes starting with _block_[_byteIndexInBuffer_]. 1. If ByteListEqual(_rawBytesRead_, _expectedBytes_) is *true*, then - 1. Store the individual bytes of _replacementBytes_ into _block_, starting at _block_[_indexedPosition_]. + 1. Store the individual bytes of _replacementBytes_ into _block_, starting at _block_[_byteIndexInBuffer_]. 1. Return RawBytesToNumeric(_elementType_, _rawBytesRead_, _isLittleEndian_).
        @@ -43091,12 +45461,11 @@

        Atomics.isLockFree ( _size_ )

        Atomics.load ( _typedArray_, _index_ )

        This function performs the following steps when called:

        - 1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_). - 1. Let _indexedPosition_ be ? ValidateAtomicAccess(_typedArray_, _index_). - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ValidateAtomicAccess on the preceding line can have arbitrary side effects, which could cause the buffer to become detached. + 1. Let _byteIndexInBuffer_ be ? ValidateAtomicAccessOnIntegerTypedArray(_typedArray_, _index_). + 1. Perform ? RevalidateAtomicAccess(_typedArray_, _byteIndexInBuffer_). + 1. Let _buffer_ be _typedArray_.[[ViewedArrayBuffer]]. 1. Let _elementType_ be TypedArrayElementType(_typedArray_). - 1. Return GetValueFromBuffer(_buffer_, _indexedPosition_, _elementType_, *true*, ~SeqCst~). + 1. Return GetValueFromBuffer(_buffer_, _byteIndexInBuffer_, _elementType_, *true*, ~seq-cst~).
        @@ -43114,14 +45483,13 @@

        Atomics.or ( _typedArray_, _index_, _value_ )

        Atomics.store ( _typedArray_, _index_, _value_ )

        This function performs the following steps when called:

        - 1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_). - 1. Let _indexedPosition_ be ? ValidateAtomicAccess(_typedArray_, _index_). - 1. If _typedArray_.[[ContentType]] is ~BigInt~, let _v_ be ? ToBigInt(_value_). + 1. Let _byteIndexInBuffer_ be ? ValidateAtomicAccessOnIntegerTypedArray(_typedArray_, _index_). + 1. If _typedArray_.[[ContentType]] is ~bigint~, let _v_ be ? ToBigInt(_value_). 1. Otherwise, let _v_ be 𝔽(? ToIntegerOrInfinity(_value_)). - 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. - 1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToIntegerOrInfinity on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached. + 1. Perform ? RevalidateAtomicAccess(_typedArray_, _byteIndexInBuffer_). + 1. Let _buffer_ be _typedArray_.[[ViewedArrayBuffer]]. 1. Let _elementType_ be TypedArrayElementType(_typedArray_). - 1. Perform SetValueInBuffer(_buffer_, _indexedPosition_, _elementType_, _v_, *true*, ~SeqCst~). + 1. Perform SetValueInBuffer(_buffer_, _byteIndexInBuffer_, _elementType_, _v_, *true*, ~seq-cst~). 1. Return _v_. @@ -43152,33 +45520,16 @@

        Atomics.wait ( _typedArray_, _index_, _value_, _timeout_ )

        This function puts the surrounding agent in a wait queue and suspends it until notified or until the wait times out, returning a String differentiating those cases.

        It performs the following steps when called:

        - 1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_, *true*). - 1. If IsSharedArrayBuffer(_buffer_) is *false*, throw a *TypeError* exception. - 1. Let _indexedPosition_ be ? ValidateAtomicAccess(_typedArray_, _index_). - 1. If _typedArray_.[[TypedArrayName]] is *"BigInt64Array"*, let _v_ be ? ToBigInt64(_value_). - 1. Otherwise, let _v_ be ? ToInt32(_value_). - 1. Let _q_ be ? ToNumber(_timeout_). - 1. If _q_ is *NaN* or *+∞*𝔽, let _t_ be +∞; else if _q_ is *-∞*𝔽, let _t_ be 0; else let _t_ be max(ℝ(_q_), 0). - 1. Let _B_ be AgentCanSuspend(). - 1. If _B_ is *false*, throw a *TypeError* exception. - 1. Let _block_ be _buffer_.[[ArrayBufferData]]. - 1. Let _WL_ be GetWaiterList(_block_, _indexedPosition_). - 1. Perform EnterCriticalSection(_WL_). - 1. Let _elementType_ be TypedArrayElementType(_typedArray_). - 1. Let _w_ be GetValueFromBuffer(_buffer_, _indexedPosition_, _elementType_, *true*, ~SeqCst~). - 1. If _v_ ≠ _w_, then - 1. Perform LeaveCriticalSection(_WL_). - 1. Return *"not-equal"*. - 1. Let _W_ be AgentSignifier(). - 1. Perform AddWaiter(_WL_, _W_). - 1. Let _notified_ be SuspendAgent(_WL_, _W_, _t_). - 1. If _notified_ is *true*, then - 1. Assert: _W_ is not on the list of waiters in _WL_. - 1. Else, - 1. Perform RemoveWaiter(_WL_, _W_). - 1. Perform LeaveCriticalSection(_WL_). - 1. If _notified_ is *true*, return *"ok"*. - 1. Return *"timed-out"*. + 1. Return ? DoWait(~sync~, _typedArray_, _index_, _value_, _timeout_). + + + + +

        Atomics.waitAsync ( _typedArray_, _index_, _value_, _timeout_ )

        +

        This function returns a Promise that is resolved when the calling agent is notified or the the timeout is reached.

        +

        It performs the following steps when called:

        + + 1. Return ? DoWait(~async~, _typedArray_, _index_, _value_, _timeout_).
        @@ -43187,15 +45538,16 @@

        Atomics.notify ( _typedArray_, _index_, _count_ )

        This function notifies some agents that are sleeping in the wait queue.

        It performs the following steps when called:

        - 1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_, *true*). - 1. Let _indexedPosition_ be ? ValidateAtomicAccess(_typedArray_, _index_). - 1. If _count_ is *undefined*, let _c_ be +∞. + 1. Let _byteIndexInBuffer_ be ? ValidateAtomicAccessOnIntegerTypedArray(_typedArray_, _index_, *true*). + 1. If _count_ is *undefined*, then + 1. Let _c_ be +∞. 1. Else, 1. Let _intCount_ be ? ToIntegerOrInfinity(_count_). 1. Let _c_ be max(_intCount_, 0). + 1. Let _buffer_ be _typedArray_.[[ViewedArrayBuffer]]. 1. Let _block_ be _buffer_.[[ArrayBufferData]]. 1. If IsSharedArrayBuffer(_buffer_) is *false*, return *+0*𝔽. - 1. Let _WL_ be GetWaiterList(_block_, _indexedPosition_). + 1. Let _WL_ be GetWaiterList(_block_, _byteIndexInBuffer_). 1. Perform EnterCriticalSection(_WL_). 1. Let _S_ be RemoveWaiters(_WL_, _c_). 1. For each element _W_ of _S_, do @@ -43251,7 +45603,7 @@

        JSON.parse ( _text_ [ , _reviver_ ] )

        1. [id="step-json-parse-eval"] Let _completion_ be Completion(Evaluation of _script_). 1. NOTE: The PropertyDefinitionEvaluation semantics defined in have special handling for the above evaluation. 1. Let _unfiltered_ be _completion_.[[Value]]. - 1. [id="step-json-parse-assert-type"] Assert: _unfiltered_ is either a String, Number, Boolean, Null, or an Object that is defined by either an |ArrayLiteral| or an |ObjectLiteral|. + 1. [id="step-json-parse-assert-type"] Assert: _unfiltered_ is either a String, a Number, a Boolean, an Object that is defined by either an |ArrayLiteral| or an |ObjectLiteral|, or *null*. 1. If IsCallable(_reviver_) is *true*, then 1. Let _root_ be OrdinaryObjectCreate(%Object.prototype%). 1. Let _rootName_ be the empty String. @@ -43334,11 +45686,13 @@

        JSON.stringify ( _value_ [ , _replacer_ [ , _space_ ] ] )

        1. Let _prop_ be ! ToString(𝔽(_k_)). 1. Let _v_ be ? Get(_replacer_, _prop_). 1. Let _item_ be *undefined*. - 1. If _v_ is a String, set _item_ to _v_. - 1. Else if _v_ is a Number, set _item_ to ! ToString(_v_). + 1. If _v_ is a String, then + 1. Set _item_ to _v_. + 1. Else if _v_ is a Number, then + 1. Set _item_ to ! ToString(_v_). 1. Else if _v_ is an Object, then 1. If _v_ has a [[StringData]] or [[NumberData]] internal slot, set _item_ to ? ToString(_v_). - 1. If _item_ is not *undefined* and _item_ is not currently an element of _PropertyList_, then + 1. If _item_ is not *undefined* and _PropertyList_ does not contain _item_, then 1. Append _item_ to _PropertyList_. 1. Set _k_ to _k_ + 1. 1. If _space_ is an Object, then @@ -43351,7 +45705,7 @@

        JSON.stringify ( _value_ [ , _replacer_ [ , _space_ ] ] )

        1. Set _spaceMV_ to min(10, _spaceMV_). 1. If _spaceMV_ < 1, let _gap_ be the empty String; otherwise let _gap_ be the String value containing _spaceMV_ occurrences of the code unit 0x0020 (SPACE). 1. Else if _space_ is a String, then - 1. If the length of _space_ is 10 or less, let _gap_ be _space_; otherwise let _gap_ be the substring of _space_ from 0 to 10. + 1. If the length of _space_ ≤ 10, let _gap_ be _space_; otherwise let _gap_ be the substring of _space_ from 0 to 10. 1. Else, 1. Let _gap_ be the empty String. 1. Let _wrapper_ be OrdinaryObjectCreate(%Object.prototype%). @@ -43444,7 +45798,7 @@

        _state_: a JSON Serialization Record, _key_: a String, _holder_: an Object, - ): either a normal completion containing either *undefined* or a String, or a throw completion + ): either a normal completion containing either a String or *undefined*, or a throw completion

        @@ -43496,8 +45850,8 @@

        1. For each code point _C_ of StringToCodePoints(_value_), do 1. If _C_ is listed in the “Code Point” column of , then 1. Set _product_ to the string-concatenation of _product_ and the escape sequence for _C_ as specified in the “Escape Sequence” column of the corresponding row. - 1. Else if _C_ has a numeric value less than 0x0020 (SPACE), or if _C_ has the same numeric value as a or , then - 1. Let _unit_ be the code unit whose numeric value is that of _C_. + 1. Else if _C_ has a numeric value less than 0x0020 (SPACE) or _C_ has the same numeric value as a leading surrogate or trailing surrogate, then + 1. Let _unit_ be the code unit whose numeric value is the numeric value of _C_. 1. Set _product_ to the string-concatenation of _product_ and UnicodeEscape(_unit_). 1. Else, 1. Set _product_ to the string-concatenation of _product_ and UTF16EncodeCodePoint(_C_). @@ -43612,7 +45966,7 @@

        1. Let _n_ be the numeric value of _C_. 1. Assert: _n_ ≤ 0xFFFF. 1. Let _hex_ be the String representation of _n_, formatted as a lowercase hexadecimal number. - 1. Return the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS), *"u"*, and ! StringPad(_hex_, *4*𝔽, *"0"*, ~start~). + 1. Return the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS), *"u"*, and StringPad(_hex_, 4, *"0"*, ~start~). @@ -43721,7 +46075,7 @@

        Managing Memory

        WeakRef Objects

        -

        A WeakRef is an object that is used to refer to a target object without preserving it from garbage collection. WeakRefs can be dereferenced to allow access to the target object, if the target object hasn't been reclaimed by garbage collection.

        +

        A WeakRef is an object that is used to refer to a target object or symbol without preserving it from garbage collection. WeakRefs can be dereferenced to allow access to the target value, if the target hasn't been reclaimed by garbage collection.

        The WeakRef Constructor

        @@ -43747,7 +46101,7 @@

        WeakRef ( _target_ )

        This function performs the following steps when called:

        1. If NewTarget is *undefined*, throw a *TypeError* exception. - 1. If _target_ is not an Object, throw a *TypeError* exception. + 1. If CanBeHeldWeakly(_target_) is *false*, throw a *TypeError* exception. 1. Let _weakRef_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%WeakRef.prototype%"*, « [[WeakRefTarget]] »). 1. Perform AddToKeptObjects(_target_). 1. Set _weakRef_.[[WeakRefTarget]] to _target_. @@ -43803,7 +46157,7 @@

        WeakRef.prototype.deref ( )

        -

        If the WeakRef returns a _target_ Object that is not *undefined*, then this _target_ object should not be garbage collected until the current execution of ECMAScript code has completed. The AddToKeptObjects operation makes sure read consistency is maintained.

        +

        If the WeakRef returns a _target_ value that is not *undefined*, then this _target_ value should not be garbage collected until the current execution of ECMAScript code has completed. The AddToKeptObjects operation makes sure read consistency is maintained.

        
                     let target = { foo() {} };
        @@ -43859,7 +46213,7 @@ 

        Properties of WeakRef Instances

        FinalizationRegistry Objects

        -

        A FinalizationRegistry is an object that manages registration and unregistration of cleanup operations that are performed when target objects are garbage collected.

        +

        A FinalizationRegistry is an object that manages registration and unregistration of cleanup operations that are performed when target objects and symbols are garbage collected.

        The FinalizationRegistry Constructor

        @@ -43938,9 +46292,9 @@

        FinalizationRegistry.prototype.register ( _target_, _heldValue_ [ , _unregis 1. Let _finalizationRegistry_ be the *this* value. 1. Perform ? RequireInternalSlot(_finalizationRegistry_, [[Cells]]). - 1. If _target_ is not an Object, throw a *TypeError* exception. + 1. If CanBeHeldWeakly(_target_) is *false*, throw a *TypeError* exception. 1. If SameValue(_target_, _heldValue_) is *true*, throw a *TypeError* exception. - 1. If _unregisterToken_ is not an Object, then + 1. If CanBeHeldWeakly(_unregisterToken_) is *false*, then 1. If _unregisterToken_ is not *undefined*, throw a *TypeError* exception. 1. Set _unregisterToken_ to ~empty~. 1. Let _cell_ be the Record { [[WeakRefTarget]]: _target_, [[HeldValue]]: _heldValue_, [[UnregisterToken]]: _unregisterToken_ }. @@ -43949,7 +46303,7 @@

        FinalizationRegistry.prototype.register ( _target_, _heldValue_ [ , _unregis -

        Based on the algorithms and definitions in this specification, _cell_.[[HeldValue]] is live when _cell_ is in _finalizationRegistry_.[[Cells]]; however, this does not necessarily mean that _cell_.[[UnregisterToken]] or _cell_.[[Target]] are live. For example, registering an object with itself as its unregister token would not keep the object alive forever.

        +

        Based on the algorithms and definitions in this specification, _cell_.[[HeldValue]] is live when _finalizationRegistry_.[[Cells]] contains _cell_; however, this does not necessarily mean that _cell_.[[UnregisterToken]] or _cell_.[[Target]] are live. For example, registering an object with itself as its unregister token would not keep the object alive forever.

        @@ -43959,7 +46313,7 @@

        FinalizationRegistry.prototype.unregister ( _unregisterToken_ )

        1. Let _finalizationRegistry_ be the *this* value. 1. Perform ? RequireInternalSlot(_finalizationRegistry_, [[Cells]]). - 1. If _unregisterToken_ is not an Object, throw a *TypeError* exception. + 1. If CanBeHeldWeakly(_unregisterToken_) is *false*, throw a *TypeError* exception. 1. Let _removed_ be *false*. 1. For each Record { [[WeakRefTarget]], [[HeldValue]], [[UnregisterToken]] } _cell_ of _finalizationRegistry_.[[Cells]], do 1. If _cell_.[[UnregisterToken]] is not ~empty~ and SameValue(_cell_.[[UnregisterToken]], _unregisterToken_) is *true*, then @@ -44450,8 +46804,8 @@

        1. IfAbruptRejectPromise(_value_, _promiseCapability_). 1. Let _valueWrapper_ be Completion(PromiseResolve(%Promise%, _value_)). 1. IfAbruptRejectPromise(_valueWrapper_, _promiseCapability_). - 1. Let _unwrap_ be a new Abstract Closure with parameters (_value_) that captures _done_ and performs the following steps when called: - 1. Return CreateIterResultObject(_value_, _done_). + 1. Let _unwrap_ be a new Abstract Closure with parameters (_v_) that captures _done_ and performs the following steps when called: + 1. Return CreateIterResultObject(_v_, _done_). 1. Let _onFulfilled_ be CreateBuiltinFunction(_unwrap_, 1, *""*, « »). 1. NOTE: _onFulfilled_ is used when processing the *"value"* property of an IteratorResult object in order to wait for its value if it is a promise and re-package the result in a new "unwrapped" IteratorResult object. 1. Perform PerformPromiseThen(_valueWrapper_, _onFulfilled_, *undefined*, _promiseCapability_). @@ -45001,15 +47355,16 @@

        IfAbruptRejectPromise ( _value_, _capability_ )

        1. If _value_ is an abrupt completion, then 1. Perform ? Call(_capability_.[[Reject]], *undefined*, « _value_.[[Value]] »). 1. Return _capability_.[[Promise]]. - 1. Else, set _value_ to _value_.[[Value]]. + 1. Else, + 1. Set _value_ to ! _value_.

        PromiseReaction Records

        -

        The PromiseReaction is a Record value used to store information about how a promise should react when it becomes resolved or rejected with a given value. PromiseReaction records are created by the PerformPromiseThen abstract operation, and are used by the Abstract Closure returned by NewPromiseReactionJob.

        -

        PromiseReaction records have the fields listed in .

        +

        A PromiseReaction Record is a Record value used to store information about how a promise should react when it becomes resolved or rejected with a given value. PromiseReaction Records are created by the PerformPromiseThen abstract operation, and are used by the Abstract Closure returned by NewPromiseReactionJob.

        +

        PromiseReaction Records have the fields listed in .

        @@ -45039,7 +47394,7 @@

        PromiseReaction Records

        [[Type]] - + @@ -46732,9 +49069,9 @@

        1. Let _genContext_ be the running execution context. 1. Set the Generator component of _genContext_ to _generator_. 1. Let _closure_ be a new Abstract Closure with no parameters that captures _generatorBody_ and performs the following steps when called: - 1. Let _genContext_ be the running execution context. - 1. Let _env_ be _genContext_'s LexicalEnvironment. - 1. Let _generator_ be the Generator component of _genContext_. + 1. Let _acGenContext_ be the running execution context. + 1. Let _env_ be _acGenContext_'s LexicalEnvironment. + 1. Let _acGenerator_ be the Generator component of _acGenContext_. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). 1. Else, @@ -46742,16 +49079,16 @@

        1. Let _result_ be Completion(_generatorBody_()). 1. Set _result_ to Completion(DisposeResources(_env_.[[DisposeCapability]], _result_)). 1. Assert: If we return here, the async generator either threw an exception or performed either an implicit or explicit return. - 1. Remove _genContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. - 1. Set _generator_.[[AsyncGeneratorState]] to ~completed~. - 1. If _result_.[[Type]] is ~normal~, set _result_ to NormalCompletion(*undefined*). - 1. If _result_.[[Type]] is ~return~, set _result_ to NormalCompletion(_result_.[[Value]]). - 1. Perform AsyncGeneratorCompleteStep(_generator_, _result_, *true*). - 1. Perform AsyncGeneratorDrainQueue(_generator_). + 1. Remove _acGenContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Set _acGenerator_.[[AsyncGeneratorState]] to ~completed~. + 1. If _result_ is a normal completion, set _result_ to NormalCompletion(*undefined*). + 1. If _result_ is a return completion, set _result_ to NormalCompletion(_result_.[[Value]]). + 1. Perform AsyncGeneratorCompleteStep(_acGenerator_, _result_, *true*). + 1. Perform AsyncGeneratorDrainQueue(_acGenerator_). 1. Return *undefined*. 1. Set the code evaluation state of _genContext_ such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. 1. Set _generator_.[[AsyncGeneratorContext]] to _genContext_. - 1. Set _generator_.[[AsyncGeneratorState]] to ~suspendedStart~. + 1. Set _generator_.[[AsyncGeneratorState]] to ~suspended-start~. 1. Set _generator_.[[AsyncGeneratorQueue]] to a new empty List. 1. Return ~unused~. @@ -46770,7 +49107,7 @@

        1. Perform ? RequireInternalSlot(_generator_, [[AsyncGeneratorContext]]). 1. Perform ? RequireInternalSlot(_generator_, [[AsyncGeneratorState]]). 1. Perform ? RequireInternalSlot(_generator_, [[AsyncGeneratorQueue]]). - 1. If _generator_.[[GeneratorBrand]] is not the same value as _generatorBrand_, throw a *TypeError* exception. + 1. If _generator_.[[GeneratorBrand]] is not _generatorBrand_, throw a *TypeError* exception. 1. Return ~unused~. @@ -46804,16 +49141,15 @@

        - 1. Let _queue_ be _generator_.[[AsyncGeneratorQueue]]. - 1. Assert: _queue_ is not empty. - 1. Let _next_ be the first element of _queue_. - 1. Remove the first element from _queue_. + 1. Assert: _generator_.[[AsyncGeneratorQueue]] is not empty. + 1. Let _next_ be the first element of _generator_.[[AsyncGeneratorQueue]]. + 1. Remove the first element from _generator_.[[AsyncGeneratorQueue]]. 1. Let _promiseCapability_ be _next_.[[Capability]]. 1. Let _value_ be _completion_.[[Value]]. - 1. If _completion_.[[Type]] is ~throw~, then + 1. If _completion_ is a throw completion, then 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _value_ »). 1. Else, - 1. Assert: _completion_.[[Type]] is ~normal~. + 1. Assert: _completion_ is a normal completion. 1. If _realm_ is present, then 1. Let _oldRealm_ be the running execution context's Realm. 1. Set the running execution context's Realm to _realm_. @@ -46836,7 +49172,7 @@

        - 1. Assert: _generator_.[[AsyncGeneratorState]] is either ~suspendedStart~ or ~suspendedYield~. + 1. Assert: _generator_.[[AsyncGeneratorState]] is either ~suspended-start~ or ~suspended-yield~. 1. Let _genContext_ be _generator_.[[AsyncGeneratorContext]]. 1. Let _callerContext_ be the running execution context. 1. Suspend _callerContext_. @@ -46858,10 +49194,10 @@

        - 1. If _resumptionValue_.[[Type]] is not ~return~, return ? _resumptionValue_. + 1. If _resumptionValue_ is not a return completion, return ? _resumptionValue_. 1. Let _awaited_ be Completion(Await(_resumptionValue_.[[Value]])). - 1. If _awaited_.[[Type]] is ~throw~, return ? _awaited_. - 1. Assert: _awaited_.[[Type]] is ~normal~. + 1. If _awaited_ is a throw completion, return ? _awaited_. + 1. Assert: _awaited_ is a normal completion. 1. Return Completion Record { [[Type]]: ~return~, [[Value]]: _awaited_.[[Value]], [[Target]]: ~empty~ }. @@ -46891,7 +49227,7 @@

        1. Let _resumptionValue_ be Completion(_toYield_.[[Completion]]). 1. Return ? AsyncGeneratorUnwrapYieldResumption(_resumptionValue_). 1. Else, - 1. Set _generator_.[[AsyncGeneratorState]] to ~suspendedYield~. + 1. Set _generator_.[[AsyncGeneratorState]] to ~suspended-yield~. 1. Remove _genContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. 1. Let _callerContext_ be the running execution context. 1. Resume _callerContext_ passing *undefined*. If _genContext_ is ever resumed again, let _resumptionValue_ be the Completion Record with which it is resumed. @@ -46913,7 +49249,7 @@

        1. Assert: _queue_ is not empty. 1. Let _next_ be the first element of _queue_. 1. Let _completion_ be Completion(_next_.[[Completion]]). - 1. Assert: _completion_.[[Type]] is ~return~. + 1. Assert: _completion_ is a return completion. 1. Let _promise_ be ? PromiseResolve(%Promise%, _completion_.[[Value]]). 1. Let _fulfilledClosure_ be a new Abstract Closure with parameters (_value_) that captures _generator_ and performs the following steps when called: 1. Set _generator_.[[AsyncGeneratorState]] to ~completed~. @@ -46952,12 +49288,12 @@

        1. Repeat, while _done_ is *false*, 1. Let _next_ be the first element of _queue_. 1. Let _completion_ be Completion(_next_.[[Completion]]). - 1. If _completion_.[[Type]] is ~return~, then + 1. If _completion_ is a return completion, then 1. Set _generator_.[[AsyncGeneratorState]] to ~awaiting-return~. 1. Perform ! AsyncGeneratorAwaitReturn(_generator_). 1. Set _done_ to *true*. 1. Else, - 1. If _completion_.[[Type]] is ~normal~, then + 1. If _completion_ is a normal completion, then 1. Set _completion_ to NormalCompletion(*undefined*). 1. Perform AsyncGeneratorCompleteStep(_generator_, _completion_, *true*). 1. If _queue_ is empty, set _done_ to *true*. @@ -47033,15 +49369,11 @@

        Properties of the AsyncFunction Constructor

        • is a standard built-in function object that inherits from the Function constructor.
        • has a [[Prototype]] internal slot whose value is %Function%.
        • +
        • has a *"length"* property whose value is *1*𝔽.
        • has a *"name"* property whose value is *"AsyncFunction"*.
        • has the following properties:
        - -

        AsyncFunction.length

        -

        This is a data property with a value of 1. This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        -
        -

        AsyncFunction.prototype

        The initial value of `AsyncFunction.prototype` is the AsyncFunction prototype object.

        @@ -47063,7 +49395,7 @@

        Properties of the AsyncFunction Prototype Object

        AsyncFunction.prototype.constructor

        -

        The initial value of `AsyncFunction.prototype.constructor` is %AsyncFunction%

        +

        The initial value of `AsyncFunction.prototype.constructor` is %AsyncFunction%.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        @@ -47126,21 +49458,20 @@

        - 1. Assert: _promiseCapability_ is a PromiseCapability Record. 1. Let _runningContext_ be the running execution context. 1. Let _closure_ be a new Abstract Closure with no parameters that captures _promiseCapability_ and _asyncBody_ and performs the following steps when called: - 1. Let _asyncContext_ be the running execution context. - 1. Let _env_ be _asyncContext_'s LexicalEnvironment. + 1. Let _acAsyncContext_ be the running execution context. + 1. Let _env_ be _acAsyncContext_'s LexicalEnvironment. 1. Let _result_ be Completion(Evaluation of _asyncBody_). 1. Set _result_ to Completion(DisposeResources(_env_.[[DisposeCapability]], _result_)). 1. Assert: If we return here, the async function either threw an exception or performed an implicit or explicit return; all awaiting is done. - 1. Remove _asyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. - 1. If _result_.[[Type]] is ~normal~, then + 1. Remove _acAsyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. If _result_ is a normal completion, then 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « *undefined* »). - 1. Else if _result_.[[Type]] is ~return~, then + 1. Else if _result_ is a return completion, then 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _result_.[[Value]] »). 1. Else, - 1. Assert: _result_.[[Type]] is ~throw~. + 1. Assert: _result_ is a throw completion. 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _result_.[[Value]] »). 1. [id="step-asyncblockstart-return-undefined"] Return ~unused~. 1. Set the code evaluation state of _asyncContext_ such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. @@ -47163,11 +49494,11 @@

        1. Let _asyncContext_ be the running execution context. 1. Let _promise_ be ? PromiseResolve(%Promise%, _value_). - 1. Let _fulfilledClosure_ be a new Abstract Closure with parameters (_value_) that captures _asyncContext_ and performs the following steps when called: + 1. Let _fulfilledClosure_ be a new Abstract Closure with parameters (_v_) that captures _asyncContext_ and performs the following steps when called: 1. Let _prevContext_ be the running execution context. 1. Suspend _prevContext_. 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context. - 1. Resume the suspended evaluation of _asyncContext_ using NormalCompletion(_value_) as the result of the operation that suspended it. + 1. Resume the suspended evaluation of _asyncContext_ using NormalCompletion(_v_) as the result of the operation that suspended it. 1. Assert: When we reach this step, _asyncContext_ has already been removed from the execution context stack and _prevContext_ is the currently running execution context. 1. Return *undefined*. 1. Let _onFulfilled_ be CreateBuiltinFunction(_fulfilledClosure_, 1, *""*, « »). @@ -47387,20 +49718,20 @@

        Proxy.revocable ( _target_, _handler_ )

        This function creates a revocable Proxy object.

        It performs the following steps when called:

        - 1. Let _p_ be ? ProxyCreate(_target_, _handler_). + 1. Let _proxy_ be ? ProxyCreate(_target_, _handler_). 1. Let _revokerClosure_ be a new Abstract Closure with no parameters that captures nothing and performs the following steps when called: 1. Let _F_ be the active function object. 1. Let _p_ be _F_.[[RevocableProxy]]. 1. If _p_ is *null*, return *undefined*. 1. Set _F_.[[RevocableProxy]] to *null*. - 1. Assert: _p_ is a Proxy object. + 1. Assert: _p_ is a Proxy exotic object. 1. Set _p_.[[ProxyTarget]] to *null*. 1. Set _p_.[[ProxyHandler]] to *null*. 1. Return *undefined*. 1. Let _revoker_ be CreateBuiltinFunction(_revokerClosure_, 0, *""*, « [[RevocableProxy]] »). - 1. Set _revoker_.[[RevocableProxy]] to _p_. + 1. Set _revoker_.[[RevocableProxy]] to _proxy_. 1. Let _result_ be OrdinaryObjectCreate(%Object.prototype%). - 1. Perform ! CreateDataPropertyOrThrow(_result_, *"proxy"*, _p_). + 1. Perform ! CreateDataPropertyOrThrow(_result_, *"proxy"*, _proxy_). 1. Perform ! CreateDataPropertyOrThrow(_result_, *"revoke"*, _revoker_). 1. Return _result_. @@ -47446,7 +49777,7 @@

        Memory Model Fundamentals

        - + @@ -47481,7 +49812,7 @@

        Memory Model Fundamentals

        - + @@ -47521,7 +49852,7 @@

        Memory Model Fundamentals

        - + @@ -47787,7 +50118,7 @@

        Relations of Candidate Executions

        agent-order

        For a candidate execution _execution_, _execution_.[[AgentOrder]] is a Relation on events that satisfies the following.

          -
        • For each pair (_E_, _D_) in EventSet(_execution_), (_E_, _D_) is in _execution_.[[AgentOrder]] if there is some Agent Events Record _aer_ in _execution_.[[EventsRecords]] such that _E_ and _D_ are in _aer_.[[EventList]] and _E_ is before _D_ in List order of _aer_.[[EventList]].
        • +
        • For each pair (_E_, _D_) in EventSet(_execution_), _execution_.[[AgentOrder]] contains (_E_, _D_) if there is some Agent Events Record _aer_ in _execution_.[[EventsRecords]] such that _E_ and _D_ are in _aer_.[[EventList]] and _E_ is before _D_ in List order of _aer_.[[EventList]].
        @@ -47813,7 +50144,7 @@

        reads-bytes-from

        reads-from

        For a candidate execution _execution_, _execution_.[[ReadsFrom]] is the least Relation on events that satisfies the following.

          -
        • For each pair (_R_, _W_) in SharedDataBlockEventSet(_execution_), (_R_, _W_) is in _execution_.[[ReadsFrom]] if _W_ is in _execution_.[[ReadsBytesFrom]](_R_).
        • +
        • For each pair (_R_, _W_) in SharedDataBlockEventSet(_execution_), _execution_.[[ReadsFrom]] contains (_R_, _W_) if _execution_.[[ReadsBytesFrom]](_R_) contains _W_.
        @@ -47821,7 +50152,7 @@

        reads-from

        host-synchronizes-with

        For a candidate execution _execution_, _execution_.[[HostSynchronizesWith]] is a host-provided strict partial order on host-specific events that satisfies at least the following.

          -
        • If (_E_, _D_) is in _execution_.[[HostSynchronizesWith]], _E_ and _D_ are in HostEventSet(_execution_).
        • +
        • If _execution_.[[HostSynchronizesWith]] contains (_E_, _D_), _E_ and _D_ are in HostEventSet(_execution_).
        • There is no cycle in the union of _execution_.[[HostSynchronizesWith]] and _execution_.[[AgentOrder]].
        @@ -47838,15 +50169,15 @@

        synchronizes-with

        For a candidate execution _execution_, _execution_.[[SynchronizesWith]] is the least Relation on events that satisfies the following.

        • - For each pair (_R_, _W_) in _execution_.[[ReadsFrom]], (_W_, _R_) is in _execution_.[[SynchronizesWith]] if _R_.[[Order]] is ~SeqCst~, _W_.[[Order]] is ~SeqCst~, and _R_ and _W_ have equal ranges. + For each pair (_R_, _W_) in _execution_.[[ReadsFrom]], _execution_.[[SynchronizesWith]] contains (_W_, _R_) if _R_.[[Order]] is ~seq-cst~, _W_.[[Order]] is ~seq-cst~, and _R_ and _W_ have equal ranges.
        • For each element _eventsRecord_ of _execution_.[[EventsRecords]], the following is true.
            -
          • For each pair (_S_, _Sw_) in _eventsRecord_.[[AgentSynchronizesWith]], (_S_, _Sw_) is in _execution_.[[SynchronizesWith]].
          • +
          • For each pair (_S_, _Sw_) in _eventsRecord_.[[AgentSynchronizesWith]], _execution_.[[SynchronizesWith]] contains (_S_, _Sw_).
        • -
        • For each pair (_E_, _D_) in _execution_.[[HostSynchronizesWith]], (_E_, _D_) is in _execution_.[[SynchronizesWith]].
        • +
        • For each pair (_E_, _D_) in _execution_.[[HostSynchronizesWith]], _execution_.[[SynchronizesWith]] contains (_E_, _D_).
        @@ -47854,11 +50185,11 @@

        synchronizes-with

        -

        ~Init~ events do not participate in synchronizes-with, and are instead constrained directly by happens-before.

        +

        ~init~ events do not participate in synchronizes-with, and are instead constrained directly by happens-before.

        -

        Not all ~SeqCst~ events related by reads-from are related by synchronizes-with. Only events that also have equal ranges are related by synchronizes-with.

        +

        Not all ~seq-cst~ events related by reads-from are related by synchronizes-with. Only events that also have equal ranges are related by synchronizes-with.

        @@ -47871,10 +50202,10 @@

        happens-before

        For a candidate execution _execution_, _execution_.[[HappensBefore]] is the least Relation on events that satisfies the following.

          -
        • For each pair (_E_, _D_) in _execution_.[[AgentOrder]], (_E_, _D_) is in _execution_.[[HappensBefore]].
        • -
        • For each pair (_E_, _D_) in _execution_.[[SynchronizesWith]], (_E_, _D_) is in _execution_.[[HappensBefore]].
        • -
        • For each pair (_E_, _D_) in SharedDataBlockEventSet(_execution_), (_E_, _D_) is in _execution_.[[HappensBefore]] if _E_.[[Order]] is ~Init~ and _E_ and _D_ have overlapping ranges.
        • -
        • For each pair (_E_, _D_) in EventSet(_execution_), (_E_, _D_) is in _execution_.[[HappensBefore]] if there is an event _F_ such that the pairs (_E_, _F_) and (_F_, _D_) are in _execution_.[[HappensBefore]].
        • +
        • For each pair (_E_, _D_) in _execution_.[[AgentOrder]], _execution_.[[HappensBefore]] contains (_E_, _D_).
        • +
        • For each pair (_E_, _D_) in _execution_.[[SynchronizesWith]], _execution_.[[HappensBefore]] contains (_E_, _D_).
        • +
        • For each pair (_E_, _D_) in SharedDataBlockEventSet(_execution_), _execution_.[[HappensBefore]] contains (_E_, _D_) if _E_.[[Order]] is ~init~ and _E_ and _D_ have overlapping ranges.
        • +
        • For each pair (_E_, _D_) in EventSet(_execution_), _execution_.[[HappensBefore]] contains (_E_, _D_) if there is an event _F_ such that the pairs (_E_, _F_) and (_F_, _D_) are in _execution_.[[HappensBefore]].
        @@ -47912,7 +50243,7 @@

        Coherent Reads

        1. Let _Ws_ be _execution_.[[ReadsBytesFrom]](_R_). 1. Let _byteLocation_ be _R_.[[ByteIndex]]. 1. For each element _W_ of _Ws_, do - 1. If (_R_, _W_) is in _execution_.[[HappensBefore]], then + 1. If _execution_.[[HappensBefore]] contains (_R_, _W_), then 1. Return *false*. 1. If there exists a WriteSharedMemory or ReadModifyWriteSharedMemory event _V_ that has _byteLocation_ in its range such that the pairs (_W_, _V_) and (_V_, _R_) are in _execution_.[[HappensBefore]], then 1. Return *false*. @@ -47928,8 +50259,8 @@

        Tear Free Reads

        1. For each ReadSharedMemory or ReadModifyWriteSharedMemory event _R_ of SharedDataBlockEventSet(_execution_), do 1. If _R_.[[NoTear]] is *true*, then 1. Assert: The remainder of dividing _R_.[[ByteIndex]] by _R_.[[ElementSize]] is 0. - 1. For each event _W_ such that (_R_, _W_) is in _execution_.[[ReadsFrom]] and _W_.[[NoTear]] is *true*, do - 1. If _R_ and _W_ have equal ranges and there exists an event _V_ such that _V_ and _W_ have equal ranges, _V_.[[NoTear]] is *true*, _W_ is not _V_, and (_R_, _V_) is in _execution_.[[ReadsFrom]], then + 1. For each event _W_ such that _execution_.[[ReadsFrom]] contains (_R_, _W_) and _W_.[[NoTear]] is *true*, do + 1. If _R_ and _W_ have equal ranges and there exists an event _V_ such that _V_ and _W_ have equal ranges, _V_.[[NoTear]] is *true*, _W_ and _V_ are not the same Shared Data Block event, and _execution_.[[ReadsFrom]] contains (_R_, _V_), then 1. Return *false*. 1. Return *true*. @@ -47946,20 +50277,20 @@

        Sequentially Consistent Atomics

        • For each pair (_E_, _D_) in _execution_.[[HappensBefore]], (_E_, _D_) is in memory-order.
        • -

          For each pair (_R_, _W_) in _execution_.[[ReadsFrom]], there is no WriteSharedMemory or ReadModifyWriteSharedMemory event _V_ in SharedDataBlockEventSet(_execution_) such that _V_.[[Order]] is ~SeqCst~, the pairs (_W_, _V_) and (_V_, _R_) are in memory-order, and any of the following conditions are true.

          +

          For each pair (_R_, _W_) in _execution_.[[ReadsFrom]], there is no WriteSharedMemory or ReadModifyWriteSharedMemory event _V_ in SharedDataBlockEventSet(_execution_) such that _V_.[[Order]] is ~seq-cst~, the pairs (_W_, _V_) and (_V_, _R_) are in memory-order, and any of the following conditions are true.

            -
          • The pair (_W_, _R_) is in _execution_.[[SynchronizesWith]], and _V_ and _R_ have equal ranges.
          • -
          • The pairs (_W_, _R_) and (_V_, _R_) are in _execution_.[[HappensBefore]], _W_.[[Order]] is ~SeqCst~, and _W_ and _V_ have equal ranges.
          • -
          • The pairs (_W_, _R_) and (_W_, _V_) are in _execution_.[[HappensBefore]], _R_.[[Order]] is ~SeqCst~, and _V_ and _R_ have equal ranges.
          • +
          • _execution_.[[SynchronizesWith]] contains the pair (_W_, _R_), and _V_ and _R_ have equal ranges.
          • +
          • The pairs (_W_, _R_) and (_V_, _R_) are in _execution_.[[HappensBefore]], _W_.[[Order]] is ~seq-cst~, and _W_ and _V_ have equal ranges.
          • +
          • The pairs (_W_, _R_) and (_W_, _V_) are in _execution_.[[HappensBefore]], _R_.[[Order]] is ~seq-cst~, and _V_ and _R_ have equal ranges.
          -

          This clause additionally constrains ~SeqCst~ events on equal ranges.

          +

          This clause additionally constrains ~seq-cst~ events on equal ranges.

        • -

          For each WriteSharedMemory or ReadModifyWriteSharedMemory event _W_ in SharedDataBlockEventSet(_execution_), if _W_.[[Order]] is ~SeqCst~, then it is not the case that there is an infinite number of ReadSharedMemory or ReadModifyWriteSharedMemory events in SharedDataBlockEventSet(_execution_) with equal range that is memory-order before _W_.

          +

          For each WriteSharedMemory or ReadModifyWriteSharedMemory event _W_ in SharedDataBlockEventSet(_execution_), if _W_.[[Order]] is ~seq-cst~, then it is not the case that there is an infinite number of ReadSharedMemory or ReadModifyWriteSharedMemory events in SharedDataBlockEventSet(_execution_) with equal range that is memory-order before _W_.

          -

          This clause together with the forward progress guarantee on agents ensure the liveness condition that ~SeqCst~ writes become visible to ~SeqCst~ reads with equal range in finite time.

          +

          This clause together with the forward progress guarantee on agents ensure the liveness condition that ~seq-cst~ writes become visible to ~seq-cst~ reads with equal range in finite time.

        @@ -47989,11 +50320,11 @@

        Valid Executions

        Races

        For an execution _execution_, two events _E_ and _D_ in SharedDataBlockEventSet(_execution_) are in a race if the following algorithm returns *true*.

        - 1. If _E_ is not _D_, then + 1. If _E_ and _D_ are not the same Shared Data Block event, then 1. If the pairs (_E_, _D_) and (_D_, _E_) are not in _execution_.[[HappensBefore]], then 1. If _E_ and _D_ are both WriteSharedMemory or ReadModifyWriteSharedMemory events and _E_ and _D_ do not have disjoint ranges, then 1. Return *true*. - 1. If either (_E_, _D_) or (_D_, _E_) is in _execution_.[[ReadsFrom]], then + 1. If _execution_.[[ReadsFrom]] contains either (_E_, _D_) or (_D_, _E_), then 1. Return *true*. 1. Return *false*. @@ -48004,7 +50335,7 @@

        Data Races

        For an execution _execution_, two events _E_ and _D_ in SharedDataBlockEventSet(_execution_) are in a data race if the following algorithm returns *true*.

        1. If _E_ and _D_ are in a race in _execution_, then - 1. If _E_.[[Order]] is not ~SeqCst~ or _D_.[[Order]] is not ~SeqCst~, then + 1. If _E_.[[Order]] is not ~seq-cst~ or _D_.[[Order]] is not ~seq-cst~, then 1. Return *true*. 1. If _E_ and _D_ have overlapping ranges, then 1. Return *true*. @@ -48035,8 +50366,8 @@

        Shared Memory Guidelines

        Any transformation of an agent-order slice that is valid in the absence of shared memory is valid in the presence of shared memory, with the following exceptions.

        • -

          Atomics are carved in stone: Program transformations must not cause the ~SeqCst~ events in an agent-order slice to be reordered with its ~Unordered~ operations, nor its ~SeqCst~ operations to be reordered with each other, nor may a program transformation remove a ~SeqCst~ operation from the agent-order.

          -

          (In practice, the prohibition on reorderings forces a compiler to assume that every ~SeqCst~ operation is a synchronization and included in the final memory-order, which it would usually have to assume anyway in the absence of inter-agent program analysis. It also forces the compiler to assume that every call where the callee's effects on the memory-order are unknown may contain ~SeqCst~ operations.)

          +

          Atomics are carved in stone: Program transformations must not cause the ~seq-cst~ events in an agent-order slice to be reordered with its ~unordered~ operations, nor its ~seq-cst~ operations to be reordered with each other, nor may a program transformation remove a ~seq-cst~ operation from the agent-order.

          +

          (In practice, the prohibition on reorderings forces a compiler to assume that every ~seq-cst~ operation is a synchronization and included in the final memory-order, which it would usually have to assume anyway in the absence of inter-agent program analysis. It also forces the compiler to assume that every call where the callee's effects on the memory-order are unknown may contain ~seq-cst~ operations.)

        • Reads must be stable: Any given shared memory read must only observe a single value in an execution.

          @@ -48048,7 +50379,7 @@

          Shared Memory Guidelines

        • Possible read values must be non-empty: Program transformations cannot cause the possible read values of a shared memory read to become empty.

          -

          (Counterintuitively, this rule in effect restricts transformations on writes, because writes have force in memory model insofar as to be read by read events. For example, writes may be moved and coalesced and sometimes reordered between two ~SeqCst~ operations, but the transformation may not remove every write that updates a location; some write must be preserved.)

          +

          (Counterintuitively, this rule in effect restricts transformations on writes, because writes have force in memory model insofar as to be read by read events. For example, writes may be moved and coalesced and sometimes reordered between two ~seq-cst~ operations, but the transformation may not remove every write that updates a location; some write must be preserved.)

        Examples of transformations that remain valid are: merging multiple non-atomic reads from the same location, reordering non-atomic reads, introducing speculative non-atomic reads, merging multiple non-atomic writes to the same location, reordering non-atomic writes to different locations, and hoisting non-atomic reads out of loops even if that affects termination. Note in general that aliased TypedArrays make it hard to prove that locations are different.

        @@ -48072,7 +50403,7 @@

        Shared Memory Guidelines

      • Non-lock-free atomics compile to a spinlock acquire, a full fence, a series of non-atomic load and store instructions, a full fence, and a spinlock release.
      • That mapping is correct so long as an atomic operation on an address range does not race with a non-atomic write or with an atomic operation of different size. However, that is all we need: the memory model effectively demotes the atomic operations involved in a race to non-atomic status. On the other hand, the naive mapping is quite strong: it allows atomic operations to be used as sequentially consistent fences, which the memory model does not actually guarantee.

        -

        A number of local improvements to those basic patterns are also intended to be legal:

        +

        Local improvements to those basic patterns are also allowed, subject to the constraints of the memory model. For example:

        • There are obvious platform-dependent improvements that remove redundant fences. For example, on x86 the fences around lock-free atomic loads and stores can always be omitted except for the fence following a store, and no fence is needed for lock-free read-modify-write instructions, as these all use LOCK-prefixed instructions. On many platforms there are fences of several strengths, and weaker fences can be used in certain contexts without destroying sequential consistency.
        • Most modern platforms support lock-free atomics for all the data sizes required by ECMAScript atomics. Should non-lock-free atomics be needed, the fences surrounding the body of the atomic operation can usually be folded into the lock and unlock steps. The simplest solution for non-lock-free atomics is to have a single lock word per SharedArrayBuffer.
        • @@ -48500,12 +50831,27 @@

          Regular Expressions

          - + + + + + + + + + + + + + + + + @@ -48525,6 +50871,15 @@

          HTML-like Comments

          The syntax and semantics of is extended as follows except that this extension is not allowed when parsing source text using the goal symbol |Module|:

          Syntax

          + InputElementHashbangOrRegExp :: + WhiteSpace + LineTerminator + Comment + CommonToken + HashbangComment + RegularExpressionLiteral + HTMLCloseComment + Comment :: MultiLineComment SingleLineComment @@ -48579,84 +50934,84 @@

          Regular Expressions Patterns

          This alternative pattern grammar and semantics only changes the syntax and semantics of BMP patterns. The following grammar extensions include productions parameterized with the [UnicodeMode] parameter. However, none of these extensions change the syntax of Unicode patterns recognized when parsing with the [UnicodeMode] parameter present on the goal symbol.

          Syntax

          - Term[UnicodeMode, N] :: - [+UnicodeMode] Assertion[+UnicodeMode, ?N] - [+UnicodeMode] Atom[+UnicodeMode, ?N] Quantifier - [+UnicodeMode] Atom[+UnicodeMode, ?N] - [~UnicodeMode] QuantifiableAssertion[?N] Quantifier - [~UnicodeMode] Assertion[~UnicodeMode, ?N] - [~UnicodeMode] ExtendedAtom[?N] Quantifier - [~UnicodeMode] ExtendedAtom[?N] - - Assertion[UnicodeMode, N] :: + Term[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: + [+UnicodeMode] Assertion[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] + [+UnicodeMode] Atom[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] Quantifier + [+UnicodeMode] Atom[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] + [~UnicodeMode] QuantifiableAssertion[?NamedCaptureGroups] Quantifier + [~UnicodeMode] Assertion[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] + [~UnicodeMode] ExtendedAtom[?NamedCaptureGroups] Quantifier + [~UnicodeMode] ExtendedAtom[?NamedCaptureGroups] + + Assertion[UnicodeMode, UnicodeSetsMode, NamedCaptureGroups] :: `^` `$` - `\` `b` - `\` `B` - [+UnicodeMode] `(` `?` `=` Disjunction[+UnicodeMode, ?N] `)` - [+UnicodeMode] `(` `?` `!` Disjunction[+UnicodeMode, ?N] `)` - [~UnicodeMode] QuantifiableAssertion[?N] - `(` `?` `<=` Disjunction[?UnicodeMode, ?N] `)` - `(` `?` `<!` Disjunction[?UnicodeMode, ?N] `)` - - QuantifiableAssertion[N] :: - `(` `?` `=` Disjunction[~UnicodeMode, ?N] `)` - `(` `?` `!` Disjunction[~UnicodeMode, ?N] `)` - - ExtendedAtom[N] :: + `\b` + `\B` + [+UnicodeMode] `(?=` Disjunction[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + [+UnicodeMode] `(?!` Disjunction[+UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + [~UnicodeMode] QuantifiableAssertion[?NamedCaptureGroups] + `(?<=` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + `(?<!` Disjunction[?UnicodeMode, ?UnicodeSetsMode, ?NamedCaptureGroups] `)` + + QuantifiableAssertion[NamedCaptureGroups] :: + `(?=` Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] `)` + `(?!` Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] `)` + + ExtendedAtom[NamedCaptureGroups] :: `.` - `\` AtomEscape[~UnicodeMode, ?N] + `\` AtomEscape[~UnicodeMode, ?NamedCaptureGroups] `\` [lookahead == `c`] - CharacterClass[~UnicodeMode] - `(` GroupSpecifier[~UnicodeMode]? Disjunction[~UnicodeMode, ?N] `)` - `(` `?` `:` Disjunction[~UnicodeMode, ?N] `)` + CharacterClass[~UnicodeMode, ~UnicodeSetsMode] + `(` GroupSpecifier[~UnicodeMode]? Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] `)` + `(?:` Disjunction[~UnicodeMode, ~UnicodeSetsMode, ?NamedCaptureGroups] `)` InvalidBracedQuantifier ExtendedPatternCharacter InvalidBracedQuantifier :: `{` DecimalDigits[~Sep] `}` - `{` DecimalDigits[~Sep] `,` `}` + `{` DecimalDigits[~Sep] `,}` `{` DecimalDigits[~Sep] `,` DecimalDigits[~Sep] `}` ExtendedPatternCharacter :: SourceCharacter but not one of `^` `$` `\` `.` `*` `+` `?` `(` `)` `[` `|` - AtomEscape[UnicodeMode, N] :: + AtomEscape[UnicodeMode, NamedCaptureGroups] :: [+UnicodeMode] DecimalEscape [~UnicodeMode] DecimalEscape [> but only if the CapturingGroupNumber of |DecimalEscape| is ≤ CountLeftCapturingParensWithin(the |Pattern| containing |DecimalEscape|)] CharacterClassEscape[?UnicodeMode] - CharacterEscape[?UnicodeMode, ?N] - [+N] `k` GroupName[?UnicodeMode] + CharacterEscape[?UnicodeMode, ?NamedCaptureGroups] + [+NamedCaptureGroups] `k` GroupName[?UnicodeMode] - CharacterEscape[UnicodeMode, N] :: + CharacterEscape[UnicodeMode, NamedCaptureGroups] :: ControlEscape `c` AsciiLetter `0` [lookahead ∉ DecimalDigit] HexEscapeSequence RegExpUnicodeEscapeSequence[?UnicodeMode] [~UnicodeMode] LegacyOctalEscapeSequence - IdentityEscape[?UnicodeMode, ?N] + IdentityEscape[?UnicodeMode, ?NamedCaptureGroups] - IdentityEscape[UnicodeMode, N] :: + IdentityEscape[UnicodeMode, NamedCaptureGroups] :: [+UnicodeMode] SyntaxCharacter [+UnicodeMode] `/` - [~UnicodeMode] SourceCharacterIdentityEscape[?N] + [~UnicodeMode] SourceCharacterIdentityEscape[?NamedCaptureGroups] - SourceCharacterIdentityEscape[N] :: - [~N] SourceCharacter but not `c` - [+N] SourceCharacter but not one of `c` or `k` + SourceCharacterIdentityEscape[NamedCaptureGroups] :: + [~NamedCaptureGroups] SourceCharacter but not `c` + [+NamedCaptureGroups] SourceCharacter but not one of `c` or `k` - ClassAtomNoDash[UnicodeMode, N] :: + ClassAtomNoDash[UnicodeMode, NamedCaptureGroups] :: SourceCharacter but not one of `\` or `]` or `-` - `\` ClassEscape[?UnicodeMode, ?N] + `\` ClassEscape[?UnicodeMode, ?NamedCaptureGroups] `\` [lookahead == `c`] - ClassEscape[UnicodeMode, N] :: + ClassEscape[UnicodeMode, NamedCaptureGroups] :: `b` [+UnicodeMode] `-` [~UnicodeMode] `c` ClassControlLetter CharacterClassEscape[?UnicodeMode] - CharacterEscape[?UnicodeMode, ?N] + CharacterEscape[?UnicodeMode, ?NamedCaptureGroups] ClassControlLetter :: DecimalDigit @@ -48676,22 +51031,22 @@

          Static Semantics: Early Errors

        Additionally, the rules for the following productions are modified with the addition of the highlighted text:

        - NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassRanges + NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassContents
        • It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *true* or IsCharacterClass of the second |ClassAtom| is *true* and this production has a [UnicodeMode] parameter.
        • - It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *false* and IsCharacterClass of the second |ClassAtom| is *false* and the CharacterValue of the first |ClassAtom| is larger than the CharacterValue of the second |ClassAtom|. + It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *false*, IsCharacterClass of the second |ClassAtom| is *false*, and the CharacterValue of the first |ClassAtom| is strictly greater than the CharacterValue of the second |ClassAtom|.
        - NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassRanges + NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassContents
        • It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *true* or IsCharacterClass of |ClassAtom| is *true* and this production has a [UnicodeMode] parameter.
        • - It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *false* and IsCharacterClass of |ClassAtom| is *false* and the CharacterValue of |ClassAtomNoDash| is larger than the CharacterValue of |ClassAtom|. + It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *false*, IsCharacterClass of |ClassAtom| is *false*, and the CharacterValue of |ClassAtomNoDash| is strictly greater than the CharacterValue of |ClassAtom|.
        @@ -48744,7 +51099,7 @@

        Runtime Semantics: CompileSubpattern

        Runtime Semantics: CompileAssertion

        -

        CompileAssertion rules for the Assertion :: `(` `?` `=` Disjunction `)` and Assertion :: `(` `?` `!` Disjunction `)` productions are also used for the |QuantifiableAssertion| productions, but with |QuantifiableAssertion| substituted for |Assertion|.

        +

        CompileAssertion rules for the Assertion :: `(?=` Disjunction `)` and Assertion :: `(?!` Disjunction `)` productions are also used for the |QuantifiableAssertion| productions, but with |QuantifiableAssertion| substituted for |Assertion|.

        @@ -48768,19 +51123,19 @@

        Runtime Semantics: CompileToCharSet

        The semantics of is extended as follows:

        The following two rules replace the corresponding rules of CompileToCharSet.

        - NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassRanges + NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassContents 1. Let _A_ be CompileToCharSet of the first |ClassAtom| with argument _rer_. 1. Let _B_ be CompileToCharSet of the second |ClassAtom| with argument _rer_. - 1. Let _C_ be CompileToCharSet of |ClassRanges| with argument _rer_. + 1. Let _C_ be CompileToCharSet of |ClassContents| with argument _rer_. 1. Let _D_ be CharacterRangeOrUnion(_rer_, _A_, _B_). 1. Return the union of _D_ and _C_. - NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassRanges + NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassContents 1. Let _A_ be CompileToCharSet of |ClassAtomNoDash| with argument _rer_. 1. Let _B_ be CompileToCharSet of |ClassAtom| with argument _rer_. - 1. Let _C_ be CompileToCharSet of |ClassRanges| with argument _rer_. + 1. Let _C_ be CompileToCharSet of |ClassContents| with argument _rer_. 1. Let _D_ be CharacterRangeOrUnion(_rer_, _A_, _B_). 1. Return the union of _D_ and _C_. @@ -48810,7 +51165,7 @@

        - 1. If _rer_.[[Unicode]] is *false*, then + 1. If HasEitherUnicodeFlag(_rer_) is *false*, then 1. If _A_ does not contain exactly one character or _B_ does not contain exactly one character, then 1. Let _C_ be the CharSet containing the single character `-` U+002D (HYPHEN-MINUS). 1. Return the union of CharSets _A_, _B_ and _C_. @@ -48818,6 +51173,25 @@

        + + +

        Static Semantics: ParsePattern ( _patternText_, _u_, _v_ )

        +

        The semantics of is extended as follows:

        +

        The abstract operation ParsePattern takes arguments _patternText_ (a sequence of Unicode code points), _u_ (a Boolean), and _v_ (a Boolean). It performs the following steps when called:

        + + 1. If _v_ is *true* and _u_ is *true*, then + 1. Let _parseResult_ be a List containing one or more *SyntaxError* objects. + 1. Else if _v_ is *true*, then + 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[+UnicodeMode, +UnicodeSetsMode, +NamedCaptureGroups]|). + 1. Else if _u_ is *true*, then + 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[+UnicodeMode, ~UnicodeSetsMode, +NamedCaptureGroups]|). + 1. Else, + 1. Let _parseResult_ be ParseText(_patternText_, |Pattern[~UnicodeMode, ~UnicodeSetsMode, ~NamedCaptureGroups]|). + 1. If _parseResult_ is a Parse Node and _parseResult_ contains a |GroupName|, then + 1. Set _parseResult_ to ParseText(_patternText_, |Pattern[~UnicodeMode, ~UnicodeSetsMode, +NamedCaptureGroups]|). + 1. Return _parseResult_. + +
        @@ -48869,27 +51243,27 @@

        Additional Properties of the Global Object

        escape ( _string_ )

        This function is a property of the global object. It computes a new version of a String value in which certain code units have been replaced by a hexadecimal escape sequence.

        -

        When replacing a code unit of numeric value less than or equal to 0x00FF, a two-digit escape sequence of the form %xx is used. When replacing a code unit of numeric value greater than 0x00FF, a four-digit escape sequence of the form %uxxxx is used.

        +

        When replacing a code unit of numeric value less than or equal to 0x00FF, a two-digit escape sequence of the form %xx is used. When replacing a code unit of numeric value strictly greater than 0x00FF, a four-digit escape sequence of the form %uxxxx is used.

        It is the %escape% intrinsic object.

        It performs the following steps when called:

        1. Set _string_ to ? ToString(_string_). - 1. Let _length_ be the length of _string_. + 1. Let _len_ be the length of _string_. 1. Let _R_ be the empty String. 1. Let _unescapedSet_ be the string-concatenation of the ASCII word characters and *"@\*+-./"*. 1. Let _k_ be 0. - 1. Repeat, while _k_ < _length_, - 1. Let _char_ be the code unit at index _k_ within _string_. - 1. If _char_ is in _unescapedSet_, then - 1. Let _S_ be the String value containing the single code unit _char_. + 1. Repeat, while _k_ < _len_, + 1. Let _C_ be the code unit at index _k_ within _string_. + 1. If _unescapedSet_ contains _C_, then + 1. Let _S_ be _C_. 1. Else, - 1. Let _n_ be the numeric value of _char_. + 1. Let _n_ be the numeric value of _C_. 1. If _n_ < 256, then 1. Let _hex_ be the String representation of _n_, formatted as an uppercase hexadecimal number. - 1. Let _S_ be the string-concatenation of *"%"* and ! StringPad(_hex_, *2*𝔽, *"0"*, ~start~). + 1. Let _S_ be the string-concatenation of *"%"* and StringPad(_hex_, 2, *"0"*, ~start~). 1. Else, 1. Let _hex_ be the String representation of _n_, formatted as an uppercase hexadecimal number. - 1. Let _S_ be the string-concatenation of *"%u"* and ! StringPad(_hex_, *4*𝔽, *"0"*, ~start~). + 1. Let _S_ be the string-concatenation of *"%u"* and StringPad(_hex_, 4, *"0"*, ~start~). 1. Set _R_ to the string-concatenation of _R_ and _S_. 1. Set _k_ to _k_ + 1. 1. Return _R_. @@ -48906,26 +51280,26 @@

        unescape ( _string_ )

        It performs the following steps when called:

        1. Set _string_ to ? ToString(_string_). - 1. Let _length_ be the length of _string_. + 1. Let _len_ be the length of _string_. 1. Let _R_ be the empty String. 1. Let _k_ be 0. - 1. Repeat, while _k_ ≠ _length_, - 1. Let _c_ be the code unit at index _k_ within _string_. - 1. If _c_ is the code unit 0x0025 (PERCENT SIGN), then - 1. Let _hexEscape_ be the empty String. - 1. Let _skip_ be 0. - 1. If _k_ ≤ _length_ - 6 and the code unit at index _k_ + 1 within _string_ is the code unit 0x0075 (LATIN SMALL LETTER U), then - 1. Set _hexEscape_ to the substring of _string_ from _k_ + 2 to _k_ + 6. - 1. Set _skip_ to 5. - 1. Else if _k_ ≤ _length_ - 3, then - 1. Set _hexEscape_ to the substring of _string_ from _k_ + 1 to _k_ + 3. - 1. Set _skip_ to 2. - 1. If _hexEscape_ can be interpreted as an expansion of |HexDigits[~Sep]|, then - 1. Let _hexIntegerLiteral_ be the string-concatenation of *"0x"* and _hexEscape_. - 1. Let _n_ be ! ToNumber(_hexIntegerLiteral_). - 1. Set _c_ to the code unit whose value is ℝ(_n_). - 1. Set _k_ to _k_ + _skip_. - 1. Set _R_ to the string-concatenation of _R_ and _c_. + 1. Repeat, while _k_ < _len_, + 1. Let _C_ be the code unit at index _k_ within _string_. + 1. If _C_ is the code unit 0x0025 (PERCENT SIGN), then + 1. Let _hexDigits_ be the empty String. + 1. Let _optionalAdvance_ be 0. + 1. If _k_ + 5 < _len_ and the code unit at index _k_ + 1 within _string_ is the code unit 0x0075 (LATIN SMALL LETTER U), then + 1. Set _hexDigits_ to the substring of _string_ from _k_ + 2 to _k_ + 6. + 1. Set _optionalAdvance_ to 5. + 1. Else if _k_ + 3 ≤ _len_, then + 1. Set _hexDigits_ to the substring of _string_ from _k_ + 1 to _k_ + 3. + 1. Set _optionalAdvance_ to 2. + 1. Let _parseResult_ be ParseText(StringToCodePoints(_hexDigits_), |HexDigits[~Sep]|). + 1. If _parseResult_ is a Parse Node, then + 1. Let _n_ be the MV of _parseResult_. + 1. Set _C_ to the code unit whose numeric value is _n_. + 1. Set _k_ to _k_ + _optionalAdvance_. + 1. Set _R_ to the string-concatenation of _R_ and _C_. 1. Set _k_ to _k_ + 1. 1. Return _R_. @@ -48944,7 +51318,7 @@

        String.prototype.substr ( _start_, _length_ )

        1. Let _S_ be ? ToString(_O_). 1. Let _size_ be the length of _S_. 1. Let _intStart_ be ? ToIntegerOrInfinity(_start_). - 1. If _intStart_ is -∞, set _intStart_ to 0. + 1. If _intStart_ = -∞, set _intStart_ to 0. 1. Else if _intStart_ < 0, set _intStart_ to max(_size_ + _intStart_, 0). 1. Else, set _intStart_ to min(_intStart_, _size_). 1. If _length_ is *undefined*, let _intLength_ be _size_; otherwise let _intLength_ be ? ToIntegerOrInfinity(_length_). @@ -49134,7 +51508,9 @@

        Date.prototype.getYear ( )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. If _t_ is *NaN*, return *NaN*. 1. Return YearFromTime(LocalTime(_t_)) - *1900*𝔽. @@ -49147,19 +51523,17 @@

        Date.prototype.setYear ( _year_ )

        This method performs the following steps when called:

        - 1. Let _t_ be ? thisTimeValue(*this* value). + 1. Let _dateObject_ be the *this* value. + 1. Perform ? RequireInternalSlot(_dateObject_, [[DateValue]]). + 1. Let _t_ be _dateObject_.[[DateValue]]. 1. Let _y_ be ? ToNumber(_year_). 1. If _t_ is *NaN*, set _t_ to *+0*𝔽; otherwise, set _t_ to LocalTime(_t_). - 1. If _y_ is *NaN*, then - 1. Set the [[DateValue]] internal slot of this Date object to *NaN*. - 1. Return *NaN*. - 1. Let _yi_ be ! ToIntegerOrInfinity(_y_). - 1. If 0 ≤ _yi_ ≤ 99, let _yyyy_ be *1900*𝔽 + 𝔽(_yi_). - 1. Else, let _yyyy_ be _y_. + 1. Let _yyyy_ be MakeFullYear(_y_). 1. Let _d_ be MakeDay(_yyyy_, MonthFromTime(_t_), DateFromTime(_t_)). - 1. Let _date_ be UTC(MakeDate(_d_, TimeWithinDay(_t_))). - 1. Set the [[DateValue]] internal slot of this Date object to TimeClip(_date_). - 1. Return the value of the [[DateValue]] internal slot of this Date object. + 1. Let _date_ be MakeDate(_d_, TimeWithinDay(_t_)). + 1. Let _u_ be TimeClip(UTC(_date_)). + 1. Set _dateObject_.[[DateValue]] to _u_. + 1. Return _u_.
        @@ -49281,9 +51655,9 @@

        Changes to FunctionDeclarationInstantiation

        1. If _strict_ is *false*, then 1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of a |Block|, |CaseClause|, or |DefaultClause|, do 1. Let _F_ be StringValue of the |BindingIdentifier| of _f_. - 1. If replacing the |FunctionDeclaration| _f_ with a |VariableStatement| that has _F_ as a |BindingIdentifier| would not produce any Early Errors for _func_ and _F_ is not an element of _parameterNames_, then + 1. If replacing the |FunctionDeclaration| _f_ with a |VariableStatement| that has _F_ as a |BindingIdentifier| would not produce any Early Errors for _func_ and _parameterNames_ does not contain _F_, then 1. NOTE: A var binding for _F_ is only instantiated here if it is neither a VarDeclaredName, the name of a formal parameter, or another |FunctionDeclaration|. - 1. If _initializedBindings_ does not contain _F_ and _F_ is not *"arguments"*, then + 1. If _instantiatedVarNames_ does not contain _F_ and _F_ is not *"arguments"*, then 1. Perform ! _varEnv_.CreateMutableBinding(_F_, *false*). 1. Perform ! _varEnv_.InitializeBinding(_F_, *undefined*, ~normal~). 1. Append _F_ to _instantiatedVarNames_. @@ -49335,7 +51709,7 @@

        Changes to EvalDeclarationInstantiation

        1. Let _bindingExists_ be *false*. 1. Let _thisEnv_ be _lexEnv_. 1. Assert: The following loop will terminate. - 1. Repeat, while _thisEnv_ is not the same as _varEnv_, + 1. Repeat, while _thisEnv_ is not _varEnv_, 1. If _thisEnv_ is not an Object Environment Record, then 1. If ! _thisEnv_.HasBinding(_F_) is *true*, then 1. [id="step-evaldeclarationinstantiation-web-compat-bindingexists"] Let _bindingExists_ be *true*. @@ -49514,7 +51888,7 @@

        Initializers in ForIn Statement Heads

        1. Let _value_ be ? GetValue(_rhs_). 1. Perform ? PutValue(_lhs_, _value_). 1. Let _keyResult_ be ? ForIn/OfHeadEvaluation(« », |Expression|, ~enumerate~). - 1. Return ? ForIn/OfBodyEvaluation(|BindingIdentifier|, |Statement|, _keyResult_, ~enumerate~, ~varBinding~, _labelSet_). + 1. Return ? ForIn/OfBodyEvaluation(|BindingIdentifier|, |Statement|, _keyResult_, ~enumerate~, ~var-binding~, _labelSet_).
        @@ -49538,8 +51912,8 @@

        Changes to IsLooselyEqual

        The following steps replace step of IsLooselyEqual:

        1. Perform the following steps: - 1. If _x_ is an Object, _x_ has an [[IsHTMLDDA]] internal slot, and _y_ is either *null* or *undefined*, return *true*. - 1. If _x_ is either *null* or *undefined*, _y_ is an Object, and _y_ has an [[IsHTMLDDA]] internal slot, return *true*. + 1. If _x_ is an Object, _x_ has an [[IsHTMLDDA]] internal slot, and _y_ is either *undefined* or *null*, return *true*. + 1. If _x_ is either *undefined* or *null*, _y_ is an Object, and _y_ has an [[IsHTMLDDA]] internal slot, return *true*.
        @@ -49593,13 +51967,13 @@

        The Strict Mode of ECMAScript

        For strict functions, if an arguments object is created the binding of the local identifier `arguments` to the arguments object is immutable and hence may not be the target of an assignment expression. ().
      • - It is a *SyntaxError* if the StringValue of a |BindingIdentifier| is *"eval"* or *"arguments"* within strict mode code (). + It is a *SyntaxError* if the StringValue of a |BindingIdentifier| is either *"eval"* or *"arguments"* within strict mode code ().
      • Strict mode eval code cannot instantiate variables or functions in the variable environment of the caller to eval. Instead, a new variable environment is created and that environment is used for declaration binding instantiation for the eval code ().
      • - If *this* is evaluated within strict mode code, then the *this* value is not coerced to an object. A *this* value of *undefined* or *null* is not converted to the global object and primitive values are not converted to wrapper objects. The *this* value passed via a function call (including calls made using `Function.prototype.apply` and `Function.prototype.call`) do not coerce the passed *this* value to an object (, , ). + If *this* is evaluated within strict mode code, then the *this* value is not coerced to an object. A *this* value of either *undefined* or *null* is not converted to the global object and primitive values are not converted to wrapper objects. The *this* value passed via a function call (including calls made using `Function.prototype.apply` and `Function.prototype.call`) do not coerce the passed *this* value to an object (, , ).
      • When a `delete` operator occurs within strict mode code, a *SyntaxError* is thrown if its |UnaryExpression| is a direct reference to a variable, function argument, or function name (). @@ -49630,14 +52004,18 @@

        Host Layering Points

        Host Hooks

        HostCallJobCallback(...)

        HostEnqueueFinalizationRegistryCleanupJob(...)

        +

        HostEnqueueGenericJob(...)

        HostEnqueuePromiseJob(...)

        +

        HostEnqueueTimeoutJob(...)

        HostEnsureCanCompileStrings(...)

        HostFinalizeImportMeta(...)

        HostGetImportMetaProperties(...)

        +

        HostGrowSharedArrayBuffer(...)

        HostHasSourceTextAvailable(...)

        HostLoadImportedModule(...)

        HostMakeJobCallback(...)

        HostPromiseRejectionTracker(...)

        +

        HostResizeArrayBuffer(...)

        InitializeHostDefinedRealm(...)

        @@ -49679,7 +52057,7 @@

        Corrections and Clarifications in ECMAScript 2015 with Possible Compatibilit

        : Previous editions permitted the TimeClip abstract operation to return either *+0*𝔽 or *-0*𝔽 as the representation of a 0 time value. ECMAScript 2015 specifies that *+0*𝔽 always returned. This means that for ECMAScript 2015 the time value of a Date is never observably *-0*𝔽 and methods that return time values never return *-0*𝔽.

        : If a UTC offset representation is not present, the local time zone is used. Edition 5.1 incorrectly stated that a missing time zone should be interpreted as *"z"*.

        : If the year cannot be represented using the Date Time String Format specified in a RangeError exception is thrown. Previous editions did not specify the behaviour for that case.

        -

        : Previous editions did not specify the value returned by `Date.prototype.toString` when this time value is *NaN*. ECMAScript 2015 specifies the result to be the String value *"Invalid Date"*.

        +

        : Previous editions did not specify the value returned by `Date.prototype.toString` when the time value is *NaN*. ECMAScript 2015 specifies the result to be the String value *"Invalid Date"*.

        , : Any LineTerminator code points in the value of the *"source"* property of a RegExp instance must be expressed using an escape sequence. Edition 5.1 only required the escaping of `/`.

        , : In previous editions, the specifications for `String.prototype.match` and `String.prototype.replace` was incorrect for cases where the pattern argument was a RegExp value whose `global` flag is set. The previous specifications stated that for each attempt to match the pattern, if `lastIndex` did not change, it should be incremented by 1. The correct behaviour is that `lastIndex` should be incremented by 1 only if the pattern matched the empty String.

        : Previous editions did not specify how a *NaN* value returned by a _comparefn_ was interpreted by `Array.prototype.sort`. ECMAScript 2015 specifies that such as value is treated as if *+0*𝔽 was returned from the _comparefn_. ECMAScript 2015 also specifies that ToNumber is applied to the result returned by a _comparefn_. In previous editions, the effect of a _comparefn_ result that is not a Number value was implementation-defined. In practice, implementations call ToNumber.

        diff --git a/table-binary-unicode-properties-of-strings.html b/table-binary-unicode-properties-of-strings.html new file mode 100644 index 00000000000..3bafffaee3d --- /dev/null +++ b/table-binary-unicode-properties-of-strings.html @@ -0,0 +1,31 @@ + + Binary Unicode properties of strings +

      • - ~Fulfill~ or ~Reject~ + ~fulfill~ or ~reject~ The [[Type]] is used when [[Handler]] is ~empty~ to allow for behaviour specific to the settlement type. @@ -45256,10 +47611,6 @@

        description
        It allows host environments to track promise rejections.
        -

        An implementation of HostPromiseRejectionTracker must conform to the following requirements:

        -
          -
        • It must complete normally (i.e. not return an abrupt completion).
        • -

        The default implementation of HostPromiseRejectionTracker is to return ~unused~.

        @@ -45299,11 +47650,13 @@

        1. Let _type_ be _reaction_.[[Type]]. 1. Let _handler_ be _reaction_.[[Handler]]. 1. If _handler_ is ~empty~, then - 1. If _type_ is ~Fulfill~, let _handlerResult_ be NormalCompletion(_argument_). + 1. If _type_ is ~fulfill~, then + 1. Let _handlerResult_ be NormalCompletion(_argument_). 1. Else, - 1. Assert: _type_ is ~Reject~. + 1. Assert: _type_ is ~reject~. 1. Let _handlerResult_ be ThrowCompletion(_argument_). - 1. Else, let _handlerResult_ be Completion(HostCallJobCallback(_handler_, *undefined*, « _argument_ »)). + 1. Else, + 1. Let _handlerResult_ be Completion(HostCallJobCallback(_handler_, *undefined*, « _argument_ »)). 1. If _promiseCapability_ is *undefined*, then 1. Assert: _handlerResult_ is not an abrupt completion. 1. Return ~empty~. @@ -45404,7 +47757,7 @@

        Promise.all ( _iterable_ )

        1. Let _promiseCapability_ be ? NewPromiseCapability(_C_). 1. Let _promiseResolve_ be Completion(GetPromiseResolve(_C_)). 1. IfAbruptRejectPromise(_promiseResolve_, _promiseCapability_). - 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_)). + 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_, ~sync~)). 1. IfAbruptRejectPromise(_iteratorRecord_, _promiseCapability_). 1. Let _result_ be Completion(PerformPromiseAll(_iteratorRecord_, _C_, _promiseCapability_, _promiseResolve_)). 1. If _result_ is an abrupt completion, then @@ -45447,21 +47800,15 @@

        1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }. 1. Let _index_ be 0. 1. Repeat, - 1. Let _next_ be Completion(IteratorStep(_iteratorRecord_)). - 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_next_). - 1. If _next_ is *false*, then - 1. Set _iteratorRecord_.[[Done]] to *true*. + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, then 1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1. - 1. If _remainingElementsCount_.[[Value]] is 0, then + 1. If _remainingElementsCount_.[[Value]] = 0, then 1. Let _valuesArray_ be CreateArrayFromList(_values_). 1. Perform ? Call(_resultCapability_.[[Resolve]], *undefined*, « _valuesArray_ »). 1. Return _resultCapability_.[[Promise]]. - 1. Let _nextValue_ be Completion(IteratorValue(_next_)). - 1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_nextValue_). 1. Append *undefined* to _values_. - 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _nextValue_ »). + 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _next_ »). 1. Let _steps_ be the algorithm steps defined in . 1. Let _length_ be the number of non-optional parameters of the function definition in . 1. Let _onFulfilled_ be CreateBuiltinFunction(_steps_, _length_, *""*, « [[AlreadyCalled]], [[Index]], [[Values]], [[Capability]], [[RemainingElements]] »). @@ -45490,7 +47837,7 @@

        `Promise.all` Resolve Element Functions

        1. Let _remainingElementsCount_ be _F_.[[RemainingElements]]. 1. Set _values_[_index_] to _x_. 1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1. - 1. If _remainingElementsCount_.[[Value]] is 0, then + 1. If _remainingElementsCount_.[[Value]] = 0, then 1. Let _valuesArray_ be CreateArrayFromList(_values_). 1. Return ? Call(_promiseCapability_.[[Resolve]], *undefined*, « _valuesArray_ »). 1. Return *undefined*. @@ -45507,7 +47854,7 @@

        Promise.allSettled ( _iterable_ )

        1. Let _promiseCapability_ be ? NewPromiseCapability(_C_). 1. Let _promiseResolve_ be Completion(GetPromiseResolve(_C_)). 1. IfAbruptRejectPromise(_promiseResolve_, _promiseCapability_). - 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_)). + 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_, ~sync~)). 1. IfAbruptRejectPromise(_iteratorRecord_, _promiseCapability_). 1. Let _result_ be Completion(PerformPromiseAllSettled(_iteratorRecord_, _C_, _promiseCapability_, _promiseResolve_)). 1. If _result_ is an abrupt completion, then @@ -45535,21 +47882,15 @@

        1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }. 1. Let _index_ be 0. 1. Repeat, - 1. Let _next_ be Completion(IteratorStep(_iteratorRecord_)). - 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_next_). - 1. If _next_ is *false*, then - 1. Set _iteratorRecord_.[[Done]] to *true*. + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, then 1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1. - 1. If _remainingElementsCount_.[[Value]] is 0, then + 1. If _remainingElementsCount_.[[Value]] = 0, then 1. Let _valuesArray_ be CreateArrayFromList(_values_). 1. Perform ? Call(_resultCapability_.[[Resolve]], *undefined*, « _valuesArray_ »). 1. Return _resultCapability_.[[Promise]]. - 1. Let _nextValue_ be Completion(IteratorValue(_next_)). - 1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_nextValue_). 1. Append *undefined* to _values_. - 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _nextValue_ »). + 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _next_ »). 1. Let _stepsFulfilled_ be the algorithm steps defined in . 1. Let _lengthFulfilled_ be the number of non-optional parameters of the function definition in . 1. Let _onFulfilled_ be CreateBuiltinFunction(_stepsFulfilled_, _lengthFulfilled_, *""*, « [[AlreadyCalled]], [[Index]], [[Values]], [[Capability]], [[RemainingElements]] »). @@ -45591,7 +47932,7 @@

        `Promise.allSettled` Resolve Element Functions

        1. Perform ! CreateDataPropertyOrThrow(_obj_, *"value"*, _x_). 1. Set _values_[_index_] to _obj_. 1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1. - 1. If _remainingElementsCount_.[[Value]] is 0, then + 1. If _remainingElementsCount_.[[Value]] = 0, then 1. Let _valuesArray_ be CreateArrayFromList(_values_). 1. Return ? Call(_promiseCapability_.[[Resolve]], *undefined*, « _valuesArray_ »). 1. Return *undefined*. @@ -45617,7 +47958,7 @@

        `Promise.allSettled` Reject Element Functions

        1. Perform ! CreateDataPropertyOrThrow(_obj_, *"reason"*, _x_). 1. Set _values_[_index_] to _obj_. 1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1. - 1. If _remainingElementsCount_.[[Value]] is 0, then + 1. If _remainingElementsCount_.[[Value]] = 0, then 1. Let _valuesArray_ be CreateArrayFromList(_values_). 1. Return ? Call(_promiseCapability_.[[Resolve]], *undefined*, « _valuesArray_ »). 1. Return *undefined*. @@ -45634,7 +47975,7 @@

        Promise.any ( _iterable_ )

        1. Let _promiseCapability_ be ? NewPromiseCapability(_C_). 1. Let _promiseResolve_ be Completion(GetPromiseResolve(_C_)). 1. IfAbruptRejectPromise(_promiseResolve_, _promiseCapability_). - 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_)). + 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_, ~sync~)). 1. IfAbruptRejectPromise(_iteratorRecord_, _promiseCapability_). 1. Let _result_ be Completion(PerformPromiseAny(_iteratorRecord_, _C_, _promiseCapability_, _promiseResolve_)). 1. If _result_ is an abrupt completion, then @@ -45662,22 +48003,16 @@

        1. Let _remainingElementsCount_ be the Record { [[Value]]: 1 }. 1. Let _index_ be 0. 1. Repeat, - 1. Let _next_ be Completion(IteratorStep(_iteratorRecord_)). - 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_next_). - 1. If _next_ is *false*, then - 1. Set _iteratorRecord_.[[Done]] to *true*. + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, then 1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1. - 1. If _remainingElementsCount_.[[Value]] is 0, then + 1. If _remainingElementsCount_.[[Value]] = 0, then 1. Let _error_ be a newly created *AggregateError* object. 1. Perform ! DefinePropertyOrThrow(_error_, *"errors"*, PropertyDescriptor { [[Configurable]]: *true*, [[Enumerable]]: *false*, [[Writable]]: *true*, [[Value]]: CreateArrayFromList(_errors_) }). 1. Return ThrowCompletion(_error_). 1. Return _resultCapability_.[[Promise]]. - 1. Let _nextValue_ be Completion(IteratorValue(_next_)). - 1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_nextValue_). 1. Append *undefined* to _errors_. - 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _nextValue_ »). + 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _next_ »). 1. Let _stepsRejected_ be the algorithm steps defined in . 1. Let _lengthRejected_ be the number of non-optional parameters of the function definition in . 1. Let _onRejected_ be CreateBuiltinFunction(_stepsRejected_, _lengthRejected_, *""*, « [[AlreadyCalled]], [[Index]], [[Errors]], [[Capability]], [[RemainingElements]] »). @@ -45706,7 +48041,7 @@

        `Promise.any` Reject Element Functions

        1. Let _remainingElementsCount_ be _F_.[[RemainingElements]]. 1. Set _errors_[_index_] to _x_. 1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1. - 1. If _remainingElementsCount_.[[Value]] is 0, then + 1. If _remainingElementsCount_.[[Value]] = 0, then 1. Let _error_ be a newly created *AggregateError* object. 1. Perform ! DefinePropertyOrThrow(_error_, *"errors"*, PropertyDescriptor { [[Configurable]]: *true*, [[Enumerable]]: *false*, [[Writable]]: *true*, [[Value]]: CreateArrayFromList(_errors_) }). 1. Return ? Call(_promiseCapability_.[[Reject]], *undefined*, « _error_ »). @@ -45730,7 +48065,7 @@

        Promise.race ( _iterable_ )

        1. Let _promiseCapability_ be ? NewPromiseCapability(_C_). 1. Let _promiseResolve_ be Completion(GetPromiseResolve(_C_)). 1. IfAbruptRejectPromise(_promiseResolve_, _promiseCapability_). - 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_)). + 1. Let _iteratorRecord_ be Completion(GetIterator(_iterable_, ~sync~)). 1. IfAbruptRejectPromise(_iteratorRecord_, _promiseCapability_). 1. Let _result_ be Completion(PerformPromiseRace(_iteratorRecord_, _C_, _promiseCapability_, _promiseResolve_)). 1. If _result_ is an abrupt completion, then @@ -45758,16 +48093,10 @@

        1. Repeat, - 1. Let _next_ be Completion(IteratorStep(_iteratorRecord_)). - 1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_next_). - 1. If _next_ is *false*, then - 1. Set _iteratorRecord_.[[Done]] to *true*. + 1. Let _next_ be ? IteratorStepValue(_iteratorRecord_). + 1. If _next_ is ~done~, then 1. Return _resultCapability_.[[Promise]]. - 1. Let _nextValue_ be Completion(IteratorValue(_next_)). - 1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*. - 1. ReturnIfAbrupt(_nextValue_). - 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _nextValue_ »). + 1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, « _next_ »). 1. Perform ? Invoke(_nextPromise_, *"then"*, « _resultCapability_.[[Resolve]], _resultCapability_.[[Reject]] »). @@ -45821,6 +48150,20 @@

        + +

        Promise.withResolvers ( )

        +

        This function returns an object with three properties: a new promise together with the `resolve` and `reject` functions associated with it.

        + + 1. Let _C_ be the *this* value. + 1. Let _promiseCapability_ be ? NewPromiseCapability(_C_). + 1. Let _obj_ be OrdinaryObjectCreate(%Object.prototype%). + 1. Perform ! CreateDataPropertyOrThrow(_obj_, *"promise"*, _promiseCapability_.[[Promise]]). + 1. Perform ! CreateDataPropertyOrThrow(_obj_, *"resolve"*, _promiseCapability_.[[Resolve]]). + 1. Perform ! CreateDataPropertyOrThrow(_obj_, *"reject"*, _promiseCapability_.[[Reject]]). + 1. Return _obj_. + +
        +

        get Promise [ @@species ]

        `Promise[@@species]` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

        @@ -45872,19 +48215,19 @@

        Promise.prototype.finally ( _onFinally_ )

        1. Else, 1. Let _thenFinallyClosure_ be a new Abstract Closure with parameters (_value_) that captures _onFinally_ and _C_ and performs the following steps when called: 1. Let _result_ be ? Call(_onFinally_, *undefined*). - 1. Let _promise_ be ? PromiseResolve(_C_, _result_). + 1. Let _p_ be ? PromiseResolve(_C_, _result_). 1. Let _returnValue_ be a new Abstract Closure with no parameters that captures _value_ and performs the following steps when called: 1. Return _value_. 1. Let _valueThunk_ be CreateBuiltinFunction(_returnValue_, 0, *""*, « »). - 1. Return ? Invoke(_promise_, *"then"*, « _valueThunk_ »). + 1. Return ? Invoke(_p_, *"then"*, « _valueThunk_ »). 1. Let _thenFinally_ be CreateBuiltinFunction(_thenFinallyClosure_, 1, *""*, « »). 1. Let _catchFinallyClosure_ be a new Abstract Closure with parameters (_reason_) that captures _onFinally_ and _C_ and performs the following steps when called: 1. Let _result_ be ? Call(_onFinally_, *undefined*). - 1. Let _promise_ be ? PromiseResolve(_C_, _result_). + 1. Let _p_ be ? PromiseResolve(_C_, _result_). 1. Let _throwReason_ be a new Abstract Closure with no parameters that captures _reason_ and performs the following steps when called: 1. Return ThrowCompletion(_reason_). 1. Let _thrower_ be CreateBuiltinFunction(_throwReason_, 0, *""*, « »). - 1. Return ? Invoke(_promise_, *"then"*, « _thrower_ »). + 1. Return ? Invoke(_p_, *"then"*, « _thrower_ »). 1. Let _catchFinally_ be CreateBuiltinFunction(_catchFinallyClosure_, 1, *""*, « »). 1. Return ? Invoke(_promise_, *"then"*, « _thenFinally_, _catchFinally_ »). @@ -45926,8 +48269,8 @@

        1. Let _onRejectedJobCallback_ be ~empty~. 1. Else, 1. Let _onRejectedJobCallback_ be HostMakeJobCallback(_onRejected_). - 1. Let _fulfillReaction_ be the PromiseReaction { [[Capability]]: _resultCapability_, [[Type]]: ~Fulfill~, [[Handler]]: _onFulfilledJobCallback_ }. - 1. Let _rejectReaction_ be the PromiseReaction { [[Capability]]: _resultCapability_, [[Type]]: ~Reject~, [[Handler]]: _onRejectedJobCallback_ }. + 1. Let _fulfillReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~fulfill~, [[Handler]]: _onFulfilledJobCallback_ }. + 1. Let _rejectReaction_ be the PromiseReaction Record { [[Capability]]: _resultCapability_, [[Type]]: ~reject~, [[Handler]]: _onRejectedJobCallback_ }. 1. If _promise_.[[PromiseState]] is ~pending~, then 1. Append _fulfillReaction_ to _promise_.[[PromiseFulfillReactions]]. 1. Append _rejectReaction_ to _promise_.[[PromiseRejectReactions]]. @@ -46037,7 +48380,7 @@

        Properties of Promise Instances

        GeneratorFunction Objects

        GeneratorFunctions are functions that are usually created by evaluating |GeneratorDeclaration|s, |GeneratorExpression|s, and |GeneratorMethod|s. They may also be created by calling the %GeneratorFunction% intrinsic.

        - A staggering variety of boxes and arrows. + A staggering variety of boxes and arrows. @@ -46071,15 +48414,11 @@

        Properties of the GeneratorFunction Constructor

        • is a standard built-in function object that inherits from the Function constructor.
        • has a [[Prototype]] internal slot whose value is %Function%.
        • +
        • has a *"length"* property whose value is *1*𝔽.
        • has a *"name"* property whose value is *"GeneratorFunction"*.
        • has the following properties:
        - -

        GeneratorFunction.length

        -

        This is a data property with a value of 1. This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        -
        -

        GeneratorFunction.prototype

        The initial value of `GeneratorFunction.prototype` is the GeneratorFunction prototype object.

        @@ -46105,7 +48444,7 @@

        GeneratorFunction.prototype.constructor

        GeneratorFunction.prototype.prototype

        -

        The initial value of `GeneratorFunction.prototype.prototype` is the Generator prototype object.

        +

        The initial value of `GeneratorFunction.prototype.prototype` is %GeneratorPrototype%.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        @@ -46163,7 +48502,7 @@

        AsyncGeneratorFunction ( ..._parameterArgs_, _bodyArg_ )

        1. Let _C_ be the active function object. 1. If _bodyArg_ is not present, set _bodyArg_ to the empty String. - 1. Return ? CreateDynamicFunction(_C_, NewTarget, ~asyncGenerator~, _parameterArgs_, _bodyArg_). + 1. Return ? CreateDynamicFunction(_C_, NewTarget, ~async-generator~, _parameterArgs_, _bodyArg_).

        See NOTE for .

        @@ -46177,15 +48516,11 @@

        Properties of the AsyncGeneratorFunction Constructor

        • is a standard built-in function object that inherits from the Function constructor.
        • has a [[Prototype]] internal slot whose value is %Function%.
        • +
        • has a *"length"* property whose value is *1*𝔽.
        • has a *"name"* property whose value is *"AsyncGeneratorFunction"*.
        • has the following properties:
        - -

        AsyncGeneratorFunction.length

        -

        This is a data property with a value of 1. This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        -
        -

        AsyncGeneratorFunction.prototype

        The initial value of `AsyncGeneratorFunction.prototype` is the AsyncGeneratorFunction prototype object.

        @@ -46211,7 +48546,7 @@

        AsyncGeneratorFunction.prototype.constructor

        AsyncGeneratorFunction.prototype.prototype

        -

        The initial value of `AsyncGeneratorFunction.prototype.prototype` is the AsyncGenerator prototype object.

        +

        The initial value of `AsyncGeneratorFunction.prototype.prototype` is %AsyncGeneratorPrototype%.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        @@ -46251,12 +48586,12 @@

        prototype

        Generator Objects

        -

        A Generator is an instance of a generator function and conforms to both the Iterator and Iterable interfaces.

        -

        Generator instances directly inherit properties from the object that is the initial value of the *"prototype"* property of the Generator function that created the instance. Generator instances indirectly inherit properties from the Generator Prototype intrinsic, %GeneratorFunction.prototype.prototype%.

        +

        A Generator is created by calling a generator function and conforms to both the Iterator and Iterable interfaces.

        +

        Generator instances directly inherit properties from the initial value of the *"prototype"* property of the generator function that created the instance. Generator instances indirectly inherit properties from %GeneratorPrototype%.

        -

        Properties of the Generator Prototype Object

        -

        The Generator prototype object:

        +

        The %GeneratorPrototype% Object

        +

        The %GeneratorPrototype% object:

        • is %GeneratorFunction.prototype.prototype%.
        • is an ordinary object.
        • @@ -46266,20 +48601,20 @@

          Properties of the Generator Prototype Object

        -

        Generator.prototype.constructor

        -

        The initial value of `Generator.prototype.constructor` is %GeneratorFunction.prototype%.

        +

        %GeneratorPrototype%.constructor

        +

        The initial value of %GeneratorPrototype%`.constructor` is %GeneratorFunction.prototype%.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        -

        Generator.prototype.next ( _value_ )

        +

        %GeneratorPrototype%.next ( _value_ )

        1. Return ? GeneratorResume(*this* value, _value_, ~empty~).
        -

        Generator.prototype.return ( _value_ )

        +

        %GeneratorPrototype%.return ( _value_ )

        This method performs the following steps when called:

        1. Let _g_ be the *this* value. @@ -46289,7 +48624,7 @@

        Generator.prototype.return ( _value_ )

        -

        Generator.prototype.throw ( _exception_ )

        +

        %GeneratorPrototype%.throw ( _exception_ )

        This method performs the following steps when called:

        1. Let _g_ be the *this* value. @@ -46299,7 +48634,7 @@

        Generator.prototype.throw ( _exception_ )

        -

        Generator.prototype [ @@toStringTag ]

        +

        %GeneratorPrototype% [ @@toStringTag ]

        The initial value of the @@toStringTag property is the String value *"Generator"*.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        @@ -46326,7 +48661,7 @@

        Properties of Generator Instances

        [[GeneratorState]]

        - *undefined*, ~suspendedStart~, ~suspendedYield~, ~executing~, or ~completed~ + *undefined*, ~suspended-start~, ~suspended-yield~, ~executing~, or ~completed~ The current execution state of the generator. @@ -46375,9 +48710,9 @@

        1. Let _genContext_ be the running execution context. 1. Set the Generator component of _genContext_ to _generator_. 1. Let _closure_ be a new Abstract Closure with no parameters that captures _generatorBody_ and performs the following steps when called: - 1. Let _genContext_ be the running execution context. - 1. Let _env_ be _genContext_'s LexicalEnvironment. - 1. Let _generator_ be the Generator component of _genContext_. + 1. Let _acGenContext_ be the running execution context. + 1. Let _env_ be _acGenContext_'s LexicalEnvironment. + 1. Let _acGenerator_ be the Generator component of _acGenContext_. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). 1. Else, @@ -46385,18 +48720,20 @@

        1. Let _result_ be _generatorBody_(). 1. Set _result_ to Completion(DisposeResources(_env_.[[DisposeCapability]], _result_)). 1. Assert: If we return here, the generator either threw an exception or performed either an implicit or explicit return. - 1. Remove _genContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. - 1. Set _generator_.[[GeneratorState]] to ~completed~. - 1. Once a generator enters the ~completed~ state it never leaves it and its associated execution context is never resumed. Any execution state associated with _generator_ can be discarded at this point. - 1. If _result_.[[Type]] is ~normal~, let _resultValue_ be *undefined*. - 1. Else if _result_.[[Type]] is ~return~, let _resultValue_ be _result_.[[Value]]. + 1. Remove _acGenContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Set _acGenerator_.[[GeneratorState]] to ~completed~. + 1. NOTE: Once a generator enters the ~completed~ state it never leaves it and its associated execution context is never resumed. Any execution state associated with _acGenerator_ can be discarded at this point. + 1. If _result_ is a normal completion, then + 1. Let _resultValue_ be *undefined*. + 1. Else if _result_ is a return completion, then + 1. Let _resultValue_ be _result_.[[Value]]. 1. Else, - 1. Assert: _result_.[[Type]] is ~throw~. + 1. Assert: _result_ is a throw completion. 1. Return ? _result_. 1. Return CreateIterResultObject(_resultValue_, *true*). 1. Set the code evaluation state of _genContext_ such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. 1. Set _generator_.[[GeneratorContext]] to _genContext_. - 1. Set _generator_.[[GeneratorState]] to ~suspendedStart~. + 1. Set _generator_.[[GeneratorState]] to ~suspended-start~. 1. Return ~unused~. @@ -46406,14 +48743,14 @@

        GeneratorValidate ( _generator_: an ECMAScript language value, _generatorBrand_: a String or ~empty~, - ): either a normal completion containing either ~suspendedStart~, ~suspendedYield~, or ~completed~, or a throw completion + ): either a normal completion containing either ~suspended-start~, ~suspended-yield~, or ~completed~, or a throw completion

        1. Perform ? RequireInternalSlot(_generator_, [[GeneratorState]]). 1. Perform ? RequireInternalSlot(_generator_, [[GeneratorBrand]]). - 1. If _generator_.[[GeneratorBrand]] is not the same value as _generatorBrand_, throw a *TypeError* exception. + 1. If _generator_.[[GeneratorBrand]] is not _generatorBrand_, throw a *TypeError* exception. 1. Assert: _generator_ also has a [[GeneratorContext]] internal slot. 1. Let _state_ be _generator_.[[GeneratorState]]. 1. If _state_ is ~executing~, throw a *TypeError* exception. @@ -46434,7 +48771,7 @@

        1. Let _state_ be ? GeneratorValidate(_generator_, _generatorBrand_). 1. If _state_ is ~completed~, return CreateIterResultObject(*undefined*, *true*). - 1. Assert: _state_ is either ~suspendedStart~ or ~suspendedYield~. + 1. Assert: _state_ is either ~suspended-start~ or ~suspended-yield~. 1. Let _genContext_ be _generator_.[[GeneratorContext]]. 1. Let _methodContext_ be the running execution context. 1. Suspend _methodContext_. @@ -46458,15 +48795,15 @@

        1. Let _state_ be ? GeneratorValidate(_generator_, _generatorBrand_). - 1. If _state_ is ~suspendedStart~, then + 1. If _state_ is ~suspended-start~, then 1. Set _generator_.[[GeneratorState]] to ~completed~. - 1. Once a generator enters the ~completed~ state it never leaves it and its associated execution context is never resumed. Any execution state associated with _generator_ can be discarded at this point. + 1. NOTE: Once a generator enters the ~completed~ state it never leaves it and its associated execution context is never resumed. Any execution state associated with _generator_ can be discarded at this point. 1. Set _state_ to ~completed~. 1. If _state_ is ~completed~, then - 1. If _abruptCompletion_.[[Type]] is ~return~, then + 1. If _abruptCompletion_ is a return completion, then 1. Return CreateIterResultObject(_abruptCompletion_.[[Value]], *true*). 1. Return ? _abruptCompletion_. - 1. Assert: _state_ is ~suspendedYield~. + 1. Assert: _state_ is ~suspended-yield~. 1. Let _genContext_ be _generator_.[[GeneratorContext]]. 1. Let _methodContext_ be the running execution context. 1. Suspend _methodContext_. @@ -46504,7 +48841,7 @@

        1. Assert: _genContext_ is the execution context of a generator. 1. Let _generator_ be the value of the Generator component of _genContext_. 1. Assert: GetGeneratorKind() is ~sync~. - 1. Set _generator_.[[GeneratorState]] to ~suspendedYield~. + 1. Set _generator_.[[GeneratorState]] to ~suspended-yield~. 1. Remove _genContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. 1. Let _callerContext_ be the running execution context. 1. Resume _callerContext_ passing NormalCompletion(_iterNextObj_). If _genContext_ is ever resumed again, let _resumptionValue_ be the Completion Record with which it is resumed. @@ -46561,13 +48898,13 @@

        AsyncGenerator Objects

        -

        An AsyncGenerator is an instance of an async generator function and conforms to both the AsyncIterator and AsyncIterable interfaces.

        +

        An AsyncGenerator is created by calling an async generator function and conforms to both the AsyncIterator and AsyncIterable interfaces.

        -

        AsyncGenerator instances directly inherit properties from the object that is the initial value of the *"prototype"* property of the AsyncGenerator function that created the instance. AsyncGenerator instances indirectly inherit properties from the AsyncGenerator Prototype intrinsic, %AsyncGeneratorFunction.prototype.prototype%.

        +

        AsyncGenerator instances directly inherit properties from the initial value of the *"prototype"* property of the async generator function that created the instance. AsyncGenerator instances indirectly inherit properties from %AsyncGeneratorPrototype%.

        -

        Properties of the AsyncGenerator Prototype Object

        -

        The AsyncGenerator prototype object:

        +

        The %AsyncGeneratorPrototype% Object

        +

        The %AsyncGeneratorPrototype% object:

        • is %AsyncGeneratorFunction.prototype.prototype%.
        • is an ordinary object.
        • @@ -46577,13 +48914,13 @@

          Properties of the AsyncGenerator Prototype Object

        -

        AsyncGenerator.prototype.constructor

        -

        The initial value of `AsyncGenerator.prototype.constructor` is %AsyncGeneratorFunction.prototype%.

        +

        %AsyncGeneratorPrototype%.constructor

        +

        The initial value of %AsyncGeneratorPrototype%`.constructor` is %AsyncGeneratorFunction.prototype%.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        -

        AsyncGenerator.prototype.next ( _value_ )

        +

        %AsyncGeneratorPrototype%.next ( _value_ )

        1. Let _generator_ be the *this* value. 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%). @@ -46596,7 +48933,7 @@

        AsyncGenerator.prototype.next ( _value_ )

        1. Return _promiseCapability_.[[Promise]]. 1. Let _completion_ be NormalCompletion(_value_). 1. Perform AsyncGeneratorEnqueue(_generator_, _completion_, _promiseCapability_). - 1. If _state_ is either ~suspendedStart~ or ~suspendedYield~, then + 1. If _state_ is either ~suspended-start~ or ~suspended-yield~, then 1. Perform AsyncGeneratorResume(_generator_, _completion_). 1. Else, 1. Assert: _state_ is either ~executing~ or ~awaiting-return~. @@ -46605,7 +48942,7 @@

        AsyncGenerator.prototype.next ( _value_ )

        -

        AsyncGenerator.prototype.return ( _value_ )

        +

        %AsyncGeneratorPrototype%.return ( _value_ )

        1. Let _generator_ be the *this* value. 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%). @@ -46614,10 +48951,10 @@

        AsyncGenerator.prototype.return ( _value_ )

        1. Let _completion_ be Completion Record { [[Type]]: ~return~, [[Value]]: _value_, [[Target]]: ~empty~ }. 1. Perform AsyncGeneratorEnqueue(_generator_, _completion_, _promiseCapability_). 1. Let _state_ be _generator_.[[AsyncGeneratorState]]. - 1. If _state_ is either ~suspendedStart~ or ~completed~, then + 1. If _state_ is either ~suspended-start~ or ~completed~, then 1. Set _generator_.[[AsyncGeneratorState]] to ~awaiting-return~. 1. Perform ! AsyncGeneratorAwaitReturn(_generator_). - 1. Else if _state_ is ~suspendedYield~, then + 1. Else if _state_ is ~suspended-yield~, then 1. Perform AsyncGeneratorResume(_generator_, _completion_). 1. Else, 1. Assert: _state_ is either ~executing~ or ~awaiting-return~. @@ -46626,14 +48963,14 @@

        AsyncGenerator.prototype.return ( _value_ )

        -

        AsyncGenerator.prototype.throw ( _exception_ )

        +

        %AsyncGeneratorPrototype%.throw ( _exception_ )

        1. Let _generator_ be the *this* value. 1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%). 1. Let _result_ be Completion(AsyncGeneratorValidate(_generator_, ~empty~)). 1. IfAbruptRejectPromise(_result_, _promiseCapability_). 1. Let _state_ be _generator_.[[AsyncGeneratorState]]. - 1. If _state_ is ~suspendedStart~, then + 1. If _state_ is ~suspended-start~, then 1. Set _generator_.[[AsyncGeneratorState]] to ~completed~. 1. Set _state_ to ~completed~. 1. If _state_ is ~completed~, then @@ -46641,7 +48978,7 @@

        AsyncGenerator.prototype.throw ( _exception_ )

        1. Return _promiseCapability_.[[Promise]]. 1. Let _completion_ be ThrowCompletion(_exception_). 1. Perform AsyncGeneratorEnqueue(_generator_, _completion_, _promiseCapability_). - 1. If _state_ is ~suspendedYield~, then + 1. If _state_ is ~suspended-yield~, then 1. Perform AsyncGeneratorResume(_generator_, _completion_). 1. Else, 1. Assert: _state_ is either ~executing~ or ~awaiting-return~. @@ -46650,7 +48987,7 @@

        AsyncGenerator.prototype.throw ( _exception_ )

        -

        AsyncGenerator.prototype [ @@toStringTag ]

        +

        %AsyncGeneratorPrototype% [ @@toStringTag ]

        The initial value of the @@toStringTag property is the String value *"AsyncGenerator"*.

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

        @@ -46668,7 +49005,7 @@

        Properties of AsyncGenerator Instances

        [[AsyncGeneratorState]]*undefined*, ~suspendedStart~, ~suspendedYield~, ~executing~, ~awaiting-return~, or ~completed~*undefined*, ~suspended-start~, ~suspended-yield~, ~executing~, ~awaiting-return~, or ~completed~ The current execution state of the async generator.
        [[Order]]~SeqCst~ or ~Unordered~~seq-cst~ or ~unordered~ The weakest ordering guaranteed by the memory model for the event.
        [[Order]]~SeqCst~, ~Unordered~, or ~Init~~seq-cst~, ~unordered~, or ~init~ The weakest ordering guaranteed by the memory model for the event.
        [[Order]]~SeqCst~~seq-cst~ Read-modify-write events are always sequentially consistent.
        + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Property name
        `Basic_Emoji`
        `Emoji_Keycap_Sequence`
        `RGI_Emoji_Modifier_Sequence`
        `RGI_Emoji_Flag_Sequence`
        `RGI_Emoji_Tag_Sequence`
        `RGI_Emoji_ZWJ_Sequence`
        `RGI_Emoji`
        +