Skip to content

Commit 2e5e9fe

Browse files
committed
Flatten _Future at runtime as well
Fixes #551 BUG= [email protected] Review URL: https://codereview.chromium.org/1998843002 .
1 parent f950e42 commit 2e5e9fe

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/dev_compiler/lib/runtime/dart_sdk.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15397,7 +15397,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
1539715397
const _prependListeners = Symbol('_prependListeners');
1539815398
const _reverseListeners = Symbol('_reverseListeners');
1539915399
const _removeListeners = Symbol('_removeListeners');
15400-
async._Future$ = dart.generic(T => {
15400+
async._Future$ = dart.flattenFutures(dart.generic(T => {
1540115401
class _Future extends core.Object {
1540215402
new() {
1540315403
this[_zone] = async.Zone.current;
@@ -15886,7 +15886,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
1588615886
names: ['_chainForeignFuture', '_chainCoreFuture', '_propagateToListeners']
1588715887
});
1588815888
return _Future;
15889-
});
15889+
}));
1589015890
async._Future = async._Future$();
1589115891
async._Future._INCOMPLETE = 0;
1589215892
async._Future._PENDING_COMPLETE = 1;

pkg/dev_compiler/lib/src/compiler/code_generator.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,8 @@ class CodeGenerator extends GeneralizingAstVisitor
825825
assert(formals.isNotEmpty);
826826
var genericCall = js.call('dart.generic((#) => { #; return #; })',
827827
[_emitTypeFormals(formals), body, element.name]);
828-
if (element.type.isDartAsyncFuture) {
828+
if (element.library.isDartAsync &&
829+
(element.name == "Future" || element.name == "_Future")) {
829830
genericCall = js.call('dart.flattenFutures(#)', [genericCall]);
830831
}
831832
var genericDef = js.statement(

0 commit comments

Comments
 (0)