OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:_internal"; | 5 import "dart:_internal"; |
6 | 6 |
7 // We need to pass the value as first argument and leave the second and third | |
8 // arguments empty (used for error handling). | |
9 // See vm/ast_transformer.cc for usage. | |
10 Function _asyncThenWrapperHelper(continuation) { | |
11 return Zone.current.registerUnaryCallback((x) => continuation(x, null, null)); | |
12 } | |
13 | |
14 // We need to pass the exception and stack trace objects as second and third | |
15 // parameter to the continuation. See vm/ast_transformer.cc for usage. | |
16 Function _asyncErrorWrapperHelper(continuation) { | |
17 return Zone.current.registerBinaryCallback( | |
18 (e, s) => continuation(null, e, s)); | |
19 } | |
20 | |
21 Future _awaitHelper( | |
22 var future, Function thenCallback, Function errorCallback) { | |
Lasse Reichstein Nielsen
2015/08/06 14:19:58
remove the "var", rename "future" to "result" (it
floitsch
2015/08/11 15:27:50
changed to 'expression'. "Result" would be the res
floitsch
2015/08/11 15:28:37
Actually changed to "object".
| |
23 if (future is! Future) { | |
24 future = new Future.value(future); | |
25 } | |
Lasse Reichstein Nielsen
2015/08/06 14:19:58
if (result is! Future) {
result = new _Future(
floitsch
2015/08/11 15:27:50
Done.
| |
26 if (future is _Future) { | |
27 return future._thenNoZoneRegistration(thenCallback, errorCallback); | |
28 } else { | |
29 return future.then(thenCallback, onError: errorCallback); | |
30 } | |
31 } | |
OLD | NEW |