| 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 |
es6id: B.3.5 |
| 6 |
description: Re-declaration of catch parameter |
| 7 |
info: | |
| 8 |
[...] |
| 9 |
|
| 10 |
This modified behaviour also applies to var and function declarations |
| 11 |
introduced by direct evals contained within the Block of a Catch clause. |
| 12 |
This change is accomplished by modify the algorithm of 18.2.1.2 as follows: |
| 13 |
|
| 14 |
Step 5.d.ii.2.a.i is replaced by: |
| 15 |
|
| 16 |
i. If thisEnvRec is not the Environment Record for a Catch clause, throw a |
| 17 |
SyntaxError exception. |
| 18 |
ii. If name is bound by any syntactic form other than a |
| 19 |
FunctionDeclaration, a VariableStatement, the VariableDeclarationList |
| 20 |
of a for statement, or the ForBinding of a for-in statement, throw a |
| 21 |
SyntaxError exception. |
| 22 |
flags: [noStrict] |
| 23 |
---*/ |
| 24 |
|
| 25 |
try { |
| 26 |
throw null; |
| 27 |
} catch (err) { |
| 28 |
eval('function err() {}'); |
| 29 |
eval('var err;'); |
| 30 |
eval('for (var err; false; ) {}'); |
| 31 |
eval('for (var err in []) {}'); |
| 32 |
} |