mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
Add coverage for Yield
parameter in RHS of in
This commit is contained in:
parent
e990dce904
commit
aca79695ba
30
test/language/expressions/in/rhs-yield-absent-non-strict.js
Normal file
30
test/language/expressions/in/rhs-yield-absent-non-strict.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Parsing observes the `Yield` production parameter when absent (without strict mode)
|
||||||
|
info: |
|
||||||
|
Syntax
|
||||||
|
RelationalExpression[In, Yield, Await]:
|
||||||
|
[...]
|
||||||
|
[+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await]
|
||||||
|
|
||||||
|
[...]
|
||||||
|
|
||||||
|
1. Let lref be the result of evaluating RelationalExpression.
|
||||||
|
2. Let lval be ? GetValue(lref).
|
||||||
|
3. Let rref be the result of evaluating ShiftExpression.
|
||||||
|
4. Let rval be ? GetValue(rref).
|
||||||
|
5. If Type(rval) is not Object, throw a TypeError exception.
|
||||||
|
6. Return ? HasProperty(rval, ? ToPropertyKey(lval)).
|
||||||
|
esid: sec-relational-operators
|
||||||
|
flags: [noStrict]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var yield;
|
||||||
|
|
||||||
|
yield = {'': 0};
|
||||||
|
assert.sameValue('' in (yield), true);
|
||||||
|
|
||||||
|
yield = {};
|
||||||
|
assert.sameValue('' in (yield), false);
|
20
test/language/expressions/in/rhs-yield-absent-strict.js
Normal file
20
test/language/expressions/in/rhs-yield-absent-strict.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Parsing observes the `Yield` production parameter when absent (within strict mode)
|
||||||
|
info: |
|
||||||
|
Syntax
|
||||||
|
RelationalExpression[In, Yield, Await]:
|
||||||
|
[...]
|
||||||
|
[+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await]
|
||||||
|
esid: sec-relational-operators
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
flags: [onlyStrict]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
$DONOTEVALUATE();
|
||||||
|
|
||||||
|
'' in (yield);
|
33
test/language/expressions/in/rhs-yield-present.js
Normal file
33
test/language/expressions/in/rhs-yield-present.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: Parsing observes the `Yield` production parameter when present
|
||||||
|
info: |
|
||||||
|
Syntax
|
||||||
|
RelationalExpression[In, Yield, Await]:
|
||||||
|
[...]
|
||||||
|
[+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await]
|
||||||
|
|
||||||
|
[...]
|
||||||
|
|
||||||
|
1. Let lref be the result of evaluating RelationalExpression.
|
||||||
|
2. Let lval be ? GetValue(lref).
|
||||||
|
3. Let rref be the result of evaluating ShiftExpression.
|
||||||
|
4. Let rval be ? GetValue(rref).
|
||||||
|
5. If Type(rval) is not Object, throw a TypeError exception.
|
||||||
|
6. Return ? HasProperty(rval, ? ToPropertyKey(lval)).
|
||||||
|
esid: sec-relational-operators-runtime-semantics-evaluation
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function * isNameIn() {
|
||||||
|
return '' in (yield);
|
||||||
|
}
|
||||||
|
|
||||||
|
let iter1 = isNameIn();
|
||||||
|
iter1.next();
|
||||||
|
assert.sameValue(iter1.next({'': 0}).value, true);
|
||||||
|
|
||||||
|
let iter2 = isNameIn();
|
||||||
|
iter2.next();
|
||||||
|
assert.sameValue(iter2.next({}).value, false);
|
Loading…
x
Reference in New Issue
Block a user