Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/annexB/language/statements/try/catch-redeclared-for-in-var.js

raw
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 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');