• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright JS Foundation and other contributors, http://js.foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15var a = 0;
16var count = 0;
17while ( function() { while (++a < 0) ; } (), a < 4) {
18  while (++count < 0) ;
19}
20assert(count == 3);
21
22for (a = 0, count = 0; function() { while (++a < 0) ; } (), a < 4 ; ) {
23  while (++count < 0) ;
24}
25assert(count == 3);
26
27a = 0;
28count = 0;
29switch (100) {
30  default:
31    while (++a < 2) ;
32    break;
33
34  case (function () { for (var a = 0; a <= 1; a++) count ++; return a; })():
35    while (++a < 100) ;
36    break;
37
38  case (function () { for (var a = 0; a <= 2; a++) count ++; return a; })():
39    while (++a < 100) ;
40    break;
41
42  case (function () { for (var a = 0; a <= 3; a++) count ++; return a; })():
43    while (++a < 100) ;
44    break;
45
46  case (function () { for (var a = 0; a <= 4; a++) count ++; return a; })():
47    while (++a < 100) ;
48    break;
49}
50
51assert (count == 14);
52assert (a == 2);
53