|
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 * Function's scope chain is started when it is declared |
|
6 * |
|
7 * @path ch13/13.2/S13.2.2_A19_T7.js |
|
8 * @description Function is declared in the object scope as a variable |
|
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 $ERROR('#1: __obj.hasOwnProperty(\'__func\') === false'); |
|
27 } |
|
28 // |
|
29 ////////////////////////////////////////////////////////////////////////////// |
|
30 |
|
31 ///////////////////////////////////// ///////////////////////////////////////// |
|
32 //CHECK#2 |
|
33 if (!(this.hasOwnProperty('__func'))) { |
|
34 $ERROR('#2: this.hasOwnProperty(\'__func\') === true'); |
|
35 } |
|
36 // |
|
37 ////////////////////////////////////////////////////////////////////////////// |
|
38 |
|
39 ////////////////////////////////////////////////////////////////////////////// |
|
40 //CHECK#3 |
|
41 if (__func in __obj) { |
|
42 $ERROR('#3: (__func in __obj) === false'); |
|
43 } |
|
44 // |
|
45 ////////////////////////////////////////////////////////////////////////////// |
|
46 |
|
47 ////////////////////////////////////////////////////////////////////////////// |
|
48 //CHECK#4 |
|
49 if (this.__func === undefined) { |
|
50 $ERROR('#4: this.__func !== undefined'); |
|
51 } |
|
52 // |
|
53 ////////////////////////////////////////////////////////////////////////////// |
|
54 |