Remove 'AsyncArrowFunction' test

There is no such hidden constructor, it's the same as the hidden
AsyncFunction constructor. In other words:

```js
Object.getPrototypeOf(async () => {}).constructor ===
Object.getPrototypeOf(async function () {}).constructor
```

Also add a test to ensure that %AsyncFunction.prototype% is indeed the
prototype of an async arrow function.

Closes #4044.
This commit is contained in:
Linus Groh 2024-04-08 18:14:17 +01:00 committed by Ms2ger
parent 3d5c52e112
commit a82f5382ff
3 changed files with 17 additions and 26 deletions

View File

@ -5,13 +5,11 @@
description: | description: |
Provides uniform access to built-in constructors that are not exposed to the global object. Provides uniform access to built-in constructors that are not exposed to the global object.
defines: defines:
- AsyncArrowFunction
- AsyncFunction - AsyncFunction
- AsyncGeneratorFunction - AsyncGeneratorFunction
- GeneratorFunction - GeneratorFunction
---*/ ---*/
var AsyncArrowFunction = Object.getPrototypeOf(async () => {}).constructor;
var AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; var AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor; var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;

View File

@ -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();

View File

@ -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);