OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Output provider that collects the output in string buffers. | 5 // Output provider that collects the output in string buffers. |
6 | 6 |
7 library output_collector; | 7 library output_collector; |
8 | 8 |
9 import 'dart:async'; | |
10 import 'package:compiler/compiler_new.dart'; | 9 import 'package:compiler/compiler_new.dart'; |
11 | 10 |
12 class BufferedOutputSink implements OutputSink { | 11 class BufferedOutputSink implements OutputSink { |
13 StringBuffer sb = new StringBuffer(); | 12 StringBuffer sb = new StringBuffer(); |
14 String text; | 13 String text; |
15 | 14 |
16 void add(String event) { | 15 void add(String event) { |
17 sb.write(event); | 16 sb.write(event); |
18 } | 17 } |
19 | 18 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return false; | 73 return false; |
75 } | 74 } |
76 | 75 |
77 @override | 76 @override |
78 OutputSink createOutputSink(String name, String extension, OutputType type) { | 77 OutputSink createOutputSink(String name, String extension, OutputType type) { |
79 Map<String, BufferedOutputSink> sinkMap = | 78 Map<String, BufferedOutputSink> sinkMap = |
80 outputMap.putIfAbsent(type, () => {}); | 79 outputMap.putIfAbsent(type, () => {}); |
81 return sinkMap.putIfAbsent(name, () => new BufferedOutputSink()); | 80 return sinkMap.putIfAbsent(name, () => new BufferedOutputSink()); |
82 } | 81 } |
83 } | 82 } |
OLD | NEW |