cptn-expr-expr-no-iter.js (1216B)
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.4.7 5 description: > 6 Completion value when head has no declaration and a "test" expression and no iteration occurs 7 info: | 8 IterationStatement : 9 for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement 10 11 1. If the first Expression is present, then 12 a. Let exprRef be the result of evaluating the first Expression. 13 b. Let exprValue be GetValue(exprRef). 14 c. ReturnIfAbrupt(exprValue). 15 2. Return ForBodyEvaluation(the second Expression, the third Expression, 16 Statement, « », labelSet). 17 18 13.7.4.8 Runtime Semantics: ForBodyEvaluation 19 1. Let V = undefined. 20 [...] 21 4. Repeat 22 a. If test is not [empty], then 23 i. Let testRef be the result of evaluating test. 24 ii. Let testValue be GetValue(testRef). 25 iii. ReturnIfAbrupt(testValue). 26 iv. If ToBoolean(testValue) is false, return NormalCompletion(V). 27 ---*/ 28 29 assert.sameValue(eval('1; for ( ; false; ) { }'), undefined); 30 assert.sameValue(eval('2; for ( ; false; ) { 3; }'), undefined); 31 32 reportCompare(0, 0);