diff --git a/harness/hidden-constructors.js b/harness/hidden-constructors.js deleted file mode 100644 index d721379470..0000000000 --- a/harness/hidden-constructors.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2020 Rick Waldron. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: | - Provides uniform access to built-in constructors that are not exposed to the global object. -defines: - - AsyncFunction - - AsyncGeneratorFunction - - GeneratorFunction ----*/ - -var AsyncFunction; -var AsyncGeneratorFunction; -var GeneratorFunction; - -try { - AsyncFunction = Object.getPrototypeOf(new Function('return async function dummy() {}')()).constructor; -} catch(e) {} - -try { - AsyncGeneratorFunction = Object.getPrototypeOf(new Function('return async function* dummy() {}')()).constructor; -} catch(e) {} - -try { - GeneratorFunction = Object.getPrototypeOf(new Function('return function* dummy() {}')()).constructor; -} catch(e) {} diff --git a/test/built-ins/AsyncFunction/is-a-constructor.js b/test/built-ins/AsyncFunction/is-a-constructor.js index 86149297a7..43c67d870f 100644 --- a/test/built-ins/AsyncFunction/is-a-constructor.js +++ b/test/built-ins/AsyncFunction/is-a-constructor.js @@ -15,10 +15,10 @@ info: | If Type(argument) is not Object, return false. If argument has a [[Construct]] internal method, return true. Return false. -includes: [isConstructor.js, hidden-constructors.js] +includes: [isConstructor.js, wellKnownIntrinsicObjects.js] features: [Reflect.construct] ---*/ +var AsyncFunction = getWellKnownIntrinsicObject('%AsyncFunction%'); assert.sameValue(isConstructor(AsyncFunction), true, 'isConstructor(AsyncFunction) must return true'); new AsyncFunction(); - diff --git a/test/built-ins/AsyncGeneratorFunction/is-a-constructor.js b/test/built-ins/AsyncGeneratorFunction/is-a-constructor.js index bc53bc79d5..bcb0fb5086 100644 --- a/test/built-ins/AsyncGeneratorFunction/is-a-constructor.js +++ b/test/built-ins/AsyncGeneratorFunction/is-a-constructor.js @@ -15,14 +15,14 @@ info: | If Type(argument) is not Object, return false. If argument has a [[Construct]] internal method, return true. Return false. -includes: [isConstructor.js, hidden-constructors.js] +includes: [isConstructor.js, wellKnownIntrinsicObjects.js] features: [Reflect.construct] ---*/ +var AsyncGeneratorFunction = getWellKnownIntrinsicObject('%AsyncGeneratorFunction%'); assert.sameValue( isConstructor(AsyncGeneratorFunction), true, 'isConstructor(AsyncGeneratorFunction) must return true' ); new AsyncGeneratorFunction(); - diff --git a/test/built-ins/GeneratorFunction/is-a-constructor.js b/test/built-ins/GeneratorFunction/is-a-constructor.js index d42ccc4be5..1eaad94796 100644 --- a/test/built-ins/GeneratorFunction/is-a-constructor.js +++ b/test/built-ins/GeneratorFunction/is-a-constructor.js @@ -15,10 +15,10 @@ info: | If Type(argument) is not Object, return false. If argument has a [[Construct]] internal method, return true. Return false. -includes: [isConstructor.js, hidden-constructors.js] +includes: [isConstructor.js, wellKnownIntrinsicObjects.js] features: [Reflect.construct] ---*/ +var GeneratorFunction = getWellKnownIntrinsicObject('%GeneratorFunction%'); assert.sameValue(isConstructor(GeneratorFunction), true, 'isConstructor(GeneratorFunction) must return true'); new GeneratorFunction(); - diff --git a/test/language/expressions/async-arrow-function/prototype.js b/test/language/expressions/async-arrow-function/prototype.js index ef2785c7b9..dfd86bf68a 100644 --- a/test/language/expressions/async-arrow-function/prototype.js +++ b/test/language/expressions/async-arrow-function/prototype.js @@ -11,7 +11,8 @@ info: | 6. Let closure be OrdinaryFunctionCreate(%AsyncFunction.prototype%, sourceText, parameters, AsyncConciseBody, lexical-this, env, privateEnv). ... -includes: [hidden-constructors.js] +includes: [wellKnownIntrinsicObjects.js] ---*/ +var AsyncFunction = getWellKnownIntrinsicObject('%AsyncFunction%'); assert.sameValue(Object.getPrototypeOf(async () => {}), AsyncFunction.prototype);