catch-redeclared-for-var.js (822B)
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 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 = 'loop initializer'; err !== 'increment'; err = 'increment') { 20 during = err; 21 } 22 after = err; 23 } 24 25 assert.sameValue(before, 'exception'); 26 assert.sameValue(during, 'loop initializer'); 27 assert.sameValue(after, 'increment'); 28 29 reportCompare(0, 0);