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