catch-redeclared-for-in-var.js (850B)
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 CatchParameter is 10 CatchParameter : BindingIdentifier. 11 ---*/ 12 13 var before, during, after; 14 15 try { 16 throw 'exception'; 17 } catch (err) { 18 before = err; 19 for (var err in { propertyName: null }) { 20 during = err; 21 } 22 after = err; 23 } 24 25 assert.sameValue(before, 'exception'); 26 assert.sameValue(during, 'propertyName', 'during loop body evaluation'); 27 assert.sameValue(after, 'propertyName', 'after loop body evaluation'); 28 29 reportCompare(0, 0);