js/src/tests/ecma/Expressions/11.2.3-1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: 11.2.3-1.js
michael@0 9 ECMA Section: 11.2.3. Function Calls
michael@0 10 Description:
michael@0 11
michael@0 12 The production CallExpression : MemberExpression Arguments is evaluated as
michael@0 13 follows:
michael@0 14
michael@0 15 1.Evaluate MemberExpression.
michael@0 16 2.Evaluate Arguments, producing an internal list of argument values
michael@0 17 (section 0).
michael@0 18 3.Call GetValue(Result(1)).
michael@0 19 4.If Type(Result(3)) is not Object, generate a runtime error.
michael@0 20 5.If Result(3) does not implement the internal [[Call]] method, generate a
michael@0 21 runtime error.
michael@0 22 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
michael@0 23 Result(6) is null.
michael@0 24 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
michael@0 25 the same as Result(6).
michael@0 26 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
michael@0 27 and providing the list Result(2) as the argument values.
michael@0 28 9.Return Result(8).
michael@0 29
michael@0 30 The production CallExpression : CallExpression Arguments is evaluated in
michael@0 31 exactly the same manner, except that the contained CallExpression is
michael@0 32 evaluated in step 1.
michael@0 33
michael@0 34 Note: Result(8) will never be of type Reference if Result(3) is a native
michael@0 35 ECMAScript object. Whether calling a host object can return a value of
michael@0 36 type Reference is implementation-dependent.
michael@0 37
michael@0 38 Author: christine@netscape.com
michael@0 39 Date: 12 november 1997
michael@0 40 */
michael@0 41
michael@0 42 var SECTION = "11.2.3-1";
michael@0 43 var VERSION = "ECMA_1";
michael@0 44 startTest();
michael@0 45 var TITLE = "Function Calls";
michael@0 46
michael@0 47 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 48
michael@0 49 /* this.eval() is no longer legal syntax.
michael@0 50 // MemberExpression : this
michael@0 51
michael@0 52 new TestCase( SECTION,
michael@0 53 "this.eval()",
michael@0 54 void 0,
michael@0 55 this.eval() );
michael@0 56
michael@0 57 new TestCase( SECTION,
michael@0 58 "this.eval('NaN')",
michael@0 59 NaN,
michael@0 60 this.eval("NaN") );
michael@0 61 */
michael@0 62 // MemberExpression: Identifier
michael@0 63
michael@0 64 var OBJECT = true;
michael@0 65
michael@0 66 new TestCase( SECTION,
michael@0 67 "OBJECT.toString()",
michael@0 68 "true",
michael@0 69 OBJECT.toString() );
michael@0 70
michael@0 71 // MemberExpression[ Expression]
michael@0 72
michael@0 73 new TestCase( SECTION,
michael@0 74 "(new Array())['length'].valueOf()",
michael@0 75 0,
michael@0 76 (new Array())["length"].valueOf() );
michael@0 77
michael@0 78 // MemberExpression . Identifier
michael@0 79 new TestCase( SECTION,
michael@0 80 "(new Array()).length.valueOf()",
michael@0 81 0,
michael@0 82 (new Array()).length.valueOf() );
michael@0 83 // new MemberExpression Arguments
michael@0 84
michael@0 85 new TestCase( SECTION,
michael@0 86 "(new Array(20))['length'].valueOf()",
michael@0 87 20,
michael@0 88 (new Array(20))["length"].valueOf() );
michael@0 89
michael@0 90 test();
michael@0 91

mercurial