accessor-name-static-computed-in.js (1143B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-runtime-semantics-classdefinitionevaluation 5 es6id: 14.5.14 6 description: > 7 AssignmentExpression may contain `in` keyword regardless of outer context 8 info: | 9 [...] 10 21. For each ClassElement m in order from methods 11 a. If IsStatic of m is false, then 12 [...] 13 b. Else, 14 a. Let status be the result of performing PropertyDefinitionEvaluation 15 for m with arguments F and false. 16 17 ComputedPropertyName : [ AssignmentExpression ] 18 19 1. Let exprValue be the result of evaluating AssignmentExpression. 20 2. Let propName be ? GetValue(exprValue). 21 3. Return ? ToPropertyKey(propName). 22 ---*/ 23 24 var empty = Object.create(null); 25 var C, value; 26 27 for (C = class { static get ['x' in empty]() { return 'via get'; } }; ; ) { 28 value = C.false; 29 break; 30 } 31 32 assert.sameValue(value, 'via get'); 33 34 for (C = class { static set ['x' in empty](param) { value = param; } }; ; ) { 35 C.false = 'via set'; 36 break; 37 } 38 39 assert.sameValue(value, 'via set'); 40 41 reportCompare(0, 0);