init-value-incremental.js (1520B)
1 // This file was procedurally generated from the following sources: 2 // - src/class-elements/init-value-incremental.case 3 // - src/class-elements/default/cls-decl.template 4 /*--- 5 description: The initializer value is defined during the class instatiation (field definitions in a class declaration) 6 esid: prod-FieldDefinition 7 features: [class-fields-public, computed-property-names, class] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 Runtime Semantics: ClassDefinitionEvaluation 12 13 27. For each ClassElement e in order from elements 14 ... 15 d. Append to fieldRecords the elements of fields. 16 ... 17 33. Let result be InitializeStaticFields(F). 18 ... 19 20 [[Construct]] ( argumentsList, newTarget) 21 22 8. If kind is "base", then 23 a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument). 24 b. Let result be InitializeInstanceFields(thisArgument, F). 25 ... 26 ... 27 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList). 28 ... 29 30 ---*/ 31 var x = 1; 32 33 34 class C { 35 [x++] = x++; 36 [x++] = x++; 37 } 38 39 var c1 = new C(); 40 var c2 = new C(); 41 42 verifyProperty(c1, "1", { 43 value: 3, 44 enumerable: true, 45 configurable: true, 46 writable: true, 47 }); 48 49 verifyProperty(c1, "2", { 50 value: 4, 51 enumerable: true, 52 configurable: true, 53 writable: true, 54 }); 55 56 verifyProperty(c2, "1", { 57 value: 5, 58 enumerable: true, 59 configurable: true, 60 writable: true, 61 }); 62 63 verifyProperty(c2, "2", { 64 value: 6, 65 enumerable: true, 66 configurable: true, 67 writable: true, 68 }); 69 70 reportCompare(0, 0);