computed-name-tostring-err.js (1944B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/computed-name-tostring-err.case 3 // - src/class-elements/class-evaluation-error/cls-expr.template 4 /*--- 5 description: Custom error evaluating a computed property name (field definitions in a class expression) 6 esid: sec-runtime-semantics-classdefinitionevaluation 7 features: [class-fields-public, computed-property-names, class] 8 flags: [generated] 9 info: | 10 Runtime Semantics: ClassDefinitionEvaluation 11 12 ... 13 27. For each ClassElement e in order from elements 14 a. If IsStatic of me is false, then 15 i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. 16 b. Else, 17 i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. 18 c. If fields is an abrupt completion, then 19 i. Set the running execution context's LexicalEnvironment to lex. 20 ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. 21 iii. Return Completion(status). 22 ... 23 24 Runtime Semantics: ClassElementEvaluation 25 26 ClassElement: FieldDefinition; 27 Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. 28 29 Runtime Semantics: ClassFieldDefinitionEvaluation 30 With parameters isStatic and homeObject. 31 32 1. Let fieldName be the result of evaluating ClassElementName. 33 2. ReturnIfAbrupt(fieldName). 34 ... 35 36 Runtime Semantics: Evaluation 37 ComputedPropertyName: [ AssignmentExpression ] 38 39 1. Let exprValue be the result of evaluating AssignmentExpression. 40 2. Let propName be ? GetValue(exprValue). 41 3. Return ? ToPropertyKey(propName). 42 43 ---*/ 44 var obj = { 45 toString: function() { 46 throw new Test262Error(); 47 } 48 }; 49 50 51 52 function evaluate() { 53 var C = class { 54 [obj] 55 }; 56 } 57 58 assert.throws(Test262Error 59 , evaluate); 60 61 reportCompare(0, 0);