Debian Codegraph @

rhino/testsrc/tests/ecma/Expressions/11.2.3-1.js

raw symbols SCIP
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-1.js';
7
8 /**
9 File Name: 11.2.3-1.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-1";
44 var VERSION = "ECMA_1";
45 startTest();
46 var TITLE = "Function Calls";
47
48 writeHeaderToLog( SECTION + " "+ TITLE);
49
50 /* this.eval() is no longer legal syntax.
51 // MemberExpression : this
52
53 new TestCase( SECTION,
54 "this.eval()",
55 void 0,
56 this.eval() );
57
58 new TestCase( SECTION,
59 "this.eval('NaN')",
60 NaN,
61 this.eval("NaN") );
62 */
63 // MemberExpression: Identifier
64
65 var OBJECT = true;
66
67 new TestCase( SECTION,
68 "OBJECT.toString()",
69 "true",
70 OBJECT.toString() );
71
72 // MemberExpression[ Expression]
73
74 new TestCase( SECTION,
75 "(new Array())['length'].valueOf()",
76 0,
77 (new Array())["length"].valueOf() );
78
79 // MemberExpression . Identifier
80 new TestCase( SECTION,
81 "(new Array()).length.valueOf()",
82 0,
83 (new Array()).length.valueOf() );
84 // new MemberExpression Arguments
85
86 new TestCase( SECTION,
87 "(new Array(20))['length'].valueOf()",
88 20,
89 (new Array(20))["length"].valueOf() );
90
91 test();
92