Debian Codegraph @

js/src/tests/test262/language/statements/do-while/cptn-normal.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.2.6
5 description: >
6 Completion value when iteration completes due to expression value
7 info: |
8 IterationStatement : do Statement while ( Expression ) ;
9
10 1. Let V = undefined.
11 2. Repeat
12 a. Let stmt be the result of evaluating Statement.
13 b. If LoopContinues(stmt, labelSet) is false, return
14 Completion(UpdateEmpty(stmt, V)).
15 c. If stmt.[[value]] is not empty, let V = stmt.[[value]].
16 d. Let exprRef be the result of evaluating Expression.
17 e. Let exprValue be GetValue(exprRef).
18 f. ReturnIfAbrupt(exprValue).
19 g. If ToBoolean(exprValue) is false, return NormalCompletion(V).
20 ---*/
21
22 assert.sameValue(eval('1; do { } while (false)'), undefined);
23 assert.sameValue(eval('2; do { 3; } while (false)'), 3);
24
25 reportCompare(0, 0);