|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * VariableDeclaration within Eval statement is initialized as the program reaches the eval statement |
|
6 * |
|
7 * @path ch12/12.2/S12.2_A5.js |
|
8 * @description Executing eval("var x") |
|
9 */ |
|
10 |
|
11 ////////////////////////////////////////////////////////////////////////////// |
|
12 //CHECK#1 |
|
13 try{ |
|
14 x=x; |
|
15 $ERROR('#1: "x=x" lead to throwing exception'); |
|
16 }catch(e){ |
|
17 $PRINT(e.message); |
|
18 }; |
|
19 // |
|
20 ////////////////////////////////////////////////////////////////////////////// |
|
21 |
|
22 eval("var x"); |
|
23 |
|
24 ////////////////////////////////////////////////////////////////////////////// |
|
25 //CHECK#2 |
|
26 try{ |
|
27 x=x; |
|
28 }catch(e){ |
|
29 $ERROR('#2: VariableDeclaration inside Eval statement is initialized when program reaches the eval statement '+e.message); |
|
30 }; |
|
31 // |
|
32 ////////////////////////////////////////////////////////////////////////////// |
|
33 |