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

Unified Diff: sdk/lib/_internal/compiler/implementation/patch_parser.dart

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove withCurrentElementAsync Created 7 years, 5 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
Index: sdk/lib/_internal/compiler/implementation/patch_parser.dart
diff --git a/sdk/lib/_internal/compiler/implementation/patch_parser.dart b/sdk/lib/_internal/compiler/implementation/patch_parser.dart
index 5827a3de7d1144fc58998e8561b5f6139227609f..98e2fb0c6ae2725d4ee75c5ff1d61a6f70152758 100644
--- a/sdk/lib/_internal/compiler/implementation/patch_parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/patch_parser.dart
@@ -114,6 +114,8 @@
library patchparser;
+import 'dart:async';
+
import "tree/tree.dart" as tree;
import "dart2jslib.dart" as leg; // CompilerTask, Compiler.
import "../compiler.dart" as api;
@@ -131,14 +133,12 @@ class PatchParserTask extends leg.CompilerTask {
* injections to the library, and returns a list of class
* patches.
*/
- void patchLibrary(leg.LibraryDependencyHandler handler,
+ Future patchLibrary(leg.LibraryDependencyHandler handler,
Uri patchUri, LibraryElement originLibrary) {
-
- leg.Script script = compiler.readScript(patchUri, null);
- var patchLibrary = new LibraryElementX(script, null, originLibrary);
- compiler.withCurrentElement(patchLibrary, () {
+ return compiler.readScript(patchUri, null).then((leg.Script script) {
+ var patchLibrary = new LibraryElementX(script, null, originLibrary);
handler.registerNewLibrary(patchLibrary);
ahe 2013/08/06 16:29:17 Shouldn't lines 140-141 be inside withCurrentEleme
Johnni Winther 2013/08/27 11:05:00 Done.
- LinkBuilder<tree.LibraryTag> imports = new LinkBuilder<tree.LibraryTag>();
+ var imports = new LinkBuilder<tree.LibraryTag>();
compiler.withCurrentElement(patchLibrary.entryCompilationUnit, () {
// This patches the elements of the patch library into [library].
// Injected elements are added directly under the compilation unit.
@@ -149,10 +149,11 @@ class PatchParserTask extends leg.CompilerTask {
// TODO(lrn): These imports end up in the original library and are in
// scope for the original methods too. This should be fixed.
compiler.importHelperLibrary(originLibrary);
- for (tree.LibraryTag tag in imports.toLink()) {
- compiler.libraryLoader.registerLibraryFromTag(
- handler, patchLibrary, tag);
- }
+ // TODO(rnystrom): Remove .toList() here if #11523 is fixed.
+ return Future.forEach(imports.toLink().toList(), (tag) {
ahe 2013/08/06 16:29:17 Shouldn't there be a withCurrentElement here?
Johnni Winther 2013/08/27 11:05:00 Done.
+ return compiler.libraryLoader.registerLibraryFromTag(
+ handler, patchLibrary, tag);
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698