rhs-yield-present.js (1013B)
1 // Copyright 2021 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: Parsing observes the `Yield` production parameter when present 6 info: | 7 Syntax 8 RelationalExpression[In, Yield, Await]: 9 [...] 10 [+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await] 11 12 [...] 13 14 1. Let lref be the result of evaluating RelationalExpression. 15 2. Let lval be ? GetValue(lref). 16 3. Let rref be the result of evaluating ShiftExpression. 17 4. Let rval be ? GetValue(rref). 18 5. If Type(rval) is not Object, throw a TypeError exception. 19 6. Return ? HasProperty(rval, ? ToPropertyKey(lval)). 20 esid: sec-relational-operators-runtime-semantics-evaluation 21 ---*/ 22 23 function * isNameIn() { 24 return '' in (yield); 25 } 26 27 let iter1 = isNameIn(); 28 iter1.next(); 29 assert.sameValue(iter1.next({'': 0}).value, true); 30 31 let iter2 = isNameIn(); 32 iter2.next(); 33 assert.sameValue(iter2.next({}).value, false); 34 35 reportCompare(0, 0);