|
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 * When "break Identifier" is evaluated, (break, empty, Identifier) is returned |
|
6 * |
|
7 * @path ch12/12.8/S12.8_A4_T3.js |
|
8 * @description Using embedded and labeled loops, breaking to outer loop |
|
9 */ |
|
10 |
|
11 LABEL_OUT : var x=0, y=0, xx=0, yy=0; |
|
12 (function(){ |
|
13 LABEL_DO_LOOP : do { |
|
14 LABEL_IN : x++; |
|
15 if(x===10)return; |
|
16 LABEL_NESTED_LOOP : do { |
|
17 LABEL_IN_NESTED : xx++; |
|
18 if(xx===10)return; |
|
19 break LABEL_DO_LOOP; |
|
20 LABEL_IN_NESTED_2 : yy++; |
|
21 } while (0); |
|
22 |
|
23 LABEL_IN_2 : y++; |
|
24 |
|
25 function IN_DO_FUNC(){} |
|
26 } while(0); |
|
27 |
|
28 LABEL_ANOTHER_LOOP : do { |
|
29 ; |
|
30 } while(0); |
|
31 |
|
32 function OUT_FUNC(){} |
|
33 })(); |
|
34 ////////////////////////////////////////////////////////////////////////////// |
|
35 //CHECK#1 |
|
36 if ((x!==1)&&(y!==0)&&(xx!==1)&(yy!==0)) { |
|
37 $ERROR('#1: x === 1 and y === 0 and xx === 1 and yy === 0. Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy ); |
|
38 } |
|
39 // |
|
40 ////////////////////////////////////////////////////////////////////////////// |
|
41 |