OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/await_postfix_expr_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect', |
| 4 'async_helper' |
| 5 ], function load__await_postfix_expr_test(exports, dart_sdk, expect, async_helpe
r) { |
| 6 'use strict'; |
| 7 const core = dart_sdk.core; |
| 8 const _interceptors = dart_sdk._interceptors; |
| 9 const dart = dart_sdk.dart; |
| 10 const dartx = dart_sdk.dartx; |
| 11 const expect$ = expect.expect; |
| 12 const async_helper$ = async_helper.async_helper; |
| 13 const await_postfix_expr_test = Object.create(null); |
| 14 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
| 15 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 16 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 17 await_postfix_expr_test.post0 = function(a) { |
| 18 return dart.async(function*(a) { |
| 19 return yield (() => { |
| 20 let x = a; |
| 21 a = dart.dsend(x, '+', 1); |
| 22 return x; |
| 23 })(); |
| 24 }, dart.dynamic, a); |
| 25 }; |
| 26 dart.fn(await_postfix_expr_test.post0, dynamicTodynamic()); |
| 27 await_postfix_expr_test.post1 = function(a) { |
| 28 return dart.async(function*(a) { |
| 29 return dart.dsend(yield (() => { |
| 30 let x = a; |
| 31 a = dart.dsend(x, '+', 1); |
| 32 return x; |
| 33 })(), '+', yield (() => { |
| 34 let x = a; |
| 35 a = dart.dsend(x, '+', 1); |
| 36 return x; |
| 37 })()); |
| 38 }, dart.dynamic, a); |
| 39 }; |
| 40 dart.fn(await_postfix_expr_test.post1, dynamicTodynamic()); |
| 41 await_postfix_expr_test.pref0 = function(a) { |
| 42 return dart.async(function*(a) { |
| 43 return yield (a = dart.dsend(a, '+', 1)); |
| 44 }, dart.dynamic, a); |
| 45 }; |
| 46 dart.fn(await_postfix_expr_test.pref0, dynamicTodynamic()); |
| 47 await_postfix_expr_test.pref1 = function(a) { |
| 48 return dart.async(function*(a) { |
| 49 return dart.dsend(yield (a = dart.dsend(a, '+', 1)), '+', yield (a = dart.
dsend(a, '+', 1))); |
| 50 }, dart.dynamic, a); |
| 51 }; |
| 52 dart.fn(await_postfix_expr_test.pref1, dynamicTodynamic()); |
| 53 await_postfix_expr_test.sum = function(a) { |
| 54 return dart.async(function*(a) { |
| 55 let s = 0; |
| 56 for (let i = 0; i < dart.notNull(core.num._check(dart.dload(a, 'length')))
;) { |
| 57 s = dart.notNull(s) + dart.notNull(core.int._check(dart.dindex(a, yield
i++))); |
| 58 } |
| 59 return s; |
| 60 }, dart.dynamic, a); |
| 61 }; |
| 62 dart.fn(await_postfix_expr_test.sum, dynamicTodynamic()); |
| 63 await_postfix_expr_test.sum2 = function(n) { |
| 64 return dart.async(function*(n) { |
| 65 let i = null, s = 0; |
| 66 for (i = 1; dart.notNull(i) <= dart.notNull(core.num._check(n)); yield (()
=> { |
| 67 let x = i; |
| 68 i = dart.notNull(x) + 1; |
| 69 return x; |
| 70 })()) { |
| 71 let j = (yield i); |
| 72 s = dart.notNull(s) + dart.notNull(j); |
| 73 } |
| 74 return s; |
| 75 }, dart.dynamic, n); |
| 76 }; |
| 77 dart.fn(await_postfix_expr_test.sum2, dynamicTodynamic()); |
| 78 await_postfix_expr_test.test = function() { |
| 79 return dart.async(function*() { |
| 80 expect$.Expect.equals(10, yield await_postfix_expr_test.post0(10)); |
| 81 expect$.Expect.equals(21, yield await_postfix_expr_test.post1(10)); |
| 82 expect$.Expect.equals(11, yield await_postfix_expr_test.pref0(10)); |
| 83 expect$.Expect.equals(23, yield await_postfix_expr_test.pref1(10)); |
| 84 expect$.Expect.equals(10, yield await_postfix_expr_test.sum(JSArrayOfint()
.of([1, 2, 3, 4]))); |
| 85 expect$.Expect.equals(10, yield await_postfix_expr_test.sum2(4)); |
| 86 }, dart.dynamic); |
| 87 }; |
| 88 dart.fn(await_postfix_expr_test.test, VoidTodynamic()); |
| 89 await_postfix_expr_test.main = function() { |
| 90 async_helper$.asyncStart(); |
| 91 dart.dsend(await_postfix_expr_test.test(), 'then', dart.fn(_ => { |
| 92 async_helper$.asyncEnd(); |
| 93 }, dynamicTodynamic())); |
| 94 }; |
| 95 dart.fn(await_postfix_expr_test.main, VoidTodynamic()); |
| 96 // Exports: |
| 97 exports.await_postfix_expr_test = await_postfix_expr_test; |
| 98 }); |
OLD | NEW |