| 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | gTestfile = '11.2.3-2-n.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: 11.2.3-2-n.js |
| 10 | ECMA Section: 11.2.3. Function Calls |
| 11 | Description: |
| 12 | |
| 13 | The production CallExpression : MemberExpression Arguments is evaluated as |
| 14 | follows: |
| 15 | |
| 16 | 1.Evaluate MemberExpression. |
| 17 | 2.Evaluate Arguments, producing an internal list of argument values |
| 18 | (section 0). |
| 19 | 3.Call GetValue(Result(1)). |
| 20 | 4.If Type(Result(3)) is not Object, generate a runtime error. |
| 21 | 5.If Result(3) does not implement the internal [[Call]] method, generate a |
| 22 | runtime error. |
| 23 | 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, |
| 24 | Result(6) is null. |
| 25 | 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is |
| 26 | the same as Result(6). |
| 27 | 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value |
| 28 | and providing the list Result(2) as the argument values. |
| 29 | 9.Return Result(8). |
| 30 | |
| 31 | The production CallExpression : CallExpression Arguments is evaluated in |
| 32 | exactly the same manner, except that the contained CallExpression is |
| 33 | evaluated in step 1. |
| 34 | |
| 35 | Note: Result(8) will never be of type Reference if Result(3) is a native |
| 36 | ECMAScript object. Whether calling a host object can return a value of |
| 37 | type Reference is implementation-dependent. |
| 38 | |
| 39 | Author: [email protected] |
| 40 | Date: 12 november 1997 |
| 41 | */ |
| 42 | |
| 43 | var SECTION = "11.2.3-2-n.js"; |
| 44 | var VERSION = "ECMA_1"; |
| 45 | startTest(); |
| 46 | var TITLE = "Function Calls"; |
| 47 | |
| 48 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 49 | |
| 50 | new TestCase( SECTION, |
| 51 | "3.valueOf()", |
| 52 | 3, |
| 53 | eval("3.valueOf()") ); |
| 54 | |
| 55 | new TestCase( SECTION, |
| 56 | "(3).valueOf()", |
| 57 | 3, |
| 58 | eval("(3).valueOf()") ); |
| 59 | |
| 60 | test(); |
| 61 |