Debian Codegraph @

js/src/tests/test262/language/statements/function/S13_A19_T2.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: "\"var\" does not override function declaration"
6 es5id: 13_A19_T2
7 description: >
8 Creating a function and a variable with identical Identifiers
9 within function scope
10 ---*/
11
12 (function (){
13
14 // since "var" does not override function declaration __decl is set to function
15 //////////////////////////////////////////////////////////////////////////////
16 //CHECK#1
17 if (typeof __decl !== "function") {
18 throw new Test262Error('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl);
19 }
20 //
21 //////////////////////////////////////////////////////////////////////////////
22
23 var __decl = 1;
24
25 //since statement was evaluted __decl turns to 1 from function
26 //////////////////////////////////////////////////////////////////////////////
27 //CHECK#2
28 if (__decl !== 1) {
29 throw new Test262Error('#2: __decl === 1. Actual: __decl ==='+__decl);
30 }
31 //
32 //////////////////////////////////////////////////////////////////////////////
33
34 function __decl(){return 1;}
35 })();
36
37 reportCompare(0, 0);