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