test262/src/class-elements/grammar-special-prototype-async-meth-valid.case
2020-08-12 18:58:26 +03:00

46 lines
1.4 KiB
Plaintext

// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Async Methods can be named "prototype"
info: |
Runtime Semantics: ClassDefinitionEvaluation
ClassTail : ClassHeritage_opt { ClassBody_opt }
[...]
6. Let proto be OrdinaryObjectCreate(protoParent).
[...]
14. Perform MakeConstructor(F, false, proto).
[...]
20. For each ClassElement m in order from methods, do
a. If IsStatic of m is false, then
i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
With parameters object and enumerable.
AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
[...]
8. Let desc be the PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }.
9. Return ? DefinePropertyOrThrow(object, propKey, desc).
template: syntax/valid
features: [async-functions]
includes: [propertyHelper.js]
---*/
//- elements
async prototype() {}
//- teardown
assert(C.hasOwnProperty('prototype'));
assert(C.prototype.hasOwnProperty('prototype'));
assert.notSameValue(C.prototype.prototype, C.prototype);
verifyProperty(C.prototype, 'prototype', {
writable: true,
enumerable: false,
configurable: true,
});