michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Calling a function as a constructor is possible as long as this.any_Function is declared and called michael@0: * michael@0: * @path ch13/13.2/S13.2.2_A12.js michael@0: * @description Calling a function as a constructor after it has been declared with "function func()" michael@0: */ michael@0: michael@0: function FACTORY(){ michael@0: this.id = 0; michael@0: michael@0: this.id = func(); michael@0: michael@0: function func(){ michael@0: return "id_string"; michael@0: } michael@0: michael@0: } michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: try { michael@0: var obj = new FACTORY(); michael@0: } catch (e) { michael@0: $ERROR('#1: var obj = new FACTORY() does not lead to throwing exception. Actual: Exception is '+e); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if (obj.id !== "id_string") { michael@0: $ERROR('#2: obj.id === "id_string". Actual: obj.id ==='+obj.id); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: