static-classelementname-abrupt-completion.js (1126B)
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 definition should error if evaluation of static ClassElementName 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 [f()] 32 } 33 }); 34 35 reportCompare(0, 0);