accessor-name-inst-computed-in.js (1123B)
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 i. Let status be the result of performing PropertyDefinitionEvaluation 13 for m with arguments proto and false. 14 15 ComputedPropertyName : [ AssignmentExpression ] 16 17 1. Let exprValue be the result of evaluating AssignmentExpression. 18 2. Let propName be ? GetValue(exprValue). 19 3. Return ? ToPropertyKey(propName). 20 ---*/ 21 22 var empty = Object.create(null); 23 var C, value; 24 25 for (C = class { get ['x' in empty]() { return 'via get'; } }; ; ) { 26 value = C.prototype.false; 27 break; 28 } 29 30 assert.sameValue(value, 'via get'); 31 32 for (C = class { set ['x' in empty](param) { value = param; } }; ; ) { 33 C.prototype.false = 'via set'; 34 break; 35 } 36 37 assert.sameValue(value, 'via set'); 38 39 reportCompare(0, 0);