OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/async_switch_test_withDefault_multi', null, /* Im
ports */[ |
| 2 'dart_sdk', |
| 3 'expect', |
| 4 'async_helper' |
| 5 ], function load__async_switch_test_withDefault_multi(exports, dart_sdk, expect,
async_helper) { |
| 6 'use strict'; |
| 7 const core = dart_sdk.core; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const async_helper$ = async_helper.async_helper; |
| 12 const async_switch_test_withDefault_multi = Object.create(null); |
| 13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 14 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 15 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT
ype(dart.void, [dart.dynamic])))(); |
| 16 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 17 async_switch_test_withDefault_multi.foo1 = function(a) { |
| 18 return dart.async(function*(a) { |
| 19 let k = 0; |
| 20 switch (a) { |
| 21 case 1: |
| 22 { |
| 23 yield 3; |
| 24 k = dart.notNull(k) + 1; |
| 25 break; |
| 26 } |
| 27 case 2: |
| 28 { |
| 29 k = dart.notNull(k) + dart.notNull(core.int._check(a)); |
| 30 return dart.notNull(k) + 2; |
| 31 } |
| 32 default: |
| 33 { |
| 34 k = 2; |
| 35 } |
| 36 } |
| 37 return k; |
| 38 }, dart.dynamic, a); |
| 39 }; |
| 40 dart.fn(async_switch_test_withDefault_multi.foo1, dynamicTodynamic()); |
| 41 async_switch_test_withDefault_multi.foo2 = function(a) { |
| 42 return dart.async(function*(a) { |
| 43 let k = 0; |
| 44 switch (yield a) { |
| 45 case 1: |
| 46 { |
| 47 yield 3; |
| 48 k = dart.notNull(k) + 1; |
| 49 break; |
| 50 } |
| 51 case 2: |
| 52 { |
| 53 k = dart.notNull(k) + dart.notNull(core.int._check(yield a)); |
| 54 return dart.notNull(k) + 2; |
| 55 } |
| 56 default: |
| 57 { |
| 58 k = 2; |
| 59 } |
| 60 } |
| 61 return k; |
| 62 }, dart.dynamic, a); |
| 63 }; |
| 64 dart.fn(async_switch_test_withDefault_multi.foo2, dynamicTodynamic()); |
| 65 async_switch_test_withDefault_multi.foo3 = function(a) { |
| 66 return dart.async(function*(a) { |
| 67 let k = 0; |
| 68 switch (a) { |
| 69 case 1: |
| 70 { |
| 71 k = dart.notNull(k) + 1; |
| 72 break; |
| 73 } |
| 74 case 2: |
| 75 { |
| 76 k = dart.notNull(k) + dart.notNull(core.int._check(a)); |
| 77 return dart.notNull(k) + 2; |
| 78 } |
| 79 default: |
| 80 { |
| 81 k = 2; |
| 82 } |
| 83 } |
| 84 return k; |
| 85 }, dart.dynamic, a); |
| 86 }; |
| 87 dart.fn(async_switch_test_withDefault_multi.foo3, dynamicTodynamic()); |
| 88 async_switch_test_withDefault_multi.foo4 = function(value) { |
| 89 return dart.async(function*(value) { |
| 90 let k = 0; |
| 91 switch (yield value) { |
| 92 case 1: |
| 93 { |
| 94 k = k + 1; |
| 95 break; |
| 96 } |
| 97 case 2: |
| 98 { |
| 99 k = k + 2; |
| 100 return 2 + k; |
| 101 } |
| 102 default: |
| 103 { |
| 104 k = 2; |
| 105 } |
| 106 } |
| 107 return k; |
| 108 }, dart.dynamic, value); |
| 109 }; |
| 110 dart.fn(async_switch_test_withDefault_multi.foo4, dynamicTodynamic()); |
| 111 async_switch_test_withDefault_multi.futureOf = function(a) { |
| 112 return dart.async(function*(a) { |
| 113 return yield a; |
| 114 }, dart.dynamic, a); |
| 115 }; |
| 116 dart.fn(async_switch_test_withDefault_multi.futureOf, dynamicTodynamic()); |
| 117 async_switch_test_withDefault_multi.test = function() { |
| 118 return dart.async(function*() { |
| 119 expect$.Expect.equals(1, yield async_switch_test_withDefault_multi.foo1(1)
); |
| 120 expect$.Expect.equals(4, yield async_switch_test_withDefault_multi.foo1(2)
); |
| 121 expect$.Expect.equals(2, yield async_switch_test_withDefault_multi.foo1(3)
); |
| 122 expect$.Expect.equals(1, yield async_switch_test_withDefault_multi.foo2(as
ync_switch_test_withDefault_multi.futureOf(1))); |
| 123 expect$.Expect.equals(4, yield async_switch_test_withDefault_multi.foo2(as
ync_switch_test_withDefault_multi.futureOf(2))); |
| 124 expect$.Expect.equals(2, yield async_switch_test_withDefault_multi.foo2(as
ync_switch_test_withDefault_multi.futureOf(3))); |
| 125 expect$.Expect.equals(1, yield async_switch_test_withDefault_multi.foo3(1)
); |
| 126 expect$.Expect.equals(4, yield async_switch_test_withDefault_multi.foo3(2)
); |
| 127 expect$.Expect.equals(2, yield async_switch_test_withDefault_multi.foo3(3)
); |
| 128 expect$.Expect.equals(1, yield async_switch_test_withDefault_multi.foo4(as
ync_switch_test_withDefault_multi.futureOf(1))); |
| 129 expect$.Expect.equals(4, yield async_switch_test_withDefault_multi.foo4(as
ync_switch_test_withDefault_multi.futureOf(2))); |
| 130 expect$.Expect.equals(2, yield async_switch_test_withDefault_multi.foo4(as
ync_switch_test_withDefault_multi.futureOf(3))); |
| 131 }, dart.dynamic); |
| 132 }; |
| 133 dart.fn(async_switch_test_withDefault_multi.test, VoidTodynamic()); |
| 134 async_switch_test_withDefault_multi.main = function() { |
| 135 async_helper$.asyncStart(); |
| 136 dart.dsend(async_switch_test_withDefault_multi.test(), 'then', dart.fn(_ =>
async_helper$.asyncEnd(), dynamicTovoid())); |
| 137 }; |
| 138 dart.fn(async_switch_test_withDefault_multi.main, VoidTovoid()); |
| 139 // Exports: |
| 140 exports.async_switch_test_withDefault_multi = async_switch_test_withDefault_mu
lti; |
| 141 }); |
OLD | NEW |