parse-failure-5.js (716B)
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 info: | 5 If Result(3).type is not normal, then Result(3).type must be throw. 6 Throw Result(3).value as an exception 7 esid: sec-performeval 8 es5id: 15.1.2.1_A3.3_T3 9 description: Return statement 10 ---*/ 11 12 var value; 13 14 try { 15 value = (0,eval)("return;"); 16 throw new Test262Error('#1.1: return must throw SyntaxError. Actual: ' + value); 17 } catch(e) { 18 if ((e instanceof SyntaxError) !== true) { 19 throw new Test262Error('#1.2: return must throw SyntaxError. Actual: ' + e); 20 } 21 } 22 23 assert.throws(SyntaxError, function() { 24 (0,eval)("return;"); 25 }); 26 27 reportCompare(0, 0);