|
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 * Code after ReturnStatement is not evaluated |
|
6 * |
|
7 * @path ch12/12.9/S12.9_A5.js |
|
8 * @description Using code after Return statement |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 var x1=1; |
|
13 function myfunc1(){ |
|
14 x1++; |
|
15 return; |
|
16 x1*=2; |
|
17 } |
|
18 myfunc1(); |
|
19 if (x1!==2) $ERROR('#1: x1 === 2. Actual: x1 ==='+ x1 ); |
|
20 |
|
21 //CHECK#2 |
|
22 var x2=1; |
|
23 function myfunc2(){ |
|
24 x2++; |
|
25 return x2; |
|
26 x2*=2; |
|
27 } |
|
28 myfunc2(); |
|
29 if (x2!==2) $ERROR('#2: x2 === 2. Actual: x2 ==='+ x2 ); |
|
30 |
|
31 //CHECK#3 |
|
32 var x3=1; |
|
33 function myfunc3(){ |
|
34 x3++; |
|
35 return; |
|
36 return x3; |
|
37 x3*=2; |
|
38 } |
|
39 if (myfunc3()!==undefined) $ERROR('#3: myfunc3() === undefined. Actual: myfunc3() ==='+ myfunc3() ); |
|
40 |