summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js
blob: d3cb1b1ce188074459a469402fca184f1a46e213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-special-prototype-accessor-meth-valid.case
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
/*---
description: Accessor Methods can be named "prototype" (class declaration)
esid: prod-ClassElement
features: [class]
flags: [generated]
includes: [propertyHelper.js]
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.

    MethodDefinition : get PropertyName ( ) { FunctionBody }

    [...]
    9. Let desc be the PropertyDescriptor { [[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }.
    10. Return ? DefinePropertyOrThrow(object, propKey, desc).

    MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }

    [...]
    8. Let desc be the PropertyDescriptor { [[Set]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }.
    9. Return ? DefinePropertyOrThrow(object, propKey, desc).

---*/


class C {
  get prototype() { return 13; }
  set prototype(_) {}
}

assert(C.hasOwnProperty('prototype'));
assert(C.prototype.hasOwnProperty('prototype'));
assert.notSameValue(C.prototype.prototype, C.prototype);
assert.sameValue(C.prototype.prototype, 13);
verifyProperty(C.prototype, 'prototype', {
    enumerable: false,
    configurable: true,
});

reportCompare(0, 0);