| 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-conditional-operator |
| 5 |
es6id: 12.13 |
| 6 |
description: > |
| 7 |
The first AssignmentExpression may include the `in` keyword in any context |
| 8 |
info: | |
| 9 |
Syntax |
| 10 |
|
| 11 |
ConditionalExpression[In, Yield] : |
| 12 |
LogicalORExpression[?In, ?Yield] |
| 13 |
LogicalORExpression[?In, ?Yield] ? AssignmentExpression[+In, ?Yield] : AssignmentExpression[?In, ?Yield] |
| 14 |
---*/ |
| 15 |
|
| 16 |
var cond1Count = 0; |
| 17 |
var cond2Count = 0; |
| 18 |
var cond1 = function() { |
| 19 |
cond1Count += 1; |
| 20 |
return {}; |
| 21 |
}; |
| 22 |
var cond2 = function() { |
| 23 |
cond2Count += 1; |
| 24 |
}; |
| 25 |
for (true ? '' in cond1() : cond2(); false; ) ; |
| 26 |
|
| 27 |
assert.sameValue(cond1Count, 1); |
| 28 |
assert.sameValue(cond2Count, 0); |