diff --git a/harness/hidden-constructors.js b/harness/hidden-constructors.js index 124ca19bb7f..8a517475a25 100644 --- a/harness/hidden-constructors.js +++ b/harness/hidden-constructors.js @@ -5,13 +5,11 @@ description: | Provides uniform access to built-in constructors that are not exposed to the global object. defines: - - AsyncArrowFunction - AsyncFunction - AsyncGeneratorFunction - GeneratorFunction ---*/ -var AsyncArrowFunction = Object.getPrototypeOf(async () => {}).constructor; var AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor; var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; diff --git a/test/built-ins/AsyncArrowFunction/is-a-constructor.js b/test/built-ins/AsyncArrowFunction/is-a-constructor.js deleted file mode 100644 index acbc03d9589..00000000000 --- a/test/built-ins/AsyncArrowFunction/is-a-constructor.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2020 Rick Waldron. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-ecmascript-standard-built-in-objects -description: > - The AsyncArrowFunction constructor implements [[Construct]] -info: | - IsConstructor ( argument ) - - The abstract operation IsConstructor takes argument argument (an ECMAScript language value). - It determines if argument is a function object with a [[Construct]] internal method. - It performs the following steps when called: - - 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] -features: [Reflect.construct] ----*/ - -assert.sameValue(isConstructor(AsyncArrowFunction), true, 'isConstructor(AsyncArrowFunction) must return true'); -new AsyncArrowFunction(); - diff --git a/test/language/expressions/async-arrow-function/prototype.js b/test/language/expressions/async-arrow-function/prototype.js new file mode 100644 index 00000000000..ef2785c7b9b --- /dev/null +++ b/test/language/expressions/async-arrow-function/prototype.js @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Linus Groh. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-arrow-function-definitions-runtime-semantics-evaluation +description: The prototype of an async arrow function is %AsyncFunction.prototype%. +info: | + AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody + + ... + 6. Let closure be OrdinaryFunctionCreate(%AsyncFunction.prototype%, sourceText, parameters, + AsyncConciseBody, lexical-this, env, privateEnv). + ... +includes: [hidden-constructors.js] +---*/ + +assert.sameValue(Object.getPrototypeOf(async () => {}), AsyncFunction.prototype);