| 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 (for-in statement) |
| 7 |
info: | |
| 8 |
It is a Syntax Error if any element of the BoundNames of CatchParameter |
| 9 |
also occurs in the VarDeclaredNames of Block, unless that element is only |
| 10 |
bound by a VariableStatement or the VariableDeclarationList of a for |
| 11 |
statement, or the ForBinding of a for-in statement. |
| 12 |
---*/ |
| 13 |
|
| 14 |
var before, during, after; |
| 15 |
|
| 16 |
try { |
| 17 |
throw 'exception'; |
| 18 |
} catch (err) { |
| 19 |
before = err; |
| 20 |
for (var err = 'loop initializer'; err !== 'increment'; err = 'increment') { |
| 21 |
during = err; |
| 22 |
} |
| 23 |
after = err; |
| 24 |
} |
| 25 |
|
| 26 |
assert.sameValue(before, 'exception'); |
| 27 |
assert.sameValue(during, 'loop initializer'); |
| 28 |
assert.sameValue(after, 'increment'); |