Debian Codegraph @

js/src/tests/test262/language/expressions/class/name.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-class-definitions-runtime-semantics-evaluation
6 description: Assignment of function `name` attribute
7 info: |
8 ClassExpression : class ClassTail
9
10 1. Let value be ? ClassDefinitionEvaluation of ClassTail with arguments
11 undefined and "".
12 ...
13 4. Return value.
14
15 ClassExpression : class BindingIdentifier ClassTail
16
17 1. Let className be StringValue of BindingIdentifier.
18 2. Let value be ? ClassDefinitionEvaluation of ClassTail with arguments
19 className and className.
20 ...
21 4. Return value.
22
23 14.6.13 Runtime Semantics: ClassDefinitionEvaluation
24
25 ...
26 12. Let constructorInfo be DefineMethod of constructor with arguments proto,
27 className as the optional name argument, and constructorParent.
28 ...
29
30 14.3.7 Runtime Semantics: DefineMethod
31
32 ...
33 7. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody,
34 scope, name, prototype).
35 ...
36
37 includes: [propertyHelper.js]
38 ---*/
39
40 verifyProperty(class {}, "name", {
41 value: "", writable: false, enumerable: false, configurable: true
42 });
43
44 verifyProperty(class cls {}, "name", {
45 value: "cls", writable: false, enumerable: false, configurable: true
46 });
47
48 verifyProperty(class { constructor() {} }, "name", {
49 value: "", writable: false, enumerable: false, configurable: true
50 });
51
52 verifyProperty(class cls { constructor() {} }, "name", {
53 value: "cls", writable: false, enumerable: false, configurable: true
54 });
55
56 reportCompare(0, 0);