Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/static-fielddefinition-initializer-abrupt-completion.js

raw
1 // Copyright (C) 2017 Valerie Young. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Class construction should error if evaluation of static field initializer errors
6 esid: runtime-semantics-class-definition-evaluation
7 info: |
8 Runtime Semantics: ClassDefinitionEvaluation
9 ...
10 27. For each ClassElement e in order from elements
11 a. If IsStatic of e is false, then
12 i. Let fields be the result of performing ClassElementEvaluation
13 for e with arguments proto and false.
14 b. Else,
15 i. Let fields be the result of performing ClassElementEvaluation
16 for e with arguments F and false.
17 c. If fields is an abrupt completion, then
18 i. Set the running execution context's LexicalEnvironment to lex.
19 ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
20 iii. Return Completion(status).
21
22 features: [class-static-fields-public]
23 ---*/
24
25 function f() {
26 throw new Test262Error();
27 }
28
29 assert.throws(Test262Error, function() {
30 class C {
31 static x = f();
32 }
33 });
34
35 reportCompare(0, 0);