scope-catch-block-var-none.js (731B)
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-runtime-semantics-catchclauseevaluation 5 description: Retainment of existing variable environment for `catch` block 6 info: | 7 [...] 8 8. Let B be the result of evaluating Block. 9 [...] 10 ---*/ 11 12 var x = 1; 13 var probeBefore = function() { return x; }; 14 var probeInside; 15 16 try { 17 throw null; 18 } catch (_) { 19 var x = 2; 20 probeInside = function() { return x; }; 21 } 22 23 assert.sameValue(probeBefore(), 2, 'reference preceding statement'); 24 assert.sameValue(probeInside(), 2, 'reference within statement'); 25 assert.sameValue(x, 2, 'reference following statement'); 26 27 reportCompare(0, 0);