| 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-object-initializer-runtime-semantics-evaluation |
| 5 |
es6id: 12.2.6.8 |
| 6 |
description: > |
| 7 |
AssignmentExpression may contain `in` keyword regardless of outer context |
| 8 |
info: | |
| 9 |
12.2.6.7 Runtime Semantics: Evaluation |
| 10 |
|
| 11 |
[...] |
| 12 |
|
| 13 |
ComputedPropertyName : [ AssignmentExpression ] |
| 14 |
|
| 15 |
1. Let exprValue be the result of evaluating AssignmentExpression. |
| 16 |
2. Let propName be ? GetValue(exprValue). |
| 17 |
3. Return ? ToPropertyKey(propName). |
| 18 |
---*/ |
| 19 |
|
| 20 |
var empty = Object.create(null); |
| 21 |
var obj, value; |
| 22 |
|
| 23 |
for (obj = { get ['x' in empty]() { return 'via get'; } }; ; ) { |
| 24 |
value = obj.false; |
| 25 |
break; |
| 26 |
} |
| 27 |
|
| 28 |
assert.sameValue(value, 'via get'); |
| 29 |
|
| 30 |
for (obj = { set ['x' in empty](param) { value = param; } }; ; ) { |
| 31 |
obj.false = 'via set'; |
| 32 |
break; |
| 33 |
} |
| 34 |
|
| 35 |
assert.sameValue(value, 'via set'); |