OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/for_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__for_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const for_test = Object.create(null); |
| 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 12 for_test.Helper = class Helper extends core.Object { |
| 13 static f1() { |
| 14 for (;;) |
| 15 return 1; |
| 16 } |
| 17 static f2(n) { |
| 18 let i = 0; |
| 19 for (; i < dart.notNull(core.num._check(n)); i++) |
| 20 ; |
| 21 return i; |
| 22 } |
| 23 static f3(n) { |
| 24 let i = 0; |
| 25 for (let j = 0; j < dart.notNull(n); j++) |
| 26 i = i + j + 1; |
| 27 return i; |
| 28 } |
| 29 static f4(n) { |
| 30 let i = 0; |
| 31 for (let stop = false; i < dart.notNull(core.num._check(n)) && !stop; i++)
{ |
| 32 if (i >= 5) { |
| 33 stop = true; |
| 34 } |
| 35 } |
| 36 return i; |
| 37 } |
| 38 static f5() { |
| 39 for_test.Helper.status = 0; |
| 40 for (let stop = false;;) { |
| 41 if (stop) { |
| 42 break; |
| 43 } else { |
| 44 stop = true; |
| 45 continue; |
| 46 } |
| 47 } |
| 48 for_test.Helper.status = 1; |
| 49 } |
| 50 static f6() { |
| 51 let i = 0; |
| 52 for (; ++i < 3;) { |
| 53 } |
| 54 return i; |
| 55 } |
| 56 }; |
| 57 dart.setSignature(for_test.Helper, { |
| 58 statics: () => ({ |
| 59 f1: dart.definiteFunctionType(core.int, []), |
| 60 f2: dart.definiteFunctionType(core.int, [dart.dynamic]), |
| 61 f3: dart.definiteFunctionType(core.int, [core.int]), |
| 62 f4: dart.definiteFunctionType(core.int, [dart.dynamic]), |
| 63 f5: dart.definiteFunctionType(dart.void, []), |
| 64 f6: dart.definiteFunctionType(core.int, []) |
| 65 }), |
| 66 names: ['f1', 'f2', 'f3', 'f4', 'f5', 'f6'] |
| 67 }); |
| 68 for_test.Helper.status = null; |
| 69 for_test.ForTest = class ForTest extends core.Object { |
| 70 static testMain() { |
| 71 expect$.Expect.equals(1, for_test.Helper.f1()); |
| 72 expect$.Expect.equals(0, for_test.Helper.f2(-1)); |
| 73 expect$.Expect.equals(0, for_test.Helper.f2(0)); |
| 74 expect$.Expect.equals(10, for_test.Helper.f2(10)); |
| 75 expect$.Expect.equals(0, for_test.Helper.f3(-1)); |
| 76 expect$.Expect.equals(0, for_test.Helper.f3(0)); |
| 77 expect$.Expect.equals(1, for_test.Helper.f3(1)); |
| 78 expect$.Expect.equals(3, for_test.Helper.f3(2)); |
| 79 expect$.Expect.equals(6, for_test.Helper.f3(3)); |
| 80 expect$.Expect.equals(10, for_test.Helper.f3(4)); |
| 81 expect$.Expect.equals(0, for_test.Helper.f4(-1)); |
| 82 expect$.Expect.equals(0, for_test.Helper.f4(0)); |
| 83 expect$.Expect.equals(1, for_test.Helper.f4(1)); |
| 84 expect$.Expect.equals(6, for_test.Helper.f4(6)); |
| 85 expect$.Expect.equals(6, for_test.Helper.f4(10)); |
| 86 for_test.Helper.f5(); |
| 87 expect$.Expect.equals(1, for_test.Helper.status); |
| 88 expect$.Expect.equals(3, for_test.Helper.f6()); |
| 89 } |
| 90 }; |
| 91 dart.setSignature(for_test.ForTest, { |
| 92 statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), |
| 93 names: ['testMain'] |
| 94 }); |
| 95 for_test.main = function() { |
| 96 for_test.ForTest.testMain(); |
| 97 }; |
| 98 dart.fn(for_test.main, VoidTodynamic()); |
| 99 // Exports: |
| 100 exports.for_test = for_test; |
| 101 }); |
OLD | NEW |