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/. */
9
ECMA Section: Activation Object
12
If the function object being invoked has an arguments property, let x be
13
the value of that property; the activation object is also given an internal
14
property [[OldArguments]] whose initial value is x; otherwise, an arguments
15
property is created for the function object but the activation object is
16
not given an [[OldArguments]] property. Next, arguments object described
17
below (the same one stored in the arguments property of the activation
18
object) is used as the new value of the arguments property of the function
19
object. This new value is installed even if the arguments property already
20
exists and has the ReadOnly attribute (as it will for native Function
21
objects). (These actions are taken to provide compatibility with a form of
22
program syntax that is now discouraged: to access the arguments object for
23
function f within the body of f by using the expression f.arguments.
24
The recommended way to access the arguments object for function f within
25
the body of f is simply to refer to the variable arguments.)
27
Author: christine@netscape.com
28
Date: 12 november 1997
31
var SECTION = "10.1.6";
32
var VERSION = "ECMA_1";
34
var TITLE = "Activation Object";
36
writeHeaderToLog( SECTION + " "+ TITLE);
38
var arguments = "FAILED!";
40
var ARG_STRING = "value of the argument property";
42
new TestCase( SECTION,
43
"(new TestObject(0,1,2,3,4,5)).length",
45
(new TestObject(0,1,2,3,4,5)).length );
47
for ( i = 0; i < 6; i++ ) {
49
new TestCase( SECTION,
50
"(new TestObject(0,1,2,3,4,5))["+i+"]",
52
(new TestObject(0,1,2,3,4,5))[i]);
56
// The current object already has an arguments property.
58
new TestCase( SECTION,
59
"(new AnotherTestObject(1,2,3)).arguments",
61
(new AnotherTestObject(1,2,3)).arguments );
63
// The function invoked with [[Call]]
65
new TestCase( SECTION,
66
"TestFunction(1,2,3)",
68
TestFunction() + '' );
75
function Prototype() {
76
this.arguments = ARG_STRING;
78
function TestObject() {
79
this.__proto__ = new Prototype();
82
function AnotherTestObject() {
83
this.__proto__ = new Prototype();
86
function TestFunction() {
87
arguments = ARG_STRING;
90
function AnotherTestFunction() {
91
this.__proto__ = new Prototype();