var-env-lower-lex-catch-non-strict.js (979B)
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 esid: sec-variablestatements-in-catch-blocks 5 description: Re-declaration of catch parameter 6 info: | 7 [...] 8 9 This modified behaviour also applies to var and function declarations 10 introduced by direct evals contained within the Block of a Catch clause. 11 This change is accomplished by modifying the algorithm of 18.2.1.3 as follows: 12 13 Step 5.d.ii.2.a.i is replaced by: 14 15 i. If thisEnvRec is not the Environment Record for a Catch clause, throw a 16 SyntaxError exception. 17 flags: [noStrict] 18 ---*/ 19 20 try { 21 throw null; 22 } catch (err) { 23 eval('function err() {}'); 24 eval('function* err() {}'); 25 eval('async function err() {}'); 26 eval('async function* err() {}'); 27 28 eval('var err;'); 29 eval('for (var err; false; ) {}'); 30 eval('for (var err in []) {}'); 31 eval('for (var err of []) {}'); 32 } 33 34 reportCompare(0, 0);