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

View File

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