Chromium Code Reviews| Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart |
| diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart |
| index b90e2ccc3b8ca0884c8df91d168d968c51464487..84950793516294a15bd08650bf3de2e05a41980d 100644 |
| --- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart |
| +++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart |
| @@ -25,6 +25,9 @@ syncStar(gen, E, @rest args) => JS( |
| async_(gen, T, @rest args) => JS( |
| '', |
| '''(() => { |
| + let FutureRaw = ${getGenericClass(Future)}; |
| + let FutureT = FutureRaw($T); |
| + let FutureD = FutureRaw(dart.dynamic); |
| let iter; |
| function onValue(res) { |
| if (res === void 0) res = null; |
| @@ -45,13 +48,13 @@ async_(gen, T, @rest args) => JS( |
| if (ret.done) return ret.value; |
| // Checks if the awaited value is a Future. |
| let future = ret.value; |
| - if (!$instanceOf(future, ${getGenericClass(Future)})) { |
| - future = $Future.value(future); |
| + if (!$instanceOf(future, FutureD)) { |
| + future = FutureT.value(future); |
|
Jennifer Messerly
2017/03/23 00:31:19
Chatted w/ Vijay offline ... I don't think this is
|
| } |
| // Chain the Future so `await` receives the Future's value. |
| - return future.then($dynamic)(onValue, {onError: onError}); |
| + return future.then($T)(onValue, {onError: onError}); |
| } |
| - return ${getGenericClass(Future)}($T).microtask(function() { |
| + return FutureT.microtask(function() { |
| iter = $gen.apply(null, $args)[Symbol.iterator](); |
| return onValue(); |
| }); |