Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | // Copyright 2009 the Sputnik authors. All rights reserved. |
michael@0 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Every execution context has associated with it a scope chain. |
michael@0 | 6 | * A scope chain is a list of objects that are searched when evaluating an |
michael@0 | 7 | * Identifier |
michael@0 | 8 | * |
michael@0 | 9 | * @path ch10/10.2/10.2.2/S10.2.2_A1_T5.js |
michael@0 | 10 | * @description Checking scope chain containing function declarations and "with" |
michael@0 | 11 | * @noStrict |
michael@0 | 12 | */ |
michael@0 | 13 | |
michael@0 | 14 | var x = 0; |
michael@0 | 15 | |
michael@0 | 16 | var myObj = {x : "obj"}; |
michael@0 | 17 | |
michael@0 | 18 | function f1(){ |
michael@0 | 19 | var x = 1; |
michael@0 | 20 | function f2(){ |
michael@0 | 21 | with(myObj){ |
michael@0 | 22 | return x; |
michael@0 | 23 | } |
michael@0 | 24 | }; |
michael@0 | 25 | return f2(); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | if(!(f1() === "obj")){ |
michael@0 | 29 | $ERROR("#1: Scope chain disturbed"); |
michael@0 | 30 | } |
michael@0 | 31 |