blob: 9c13d145b4e8004d99af7e7601b50a0607c31777 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// 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/*---
4esid: sec-variablestatements-in-catch-blocks
5es6id: B3.5
6description: Re-declaration of catch parameter (for-in statement)
7info: >
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
14var before, during, after;
15
16try {
17 throw 'exception';
18} catch (err) {
19 before = err;
20 for (var err in { propertyName: null }) {
21 during = err;
22 }
23 after = err;
24}
25
26assert.sameValue(before, 'exception');
27assert.sameValue(during, 'propertyName', 'during loop body evaluation');
28assert.sameValue(after, 'propertyName', 'after loop body evaluation');