keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 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: B3.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 in { propertyName: null }) { |
| 21 | during = err; |
| 22 | } |
| 23 | after = err; |
| 24 | } |
| 25 | |
| 26 | assert.sameValue(before, 'exception'); |
| 27 | assert.sameValue(during, 'propertyName', 'during loop body evaluation'); |
| 28 | assert.sameValue(after, 'propertyName', 'after loop body evaluation'); |