tests/auto/qml/ecmascripttests/test262/test/annexB/language/statements/try/catch-redeclared-var-statement.js
raw| 1 | // Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | es5id: 12.14-1 |
| 6 | es6id: B.3.5 |
| 7 | description: > |
| 8 | catch doesn't change declaration scope - var initializer in catch |
| 9 | with same name as catch parameter changes parameter |
| 10 | ---*/ |
| 11 | |
| 12 | foo = "prior to throw"; |
| 13 | try { |
| 14 | throw new Error(); |
| 15 | } |
| 16 | catch (foo) { |
| 17 | var foo = "initializer in catch"; |
| 18 | } |
| 19 | |
| 20 | assert.sameValue(foo, "prior to throw"); |