1 /* The contents of this file are subject to the Netscape Public 2 * License Version 1.1 (the "License"); you may not use this file 3 * except in compliance with the License. You may obtain a copy of 4 * the License at http://www.mozilla.org/NPL/ 5 * 6 * Software distributed under the License is distributed on an "AS 7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 8 * implied. See the License for the specific language governing 9 * rights and limitations under the License. 10 * 11 * The Original Code is Mozilla Communicator client code, released March 12 * 31, 1998. 13 * 14 * The Initial Developer of the Original Code is Netscape Communications 15 * Corporation. Portions created by Netscape are 16 * Copyright (C) 1998 Netscape Communications Corporation. All 17 * Rights Reserved. 18 * 19 * Contributor(s): 20 * 21 */ 22 /** 23 File Name: 11.2.3-4-n.js 24 ECMA Section: 11.2.3. Function Calls 25 Description: 26 27 The production CallExpression : MemberExpression Arguments is evaluated as 28 follows: 29 30 1.Evaluate MemberExpression. 31 2.Evaluate Arguments, producing an internal list of argument values 32 (section 0). 33 3.Call GetValue(Result(1)). 34 4.If Type(Result(3)) is not Object, generate a runtime error. 35 5.If Result(3) does not implement the internal [[Call]] method, generate a 36 runtime error. 37 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, 38 Result(6) is null. 39 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is 40 the same as Result(6). 41 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value 42 and providing the list Result(2) as the argument values. 43 9.Return Result(8). 44 45 The production CallExpression : CallExpression Arguments is evaluated in 46 exactly the same manner, except that the contained CallExpression is 47 evaluated in step 1. 48 49 Note: Result(8) will never be of type Reference if Result(3) is a native 50 ECMAScript object. Whether calling a host object can return a value of 51 type Reference is implementation-dependent. 52 53 Author: christine (at) netscape.com 54 Date: 12 november 1997 55 */ 56 57 var SECTION = "11.2.3-4-n.js"; 58 var VERSION = "ECMA_1"; 59 startTest(); 60 var TITLE = "Function Calls"; 61 62 writeHeaderToLog( SECTION + " "+ TITLE); 63 64 var testcases = new Array(); 65 66 testcases[tc++] = new TestCase( SECTION, "null.valueOf()", "error", null.valueOf() ); 67 test(); 68 69 function test() { 70 for ( tc=0; tc < testcases.length; tc++ ) { 71 testcases[tc].passed = writeTestCaseResult( 72 testcases[tc].expect, 73 testcases[tc].actual, 74 testcases[tc].description +" = "+ 75 testcases[tc].actual ); 76 77 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; 78 } 79 stopTest(); 80 return ( testcases ); 81 } 82