12.10-7-1.js (499B)
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.10-7-1 6 description: with introduces scope - restores the earlier environment on exit 7 flags: [noStrict] 8 ---*/ 9 10 var a = 1; 11 12 var o = {a : 2}; 13 try { 14 with (o) { 15 a = 3; 16 throw 1; 17 a = 4; 18 } 19 } catch (e) { 20 // intentionally ignored 21 } 22 23 assert.sameValue(a, 1, 'a'); 24 assert.sameValue(o.a, 3, 'o.a'); 25 26 reportCompare(0, 0);