Debian Codegraph @

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