Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart

Issue 2769883002: Fix async iterator runtime type errors (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/run.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
});
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/tool/run.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698