1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch10/10.2/10.2.2/S10.2.2_A1_T4.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,27 @@ 1.4 +// Copyright 2009 the Sputnik authors. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * Every execution context has associated with it a scope chain. 1.9 + * A scope chain is a list of objects that are searched when evaluating an 1.10 + * Identifier 1.11 + * 1.12 + * @path ch10/10.2/10.2.2/S10.2.2_A1_T4.js 1.13 + * @description Checking scope chain containing function declarations 1.14 + */ 1.15 + 1.16 +var x = 0; 1.17 + 1.18 +function f1(){ 1.19 + function f2(){ 1.20 + return x; 1.21 + }; 1.22 + 1.23 + var x = 1; 1.24 + return f2(); 1.25 +} 1.26 + 1.27 +if(!(f1() === 1)){ 1.28 + $ERROR("#1: Scope chain disturbed"); 1.29 +} 1.30 +