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

Unified Diff: pkg/dart2js_incremental/lib/caching_compiler.dart

Issue 832363002: Remove Compiler.assembledCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix unittest Created 5 years, 11 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: pkg/dart2js_incremental/lib/caching_compiler.dart
diff --git a/pkg/dart2js_incremental/lib/caching_compiler.dart b/pkg/dart2js_incremental/lib/caching_compiler.dart
index 61e3306edd82c8d1908d0381fccddab23abe590f..1fec6d5ce7ed90d2ade0407ea58c5abeda2994a0 100644
--- a/pkg/dart2js_incremental/lib/caching_compiler.dart
+++ b/pkg/dart2js_incremental/lib/caching_compiler.dart
@@ -98,7 +98,6 @@ Future<Compiler> reuseCompiler(
..enqueuer.codegen.queueIsClosed = false
..enqueuer.codegen.hasEnqueuedReflectiveElements = false
..enqueuer.codegen.hasEnqueuedReflectiveStaticFields = false
- ..assembledCode = null
..compilationFailed = false;
JavaScriptBackend backend = compiler.backend;
@@ -173,3 +172,41 @@ Future<Compiler> reuseCompiler(
});
}
}
+
+/// Helper class to collect sources.
+class StringEventSink implements EventSink<String> {
+ List<String> data = <String>[];
+
+ final Function onClose;
+
+ StringEventSink(this.onClose);
+
+ void add(String event) {
+ if (data == null) throw 'StringEventSink is closed.';
+ data.add(event);
+ }
+
+ void addError(errorEvent, [StackTrace stackTrace]) {
+ throw 'addError($errorEvent, $stackTrace)';
+ }
+
+ void close() {
+ if (data != null) {
+ onClose(data.join());
+ data = null;
+ }
+ }
+}
+
+/// Output provider which collect output in [output].
+class OutputProvider {
+ final Map<String, String> output = new Map<String, String>();
+
+ EventSink<String> call(String name, String extension) {
+ return new StringEventSink((String data) {
+ output['$name.$extension'] = data;
+ });
+ }
+
+ String operator[] (String key) => output[key];
+}
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | pkg/dart2js_incremental/lib/dart2js_incremental.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698