Debian Codegraph @

js/src/tests/test262/language/statements/function/S13.2.2_A11.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: |
6 Calling a function as a constructor is possible as long as
7 this.any_Function is declared and called
8 es5id: 13.2.2_A11
9 description: >
10 Calling a function as a constructor after it has been declared
11 with "function func()"
12 ---*/
13
14 function FACTORY(){
15 this.id = 0;
16
17 this.id = this.func();
18
19 function func(){
20 return "id_string";
21 }
22
23 }
24 //////////////////////////////////////////////////////////////////////////////
25 //CHECK#1
26 try {
27 var obj = new FACTORY();
28 throw new Test262Error('#1: var obj = new FACTORY() lead to throwing exception');
29 } catch (e) {
30 if (e instanceof Test262Error) throw e;
31 }
32 //
33 //////////////////////////////////////////////////////////////////////////////
34
35 reportCompare(0, 0);