cptn-no-else-true-nrml.js (776B)
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.6.7 5 description: > 6 Completion value when expression is true without an `else` clause and body 7 returns a normal completion. 8 info: | 9 IfStatement : if ( Expression ) Statement 10 11 [...] 12 4. If exprValue is false, then 13 [...] 14 5. Else, 15 a. Let stmtCompletion be the result of evaluating Statement. 16 b. ReturnIfAbrupt(stmtCompletion). 17 c. If stmtCompletion.[[value]] is not empty, return stmtCompletion. 18 d. Return NormalCompletion(undefined). 19 ---*/ 20 21 assert.sameValue(eval('1; if (true) { }'), undefined); 22 assert.sameValue(eval('2; if (true) { 3; }'), 3); 23 24 reportCompare(0, 0);