Debian Codegraph @

js/src/tests/test262/language/statements/try/12.14-7.js

raw
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 info: |
6 local vars must not be visible outside with block
7 local functions must not be visible outside with block
8 local function expresssions should not be visible outside with block
9 local vars must shadow outer vars
10 local functions must shadow outer functions
11 local function expresssions must shadow outer function expressions
12 eval should use the appended object to the scope chain
13 es5id: 12.14-7
14 description: catch introduces scope - scope removed when exiting catch block
15 ---*/
16
17 var o = {foo: 1};
18 var catchAccessed = false;
19
20 try {
21 throw o;
22 }
23 catch (expObj) {
24 catchAccessed = (expObj.foo == 1);
25 }
26 assert(catchAccessed, '(expObj.foo == 1)');
27
28
29 catchAccessed = false;
30 try {
31 expObj;
32 }
33 catch (e) {
34 catchAccessed = e instanceof ReferenceError
35 }
36 assert(catchAccessed, 'e instanceof ReferenceError');
37
38 reportCompare(0, 0);