harness: Update list of well-known intrinsics

Looks like this list hasn't been updated in a while. Add
%AsyncGeneratorPrototype%, %GeneratorPrototype%, %Iterator%,
%IteratorHelperPrototype%, and %WrapForValidIteratorPrototype%.

%IteratorPrototype% is no longer a well-known intrinsic; I guess it was
removed because ever since iterator helpers it's accessible as
%Iterator.prototype%.

%Iterator% is available as the global property Iterator, but include a
fallback for implementations that haven't yet implemented iterator
helpers.
This commit is contained in:
Philip Chimento 2025-02-11 15:17:16 -08:00 committed by Philip Chimento
parent 18ce488401
commit e133564cfa
1 changed files with 18 additions and 2 deletions

View File

@ -36,6 +36,10 @@ const WellKnownIntrinsicObjects = [
name: '%AsyncGeneratorFunction%',
source: '(async function* () {}).constructor',
},
{
name: '%AsyncGeneratorPrototype%',
source: 'Object.getPrototypeOf(async function* () {}).prototype',
},
{
name: '%AsyncIteratorPrototype%',
source: '((async function * () {})())[Symbol.asyncIterator]()',
@ -121,6 +125,10 @@ const WellKnownIntrinsicObjects = [
name: '%GeneratorFunction%',
source: '(function* () {}).constructor',
},
{
name: '%GeneratorPrototype%',
source: 'Object.getPrototypeOf(function * () {}).prototype',
},
{
name: '%Int8Array%',
source: 'Int8Array',
@ -142,8 +150,12 @@ const WellKnownIntrinsicObjects = [
source: 'isNaN',
},
{
name: '%IteratorPrototype%',
source: 'Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))',
name: '%Iterator%',
source: 'typeof Iterator !== "undefined" ? Iterator : Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())).constructor',
},
{
name: '%IteratorHelperPrototype%',
source: 'Object.getPrototypeOf(Iterator.from([]).drop(0))',
},
{
name: '%JSON%',
@ -277,6 +289,10 @@ const WellKnownIntrinsicObjects = [
name: '%WeakSet%',
source: 'WeakSet',
},
{
name: '%WrapForValidIteratorPrototype%',
source: 'Object.getPrototypeOf(Iterator.from({ [Symbol.iterator](){ return {}; } }))',
},
];
WellKnownIntrinsicObjects.forEach((wkio) => {