File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ private class GeneratorImpl<T> extends Dispatcher implements IContinuation<Any>
1818 final f : Coroutine <Yield <T > -> Void >;
1919 var nextValue : Null <T >;
2020 var nextStep : Null <IContinuation <T >>;
21+ var raisedException : Null <Exception >;
2122 var resumed : Bool ;
2223
2324 public function new (f : Coroutine <Yield <T > -> Void >) {
@@ -44,13 +45,18 @@ private class GeneratorImpl<T> extends Dispatcher implements IContinuation<Any>
4445 }
4546
4647 public function next () {
48+ if (raisedException != null ) {
49+ resumed = true ;
50+ throw raisedException ;
51+ }
4752 return nextValue ;
4853 }
4954
5055 public function resume (result : Null <Any >, error : Null <Exception >) {
51- resumed = true ;
5256 if (error != null ) {
53- throw error ;
57+ raisedException = error ;
58+ } else {
59+ resumed = true ;
5460 }
5561 }
5662
You can’t perform that action at this time.
0 commit comments