OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/async_this_bound_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect', |
| 4 'async_helper' |
| 5 ], function load__async_this_bound_test(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_this_bound_test = Object.create(null); |
| 13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 14 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 15 let dynamicToint = () => (dynamicToint = dart.constFn(dart.definiteFunctionTyp
e(core.int, [dart.dynamic])))(); |
| 16 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT
ype(dart.void, [dart.dynamic])))(); |
| 17 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 18 async_this_bound_test.A = class A extends core.Object { |
| 19 new() { |
| 20 this.a = -1; |
| 21 } |
| 22 foo(ignored, val) { |
| 23 expect$.Expect.equals(val, this.a); |
| 24 } |
| 25 }; |
| 26 dart.setSignature(async_this_bound_test.A, { |
| 27 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [dart.dynamic,
dart.dynamic])}) |
| 28 }); |
| 29 async_this_bound_test.testA = function() { |
| 30 return dart.async(function*() { |
| 31 let a = new async_this_bound_test.A(); |
| 32 a.foo(yield false, -1); |
| 33 a.a = 0; |
| 34 a.foo(yield false, 0); |
| 35 }, dart.dynamic); |
| 36 }; |
| 37 dart.fn(async_this_bound_test.testA, VoidTodynamic()); |
| 38 async_this_bound_test.confuse = function(x) { |
| 39 return x; |
| 40 }; |
| 41 dart.fn(async_this_bound_test.confuse, dynamicTodynamic()); |
| 42 async_this_bound_test.B = class B extends core.Object { |
| 43 new(f) { |
| 44 this.f = f; |
| 45 this.b = 10; |
| 46 } |
| 47 bar(x) { |
| 48 return this.b; |
| 49 } |
| 50 }; |
| 51 dart.setSignature(async_this_bound_test.B, { |
| 52 constructors: () => ({new: dart.definiteFunctionType(async_this_bound_test.B
, [dart.dynamic])}), |
| 53 methods: () => ({bar: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]
)}) |
| 54 }); |
| 55 async_this_bound_test.foo = function(x) { |
| 56 return 499; |
| 57 }; |
| 58 dart.fn(async_this_bound_test.foo, dynamicTodynamic()); |
| 59 async_this_bound_test.bar = function(x) { |
| 60 return 42; |
| 61 }; |
| 62 dart.fn(async_this_bound_test.bar, dynamicTodynamic()); |
| 63 async_this_bound_test.change = function(x) { |
| 64 dart.dput(x, 'f', dart.fn(x => 99, dynamicToint())); |
| 65 }; |
| 66 dart.fn(async_this_bound_test.change, dynamicTodynamic()); |
| 67 async_this_bound_test.testB = function() { |
| 68 return dart.async(function*() { |
| 69 let b = async_this_bound_test.confuse(new async_this_bound_test.B(async_th
is_bound_test.foo)); |
| 70 expect$.Expect.equals(99, dart.dsend(b, 'f', yield async_this_bound_test.c
hange(b))); |
| 71 let b2 = async_this_bound_test.confuse(new async_this_bound_test.B(async_t
his_bound_test.bar)); |
| 72 expect$.Expect.equals(10, dart.dsend(b2, 'f', yield dart.dput(b2, 'f', dar
t.dload(b2, 'bar')))); |
| 73 }, dart.dynamic); |
| 74 }; |
| 75 dart.fn(async_this_bound_test.testB, VoidTodynamic()); |
| 76 async_this_bound_test.test = function() { |
| 77 return dart.async(function*() { |
| 78 yield async_this_bound_test.testA(); |
| 79 yield async_this_bound_test.testB(); |
| 80 }, dart.dynamic); |
| 81 }; |
| 82 dart.fn(async_this_bound_test.test, VoidTodynamic()); |
| 83 async_this_bound_test.main = function() { |
| 84 async_helper$.asyncStart(); |
| 85 dart.dsend(async_this_bound_test.test(), 'then', dart.fn(_ => async_helper$.
asyncEnd(), dynamicTovoid())); |
| 86 }; |
| 87 dart.fn(async_this_bound_test.main, VoidTovoid()); |
| 88 // Exports: |
| 89 exports.async_this_bound_test = async_this_bound_test; |
| 90 }); |
OLD | NEW |