Skip to content

Commit

Permalink
Flatten _Future at runtime as well
Browse files Browse the repository at this point in the history
  • Loading branch information
leafpetersen committed May 19, 2016
1 parent f950e42 commit 2e5e9fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/dev_compiler/lib/runtime/dart_sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -15397,7 +15397,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
const _prependListeners = Symbol('_prependListeners');
const _reverseListeners = Symbol('_reverseListeners');
const _removeListeners = Symbol('_removeListeners');
async._Future$ = dart.generic(T => {
async._Future$ = dart.flattenFutures(dart.generic(T => {
class _Future extends core.Object {
new() {
this[_zone] = async.Zone.current;
Expand Down Expand Up @@ -15886,7 +15886,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
names: ['_chainForeignFuture', '_chainCoreFuture', '_propagateToListeners']
});
return _Future;
});
}));
async._Future = async._Future$();
async._Future._INCOMPLETE = 0;
async._Future._PENDING_COMPLETE = 1;
Expand Down
3 changes: 2 additions & 1 deletion pkg/dev_compiler/lib/src/compiler/code_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,8 @@ class CodeGenerator extends GeneralizingAstVisitor
assert(formals.isNotEmpty);
var genericCall = js.call('dart.generic((#) => { #; return #; })',
[_emitTypeFormals(formals), body, element.name]);
if (element.type.isDartAsyncFuture) {
if (element.library.isDartAsync &&
(element.name == "Future" || element.name == "_Future")) {
genericCall = js.call('dart.flattenFutures(#)', [genericCall]);
}
var genericDef = js.statement(
Expand Down

0 comments on commit 2e5e9fe

Please sign in to comment.