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

Unified Diff: tests/compiler/dart2js/memory_compiler.dart

Issue 824103005: Revert "Remove Compiler.assembledCode." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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: tests/compiler/dart2js/memory_compiler.dart
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index 017db0a1428b298106fc84b848977a2c40b87776..88bc8e217c5f6fd8b1ad541ed206829bdb2750db 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -20,8 +20,6 @@ import 'package:compiler/src/mirrors/analyze.dart';
import 'package:compiler/src/library_loader.dart'
show LoadedLibraries;
-export 'output_collector.dart';
-
class DiagnosticMessage {
final Uri uri;
final int begin;
@@ -64,6 +62,41 @@ class DiagnosticCollector {
}
}
+class BufferedEventSink implements EventSink<String> {
+ StringBuffer sb = new StringBuffer();
+ String text;
+
+ void add(String event) {
+ sb.write(event);
+ }
+
+ void addError(errorEvent, [StackTrace stackTrace]) {
+ // Do not support this.
+ }
+
+ void close() {
+ text = sb.toString();
+ sb = null;
+ }
+}
+
+class OutputCollector {
+ Map<String, Map<String, BufferedEventSink>> outputMap = {};
+
+ EventSink<String> call(String name, String extension) {
+ Map<String, BufferedEventSink> sinkMap =
+ outputMap.putIfAbsent(extension, () => {});
+ return sinkMap.putIfAbsent(name, () => new BufferedEventSink());
+ }
+
+ String getOutput(String name, String extension) {
+ Map<String, BufferedEventSink> sinkMap = outputMap[extension];
+ if (sinkMap == null) return null;
+ BufferedEventSink sink = sinkMap[name];
+ return sink != null ? sink.text : null;
+ }
+}
+
DiagnosticHandler createDiagnosticHandler(DiagnosticHandler diagnosticHandler,
SourceFileProvider provider,
bool showDiagnostics) {
@@ -208,7 +241,7 @@ class MemoryLoadedLibraries implements LoadedLibraries {
bool containsLibrary(Uri uri) => copiedLibraries.containsKey(uri);
@override
- void forEachImportChain(f, {callback}) {}
+ void forEachImportChain(f) {}
@override
void forEachLibrary(f) {}
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_test.dart ('k') | tests/compiler/dart2js/mirror_helper_rename_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698