OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library deferred_load; | 5 library deferred_load; |
6 | 6 |
7 import 'dart:async'; | |
7 import 'dart:collection' | 8 import 'dart:collection' |
8 show LinkedHashMap, | 9 show LinkedHashMap, |
9 LinkedHashSet; | 10 LinkedHashSet; |
10 | 11 |
11 import 'dart2jslib.dart' | 12 import 'dart2jslib.dart' |
12 show Compiler, | 13 show Compiler, |
13 CompilerTask, | 14 CompilerTask, |
14 ConstructedConstant, | 15 ConstructedConstant, |
15 MessageKind, | 16 MessageKind, |
16 SourceString, | 17 SourceString, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 /// DeferredLibrary from dart:async | 57 /// DeferredLibrary from dart:async |
57 ClassElement get deferredLibraryClass { | 58 ClassElement get deferredLibraryClass { |
58 if (cachedDeferredLibraryClass == null) { | 59 if (cachedDeferredLibraryClass == null) { |
59 cachedDeferredLibraryClass = findDeferredLibraryClass(); | 60 cachedDeferredLibraryClass = findDeferredLibraryClass(); |
60 } | 61 } |
61 return cachedDeferredLibraryClass; | 62 return cachedDeferredLibraryClass; |
62 } | 63 } |
63 | 64 |
64 ClassElement findDeferredLibraryClass() { | 65 ClassElement findDeferredLibraryClass() { |
65 var uri = new Uri(scheme: 'dart', path: 'async'); | 66 var uri = new Uri(scheme: 'dart', path: 'async'); |
67 // TODO(rnystrom): Handle future. | |
Bob Nystrom
2013/06/26 01:03:24
I still have to get this working. This is a bit ha
ahe
2013/06/26 07:02:00
Actually, I think this is easy to fix. I just nee
Bob Nystrom
2013/06/27 00:38:18
This is breaking a couple of tests. Should I file
| |
66 LibraryElement asyncLibrary = | 68 LibraryElement asyncLibrary = |
67 compiler.libraryLoader.loadLibrary(uri, null, uri); | 69 deprecatedFutureValue(compiler.libraryLoader.loadLibrary(uri, null, uri) ); |
68 var element = asyncLibrary.find(const SourceString('DeferredLibrary')); | 70 var element = asyncLibrary.find(const SourceString('DeferredLibrary')); |
69 if (element == null) { | 71 if (element == null) { |
70 compiler.internalErrorOnElement( | 72 compiler.internalErrorOnElement( |
71 asyncLibrary, | 73 asyncLibrary, |
72 'dart:async library does not contain required class: ' | 74 'dart:async library does not contain required class: ' |
73 'DeferredLibrary'); | 75 'DeferredLibrary'); |
74 } | 76 } |
75 return element; | 77 return element; |
76 } | 78 } |
77 | 79 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 TreeElements elements = | 258 TreeElements elements = |
257 compiler.enqueuer.resolution.getCachedElements(element); | 259 compiler.enqueuer.resolution.getCachedElements(element); |
258 if (elements == null) return new LinkedHashSet<Element>(); | 260 if (elements == null) return new LinkedHashSet<Element>(); |
259 Node node = element.parseNode(compiler); | 261 Node node = element.parseNode(compiler); |
260 var collector = new DependencyCollector(elements, compiler); | 262 var collector = new DependencyCollector(elements, compiler); |
261 node.accept(collector); | 263 node.accept(collector); |
262 collector.dependencies.addAll(elements.otherDependencies); | 264 collector.dependencies.addAll(elements.otherDependencies); |
263 return collector.dependencies; | 265 return collector.dependencies; |
264 } | 266 } |
265 } | 267 } |
OLD | NEW |