|
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_T8.js |
|
8 * @description Function is declared multiply times |
|
9 */ |
|
10 |
|
11 ////////////////////////////////////////////////////////////////////////////// |
|
12 //CHECK#0 |
|
13 if (typeof __func !== "undefined") { |
|
14 $ERROR('#0: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func); |
|
15 } |
|
16 // |
|
17 ////////////////////////////////////////////////////////////////////////////// |
|
18 |
|
19 var a = 1, b = "a"; |
|
20 |
|
21 var __obj = {a:2}; |
|
22 |
|
23 with (__obj) |
|
24 { |
|
25 while(1){ |
|
26 var __func = function() |
|
27 { |
|
28 return a; |
|
29 }; |
|
30 break; |
|
31 } |
|
32 } |
|
33 |
|
34 delete __obj; |
|
35 |
|
36 ////////////////////////////////////////////////////////////////////////////// |
|
37 //CHECK#1 |
|
38 if (__func() !== 2) { |
|
39 $ERROR('#1: __func() === 2. Actual: __func() ==='+__func()); |
|
40 } |
|
41 // |
|
42 ////////////////////////////////////////////////////////////////////////////// |
|
43 |
|
44 var __obj = {a:3,b:"b"}; |
|
45 |
|
46 with (__obj) |
|
47 { |
|
48 var __func = function() |
|
49 { |
|
50 return b; |
|
51 } |
|
52 } |
|
53 |
|
54 delete __obj; |
|
55 |
|
56 ////////////////////////////////////////////////////////////////////////////// |
|
57 //CHECK#2 |
|
58 if (__func()!=="b") { |
|
59 $ERROR('#2: __func()==="b". Actual: __func()==='+__func()); |
|
60 } |
|
61 // |
|
62 ////////////////////////////////////////////////////////////////////////////// |
|
63 |
|
64 with ({a:99,b:"c"}) |
|
65 { |
|
66 ////////////////////////////////////////////////////////////////////////////// |
|
67 //CHECK#3 |
|
68 if (__func() !== "b") { |
|
69 $ERROR('#3: __func()==="b". Actual: __func()==='+__func()); |
|
70 } |
|
71 // |
|
72 ////////////////////////////////////////////////////////////////////////////// |
|
73 } |
|
74 |