| Index: tests/compiler/dart2js/output_collector.dart
|
| diff --git a/tests/compiler/dart2js/output_collector.dart b/tests/compiler/dart2js/output_collector.dart
|
| index 7eb7486eb582872e4936475f76cab5615d5af678..20d85408221c4dd7d966714360970921c510c323 100644
|
| --- a/tests/compiler/dart2js/output_collector.dart
|
| +++ b/tests/compiler/dart2js/output_collector.dart
|
| @@ -9,7 +9,7 @@ library output_collector;
|
| import 'dart:async';
|
| import 'package:compiler/compiler_new.dart';
|
|
|
| -class BufferedEventSink implements EventSink<String> {
|
| +class BufferedOutputSink implements OutputSink {
|
| StringBuffer sb = new StringBuffer();
|
| String text;
|
|
|
| @@ -17,50 +17,35 @@ class BufferedEventSink implements EventSink<String> {
|
| sb.write(event);
|
| }
|
|
|
| - void addError(errorEvent, [StackTrace stackTrace]) {
|
| - // Do not support this.
|
| - }
|
| -
|
| void close() {
|
| text = sb.toString();
|
| sb = null;
|
| }
|
| }
|
|
|
| -class CloningEventSink implements EventSink<String> {
|
| - final List<EventSink<String>> sinks;
|
| +class CloningOutputSink implements OutputSink {
|
| + final List<OutputSink> sinks;
|
|
|
| - CloningEventSink(this.sinks);
|
| + CloningOutputSink(this.sinks);
|
|
|
| @override
|
| void add(String event) {
|
| - sinks.forEach((EventSink<String> sink) => sink.add(event));
|
| - }
|
| -
|
| - @override
|
| - void addError(errorEvent, [StackTrace stackTrace]) {
|
| - sinks.forEach((EventSink<String> sink) {
|
| - sink.addError(errorEvent, stackTrace);
|
| - });
|
| + sinks.forEach((OutputSink sink) => sink.add(event));
|
| }
|
|
|
| @override
|
| void close() {
|
| - sinks.forEach((EventSink<String> sink) => sink.close());
|
| + sinks.forEach((OutputSink sink) => sink.close());
|
| }
|
| }
|
|
|
| class OutputCollector implements CompilerOutput {
|
| - Map<String, Map<String, BufferedEventSink>> outputMap = {};
|
| -
|
| - EventSink<String> call(String name, String extension) {
|
| - return createEventSink(name, extension);
|
| - }
|
| + Map<OutputType, Map<String, BufferedOutputSink>> outputMap = {};
|
|
|
| - String getOutput(String name, String extension) {
|
| - Map<String, BufferedEventSink> sinkMap = outputMap[extension];
|
| + String getOutput(String name, OutputType type) {
|
| + Map<String, BufferedOutputSink> sinkMap = outputMap[type];
|
| if (sinkMap == null) return null;
|
| - BufferedEventSink sink = sinkMap[name];
|
| + BufferedOutputSink sink = sinkMap[name];
|
| return sink != null ? sink.text : null;
|
| }
|
|
|
| @@ -69,8 +54,8 @@ class OutputCollector implements CompilerOutput {
|
|
|
| /// `true` if any output other than main output has been collected.
|
| bool get hasExtraOutput {
|
| - for (String extension in outputMap.keys) {
|
| - for (String name in outputMap[extension].keys) {
|
| + for (OutputType type in outputMap.keys) {
|
| + for (String name in outputMap[type].keys) {
|
| if (name != '') return true;
|
| }
|
| }
|
| @@ -78,9 +63,9 @@ class OutputCollector implements CompilerOutput {
|
| }
|
|
|
| @override
|
| - EventSink<String> createEventSink(String name, String extension) {
|
| - Map<String, BufferedEventSink> sinkMap =
|
| - outputMap.putIfAbsent(extension, () => {});
|
| - return sinkMap.putIfAbsent(name, () => new BufferedEventSink());
|
| + OutputSink createOutputSink(String name, String extension, OutputType type) {
|
| + Map<String, BufferedOutputSink> sinkMap =
|
| + outputMap.putIfAbsent(type, () => {});
|
| + return sinkMap.putIfAbsent(name, () => new BufferedOutputSink());
|
| }
|
| }
|
|
|