michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 10.2.3-2.js michael@0: ECMA Section: 10.2.3 Function and Anonymous Code michael@0: Description: michael@0: michael@0: The scope chain is initialized to contain the activation object followed michael@0: by the global object. Variable instantiation is performed using the michael@0: activation by the global object. Variable instantiation is performed using michael@0: the activation object as the variable object and using property attributes michael@0: { DontDelete }. The caller provides the this value. If the this value michael@0: provided by the caller is not an object (including the case where it is michael@0: null), then the this value is the global object. michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 12 november 1997 michael@0: */ michael@0: michael@0: var SECTION = "10.2.3-2"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "Function and Anonymous Code"; michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: var o = new MyObject("hello"); michael@0: michael@0: new TestCase( SECTION, michael@0: "MyFunction(\"PASSED!\")", michael@0: "PASSED!", michael@0: MyFunction("PASSED!") ); michael@0: michael@0: var o = MyFunction(); michael@0: michael@0: new TestCase( SECTION, michael@0: "MyOtherFunction(true);", michael@0: false, michael@0: MyOtherFunction(true) ); michael@0: michael@0: test(); michael@0: michael@0: function MyFunction( value ) { michael@0: var x = value; michael@0: delete x; michael@0: return x; michael@0: } michael@0: function MyOtherFunction(value) { michael@0: var x = value; michael@0: return delete x; michael@0: } michael@0: function MyObject( value ) { michael@0: this.THIS = this; michael@0: }