Debian Codegraph @

js/src/tests/test262/language/statements/for-in/cptn-decl-skip-itr.js

raw
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 es6id: 13.7.5.11
5 description: >
6 Completion value when head has a declaration and iteration is skipped
7 info: |
8 IterationStatement : for ( var ForBinding in Expression ) Statement
9
10 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
11 2. ReturnIfAbrupt(keyResult).
12
13 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
14
15 [...]
16 7. If iterationKind is enumerate, then
17 a. If exprValue.[[value]] is null or undefined, then
18 i. Return Completion{[[type]]: break, [[value]]: empty, [[target]]:
19 empty}.
20 ---*/
21
22 assert.sameValue(eval('1; for (var a in undefined) { }'), undefined);
23 assert.sameValue(eval('2; for (var b in undefined) { 3; }'), undefined);
24 assert.sameValue(eval('4; for (var c in null) { }'), undefined);
25 assert.sameValue(eval('5; for (var d in null) { 6; }'), undefined);
26
27 reportCompare(0, 0);