test262/harness/wellKnownIntrinsicObjects.js

291 lines
5.0 KiB
JavaScript
Raw Normal View History

// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
An Array of all representable Well-Known Intrinsic Objects
defines: [WellKnownIntrinsicObjects]
---*/
const WellKnownIntrinsicObjects = [
{
name: '%AggregateError%',
source: 'AggregateError',
},
{
name: '%Array%',
source: 'Array',
},
{
name: '%ArrayBuffer%',
source: 'ArrayBuffer',
},
{
name: '%ArrayIteratorPrototype%',
source: 'Object.getPrototypeOf([][Symbol.iterator]())',
},
{
name: '%AsyncFromSyncIteratorPrototype%',
source: 'undefined',
},
{
name: '%AsyncFunction%',
source: '(async function() {}).constructor',
},
{
name: '%AsyncGeneratorFunction%',
source: 'Object.getPrototypeOf(async function * () {})',
},
{
name: '%AsyncIteratorPrototype%',
source: '((async function * () {})())[Symbol.asyncIterator]()',
},
{
name: '%Atomics%',
source: 'Atomics',
},
{
name: '%BigInt%',
source: 'BigInt',
},
{
name: '%BigInt64Array%',
source: 'BigInt64Array',
},
{
name: '%BigUint64Array%',
source: 'BigUint64Array',
},
{
name: '%Boolean%',
source: 'Boolean',
},
{
name: '%DataView%',
source: 'DataView',
},
{
name: '%Date%',
source: 'Date',
},
{
name: '%decodeURI%',
source: 'decodeURI',
},
{
name: '%decodeURIComponent%',
source: 'decodeURIComponent',
},
{
name: '%encodeURI%',
source: 'encodeURI',
},
{
name: '%encodeURIComponent%',
source: 'encodeURIComponent',
},
{
name: '%Error%',
source: 'Error',
},
{
name: '%eval%',
source: 'eval',
},
{
name: '%EvalError%',
source: 'EvalError',
},
{
name: '%FinalizationRegistry%',
source: 'FinalizationRegistry',
},
{
name: '%Float32Array%',
source: 'Float32Array',
},
{
name: '%Float64Array%',
source: 'Float64Array',
},
{
name: '%ForInIteratorPrototype%',
source: '',
},
{
name: '%Function%',
source: 'Function',
},
{
name: '%GeneratorFunction%',
source: 'Object.getPrototypeOf(function * () {})',
},
{
name: '%Int8Array%',
source: 'Int8Array',
},
{
name: '%Int16Array%',
source: 'Int16Array',
},
{
name: '%Int32Array%',
source: 'Int32Array',
},
{
name: '%isFinite%',
source: 'isFinite',
},
{
name: '%isNaN%',
source: 'isNaN',
},
{
name: '%IteratorPrototype%',
source: 'Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))',
},
{
name: '%JSON%',
source: 'JSON',
},
{
name: '%Map%',
source: 'Map',
},
{
name: '%MapIteratorPrototype%',
source: 'Object.getPrototypeOf(new Map()[Symbol.iterator]())',
},
{
name: '%Math%',
source: 'Math',
},
{
name: '%Number%',
source: 'Number',
},
{
name: '%Object%',
source: 'Object',
},
{
name: '%parseFloat%',
source: 'parseFloat',
},
{
name: '%parseInt%',
source: 'parseInt',
},
{
name: '%Promise%',
source: 'Promise',
},
{
name: '%Proxy%',
source: 'Proxy',
},
{
name: '%RangeError%',
source: 'RangeError',
},
{
name: '%ReferenceError%',
source: 'ReferenceError',
},
{
name: '%Reflect%',
source: 'Reflect',
},
{
name: '%RegExp%',
source: 'RegExp',
},
{
name: '%RegExpStringIteratorPrototype%',
source: 'RegExp.prototype[Symbol.matchAll]("")',
},
{
name: '%Set%',
source: 'Set',
},
{
name: '%SetIteratorPrototype%',
source: 'Object.getPrototypeOf(new Set()[Symbol.iterator]())',
},
{
name: '%SharedArrayBuffer%',
source: 'SharedArrayBuffer',
},
{
name: '%String%',
source: 'String',
},
{
name: '%StringIteratorPrototype%',
source: 'Object.getPrototypeOf(new String()[Symbol.iterator]())',
},
{
name: '%Symbol%',
source: 'Symbol',
},
{
name: '%SyntaxError%',
source: 'SyntaxError',
},
{
name: '%ThrowTypeError%',
source: '(function() { "use strict"; return Object.getOwnPropertyDescriptor(arguments, "callee").get })()',
},
{
name: '%TypedArray%',
source: 'Object.getPrototypeOf(Uint8Array)',
},
{
name: '%TypeError%',
source: 'TypeError',
},
{
name: '%Uint8Array%',
source: 'Uint8Array',
},
{
name: '%Uint8ClampedArray%',
source: 'Uint8ClampedArray',
},
{
name: '%Uint16Array%',
source: 'Uint16Array',
},
{
name: '%Uint32Array%',
source: 'Uint32Array',
},
{
name: '%URIError%',
source: 'URIError',
},
{
name: '%WeakMap%',
source: 'WeakMap',
},
{
name: '%WeakRef%',
source: 'WeakRef',
},
{
name: '%WeakSet%',
source: 'WeakSet',
},
];
WellKnownIntrinsicObjects.forEach((wkio) => {
var actual;
try {
actual = new Function("return " + wkio.source)();
} catch (exception) {
// Nothing to do here.
}
wkio.value = actual;
});