michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Function's scope chain is started when it is declared michael@0: * michael@0: * @path ch13/13.2/S13.2.2_A19_T8.js michael@0: * @description Function is declared multiply times michael@0: */ michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#0 michael@0: if (typeof __func !== "undefined") { michael@0: $ERROR('#0: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: var a = 1, b = "a"; michael@0: michael@0: var __obj = {a:2}; michael@0: michael@0: with (__obj) michael@0: { michael@0: while(1){ michael@0: var __func = function() michael@0: { michael@0: return a; michael@0: }; michael@0: break; michael@0: } michael@0: } michael@0: michael@0: delete __obj; michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: if (__func() !== 2) { michael@0: $ERROR('#1: __func() === 2. Actual: __func() ==='+__func()); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: var __obj = {a:3,b:"b"}; michael@0: michael@0: with (__obj) michael@0: { michael@0: var __func = function() michael@0: { michael@0: return b; michael@0: } michael@0: } michael@0: michael@0: delete __obj; michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if (__func()!=="b") { michael@0: $ERROR('#2: __func()==="b". Actual: __func()==='+__func()); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: with ({a:99,b:"c"}) michael@0: { michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#3 michael@0: if (__func() !== "b") { michael@0: $ERROR('#3: __func()==="b". Actual: __func()==='+__func()); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: } michael@0: