Index: sdk/lib/_internal/compiler/implementation/enqueue.dart |
=================================================================== |
--- sdk/lib/_internal/compiler/implementation/enqueue.dart (revision 16956) |
+++ sdk/lib/_internal/compiler/implementation/enqueue.dart (working copy) |
@@ -416,9 +416,18 @@ |
// Enable isolate support if we start using something from the |
// isolate library. |
kasperl
2013/01/11 11:58:08
or if we use timers from the dart:async library.
ngeoffray
2013/01/11 12:20:19
Done.
|
LibraryElement library = element.getLibrary(); |
- if (!compiler.hasIsolateSupport() |
- && library.uri.toString() == 'dart:isolate') { |
- enableIsolateSupport(library); |
+ if (!compiler.hasIsolateSupport()) { |
+ String uri = library.uri.toString(); |
+ if (uri == 'dart:isolate') { |
+ enableIsolateSupport(library); |
+ } else if (uri == 'dart:async') { |
+ ClassElement cls = element.getEnclosingClass(); |
+ if (cls != null && cls.name == const SourceString('Timer')) { |
+ // The [:Timer:] class uses the event queue of the isolate |
+ // library, so we make sure that event queue is generated. |
+ enableIsolateSupport(library); |
+ } |
+ } |
} |
return true; |