|
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 * "var" does not override function declaration |
|
6 * |
|
7 * @path ch13/13.0/S13_A19_T2.js |
|
8 * @description Creating a function and a variable with identical Identifiers within function scope |
|
9 */ |
|
10 |
|
11 (function (){ |
|
12 |
|
13 // since "var" does not override function declaration __decl is set to function |
|
14 ////////////////////////////////////////////////////////////////////////////// |
|
15 //CHECK#1 |
|
16 if (typeof __decl !== "function") { |
|
17 $ERROR('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl); |
|
18 } |
|
19 // |
|
20 ////////////////////////////////////////////////////////////////////////////// |
|
21 |
|
22 var __decl = 1; |
|
23 |
|
24 //since statement was evaluted __decl turns to 1 from function |
|
25 ////////////////////////////////////////////////////////////////////////////// |
|
26 //CHECK#2 |
|
27 if (__decl !== 1) { |
|
28 $ERROR('#2: __decl === 1. Actual: __decl ==='+__decl); |
|
29 } |
|
30 // |
|
31 ////////////////////////////////////////////////////////////////////////////// |
|
32 |
|
33 function __decl(){return 1;} |
|
34 })(); |
|
35 |