OLD | NEW |
1 library test; | 1 library test; |
2 import self as self; | 2 import self as self; |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:async" as asy; | 4 import "dart:async" as asy; |
5 | 5 |
6 class MyFuture<T extends core::Object> extends core::Object implements asy::Futu
re<self::MyFuture::T> { | 6 class MyFuture<T extends core::Object> extends core::Object implements asy::Futu
re<self::MyFuture::T> { |
7 constructor •() → void | 7 constructor •() → void |
8 : super core::Object::•() {} | 8 : super core::Object::•() {} |
9 constructor value(self::MyFuture::T x) → void | 9 constructor value(self::MyFuture::T x) → void |
10 : super core::Object::•() {} | 10 : super core::Object::•() {} |
11 abstract method noSuchMethod(dynamic invocation) → dynamic; | 11 abstract method noSuchMethod(dynamic invocation) → dynamic; |
12 method then<S extends core::Object>((self::MyFuture::T) → asy::FutureOr<self::
MyFuture::then::S> f, {core::Function onError = null}) → self::MyFuture<self::My
Future::then::S> | 12 method then<S extends core::Object>((self::MyFuture::T) → asy::FutureOr<self::
MyFuture::then::S> f, {core::Function onError = null}) → self::MyFuture<self::My
Future::then::S> |
13 return null; | 13 return null; |
14 } | 14 } |
15 static method test() → void { | 15 static method test() → void { |
16 asy::Future<core::bool> f; | 16 asy::Future<core::bool> f; |
17 asy::Future<core::int> t1 = f.{asy::Future::then}<core::int>((core::bool x) →
asy::Future<core::int> /* originally async */ { | 17 asy::Future<core::int> t1 = f.{asy::Future::then}<core::int>((core::bool x) →
asy::Future<core::int> async => x ? 2 : await asy::Future::value<core::int>(3)); |
18 final asy::Completer<asy::FutureOr<core::int>> :completer = asy::Completer::
sync<asy::FutureOr<core::int>>(); | 18 asy::Future<core::int> t2 = f.{asy::Future::then}<core::int>((core::bool x) →
asy::Future<core::int> async { |
19 asy::FutureOr<core::int> :return_value; | 19 return await x ? 2 : asy::Future::value<core::int>(3); |
20 dynamic :async_op_then; | |
21 dynamic :async_op_error; | |
22 dynamic :await_jump_var = 0; | |
23 dynamic :await_ctx_var; | |
24 dynamic :saved_try_context_var0; | |
25 dynamic :async_temporary_0; | |
26 function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trac
e]) → dynamic yielding | |
27 try { | |
28 #L1: | |
29 { | |
30 if(x) { | |
31 :async_temporary_0 = 2; | |
32 } | |
33 else { | |
34 asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then,
:async_op_error, :async_op); | |
35 [yield] null; | |
36 :async_temporary_0 = :result; | |
37 } | |
38 :return_value = :async_temporary_0; | |
39 break #L1; | |
40 } | |
41 :completer.complete(:return_value); | |
42 return; | |
43 } | |
44 on dynamic catch(dynamic :exception, dynamic :stack_trace) { | |
45 :completer.completeError(:exception, :stack_trace); | |
46 } | |
47 :async_op_then = asy::_asyncThenWrapperHelper(:async_op); | |
48 :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); | |
49 asy::Future::microtask<dynamic>(:async_op); | |
50 return :completer.future; | |
51 }); | |
52 asy::Future<core::int> t2 = f.{asy::Future::then}<core::int>((core::bool x) →
asy::Future<core::int> /* originally async */ { | |
53 final asy::Completer<asy::FutureOr<core::int>> :completer = asy::Completer::
sync<asy::FutureOr<core::int>>(); | |
54 asy::FutureOr<core::int> :return_value; | |
55 dynamic :async_op_then; | |
56 dynamic :async_op_error; | |
57 dynamic :await_jump_var = 0; | |
58 dynamic :await_ctx_var; | |
59 dynamic :saved_try_context_var0; | |
60 function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trac
e]) → dynamic yielding | |
61 try { | |
62 #L2: | |
63 { | |
64 asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op); | |
65 [yield] null; | |
66 :return_value = :result ? 2 : asy::Future::value<core::int>(3); | |
67 break #L2; | |
68 } | |
69 :completer.complete(:return_value); | |
70 return; | |
71 } | |
72 on dynamic catch(dynamic :exception, dynamic :stack_trace) { | |
73 :completer.completeError(:exception, :stack_trace); | |
74 } | |
75 :async_op_then = asy::_asyncThenWrapperHelper(:async_op); | |
76 :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); | |
77 asy::Future::microtask<dynamic>(:async_op); | |
78 return :completer.future; | |
79 }); | 20 }); |
80 asy::Future<core::int> t5 = f.{asy::Future::then}<core::int>((core::bool x) →
core::Object => x ? 2 : asy::Future::value<core::int>(3)); | 21 asy::Future<core::int> t5 = f.{asy::Future::then}<core::int>((core::bool x) →
core::Object => x ? 2 : asy::Future::value<core::int>(3)); |
81 asy::Future<core::int> t6 = f.{asy::Future::then}<core::int>((core::bool x) →
asy::FutureOr<core::int> { | 22 asy::Future<core::int> t6 = f.{asy::Future::then}<core::int>((core::bool x) →
asy::FutureOr<core::int> { |
82 return x ? 2 : asy::Future::value<core::int>(3); | 23 return x ? 2 : asy::Future::value<core::int>(3); |
83 }); | 24 }); |
84 } | 25 } |
85 static method main() → dynamic {} | 26 static method main() → dynamic {} |
OLD | NEW |