File tree 3 files changed +36
-1
lines changed
tests/TestCases/Basic/Metadata
3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ public static Task<Task> Any(int timeout, params Task[] tasks) {
50
50
return null ;
51
51
}
52
52
53
+ public Task < TResult > ChangeWith < TResult > ( Func < Task , TResult > continuation ) {
54
+ return null ;
55
+ }
56
+
53
57
public Task ContinueWith ( Action < Task > continuation ) {
54
58
return null ;
55
59
}
@@ -85,6 +89,10 @@ public T Result {
85
89
}
86
90
}
87
91
92
+ public Task < TResult > ChangeWith < TResult > ( Func < Task < T > , TResult > continuation ) {
93
+ return null ;
94
+ }
95
+
88
96
public Task < T > ContinueWith ( Action < Task < T > > continuation ) {
89
97
return null ;
90
98
}
Original file line number Diff line number Diff line change 1
1
// Task
2
2
3
3
function Task ( result ) {
4
- this . _continuations = isValue ( result ) ?
4
+ this . _continuations = result !== undefined ?
5
5
( this . status = 'done' , null ) :
6
6
( this . status = 'pending' , [ ] ) ;
7
7
this . result = result ;
@@ -11,6 +11,23 @@ var Task$ = {
11
11
get_completed : function ( ) {
12
12
return this . status != 'pending' ;
13
13
} ,
14
+ changeWith : function ( continuation ) {
15
+ var task = new Task ( ) ;
16
+ this . continueWith ( function ( t ) {
17
+ var error = t . error ;
18
+ var result ;
19
+ if ( ! error ) {
20
+ try {
21
+ result = continuation ( t ) ;
22
+ }
23
+ catch ( e ) {
24
+ error = e ;
25
+ }
26
+ }
27
+ _updateTask ( task , result , error ) ;
28
+ } ) ;
29
+ return task ;
30
+ } ,
14
31
continueWith : function ( continuation ) {
15
32
if ( this . _continuations ) {
16
33
this . _continuations . push ( continuation ) ;
Original file line number Diff line number Diff line change @@ -3669,6 +3669,11 @@ Types:
3669
3669
Visibility: Public, Static
3670
3670
Generated Name: any
3671
3671
Abstract: False
3672
+ Method: ChangeWith
3673
+ AssociatedType: Task`1
3674
+ Visibility: Public
3675
+ Generated Name: changeWith
3676
+ Abstract: False
3672
3677
Method: ContinueWith
3673
3678
AssociatedType: Task
3674
3679
Visibility: Public
@@ -3706,6 +3711,11 @@ Types:
3706
3711
AssociatedType: T
3707
3712
Visibility: Public
3708
3713
Generated Name: result
3714
+ Method: ChangeWith
3715
+ AssociatedType: Task`1
3716
+ Visibility: Public
3717
+ Generated Name: changeWith
3718
+ Abstract: False
3709
3719
Method: ContinueWith
3710
3720
AssociatedType: Task`1
3711
3721
Visibility: Public
You can’t perform that action at this time.
0 commit comments