Debian Codegraph @

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