jump.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. var c=0;
  6. for (var i=0;i<10;i++) {
  7. c=c+i;
  8. if (c>12)
  9. break;
  10. }
  11. WScript.Echo(c);
  12. c=0;
  13. L1:for (var j=0;j<4;j++) {
  14. L5:for (var i=0;i<10;i++) {
  15. c = c + i;
  16. WScript.Echo(c);
  17. if ((c > 12) && (c < 20))
  18. break;
  19. else continue L5;
  20. }
  21. L2: for (var k=0;k<2;k++) {
  22. WScript.Echo(k);
  23. }
  24. L3: WScript.Echo("before continue");
  25. if (j<2)
  26. continue L1;
  27. L4:WScript.Echo(j);
  28. }
  29. a: if (false) b = null;
  30. else
  31. {
  32. break a;
  33. }
  34. b: for (i = 0; i < 10; i++) if (i == 5) break b;
  35. d: for (i = 0; i < 10; i++) if (i == 5) break ;
  36. c: while (i != 5) if (i== 11) break c;
  37. e: while (i != 5) if (i== 11) break ;
  38. // Some fuzzer-style stuff to try and confuse the return value
  39. WScript.Echo(undefined === eval('L: {if(c) { break L; } else {break L; } foo() }'));
  40. WScript.Echo(undefined === eval('L: {try { break L; } catch(q) { foo(); break L; } foo() }'));
  41. WScript.Echo(c === eval('L: {do { try { throw c; break L; } catch(q) { q; break L; } foo();} while(1); }'));
  42. WScript.Echo(undefined === eval('L: {while(1) { try { throw c; break L; } catch(q) { break L; } foo();} }'));