Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.2_A19_T7.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: Function's scope chain is started when it is declared
6 es5id: 13.2.2_A19_T7
7 description: Function is declared in the object scope as a variable
8 flags: [noStrict]
9 ---*/
10
11 var a = 1;
12
13 var __obj = {a:2};
14
15 with (__obj)
16 {
17 var __func = function()
18 {
19 return a;
20 }
21 }
22
23 //////////////////////////////////////////////////////////////////////////////
24 //CHECK#1
25 if (__obj.hasOwnProperty('__func')) {
26 throw new Test262Error('#1: __obj.hasOwnProperty(\'__func\') === false');
27 }
28 //
29 //////////////////////////////////////////////////////////////////////////////
30
31 ///////////////////////////////////// /////////////////////////////////////////
32 //CHECK#2
33 if (!(this.hasOwnProperty('__func'))) {
34 throw new Test262Error('#2: this.hasOwnProperty(\'__func\') === true');
35 }
36 //
37 //////////////////////////////////////////////////////////////////////////////
38
39 //////////////////////////////////////////////////////////////////////////////
40 //CHECK#3
41 if (__func in __obj) {
42 throw new Test262Error('#3: (__func in __obj) === false');
43 }
44 //
45 //////////////////////////////////////////////////////////////////////////////
46
47 //////////////////////////////////////////////////////////////////////////////
48 //CHECK#4
49 if (this.__func === undefined) {
50 throw new Test262Error('#4: this.__func !== undefined');
51 }
52 //
53 //////////////////////////////////////////////////////////////////////////////
54
55 reportCompare(0, 0);