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

Side by Side Diff: tests/compiler/dart2js/output_collector.dart

Issue 2912083002: Add compile_from_dill test (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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'; 9 import 'dart:async';
10 import 'package:compiler/compiler_new.dart'; 10 import 'package:compiler/compiler_new.dart';
11 11
12 class BufferedOutputSink implements OutputSink { 12 class BufferedOutputSink implements OutputSink {
13 StringBuffer sb = new StringBuffer(); 13 StringBuffer sb = new StringBuffer();
14 String text; 14 String text;
15 15
16 void add(String event) { 16 void add(String event) {
17 sb.write(event); 17 sb.write(event);
18 } 18 }
19 19
20 void close() { 20 void close() {
21 text = sb.toString(); 21 text = sb.toString();
22 sb = null; 22 sb = null;
23 } 23 }
24
25 String toString() {
Siggi Cherem (dart-lang) 2017/05/30 22:34:43 I didn't see where this was used? only for debuggi
Johnni Winther 2017/05/31 09:08:40 For debugging
26 return text ?? sb.toString();
27 }
24 } 28 }
25 29
26 class CloningOutputSink implements OutputSink { 30 class CloningOutputSink implements OutputSink {
27 final List<OutputSink> sinks; 31 final List<OutputSink> sinks;
28 32
29 CloningOutputSink(this.sinks); 33 CloningOutputSink(this.sinks);
30 34
31 @override 35 @override
32 void add(String event) { 36 void add(String event) {
33 sinks.forEach((OutputSink sink) => sink.add(event)); 37 sinks.forEach((OutputSink sink) => sink.add(event));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return false; 74 return false;
71 } 75 }
72 76
73 @override 77 @override
74 OutputSink createOutputSink(String name, String extension, OutputType type) { 78 OutputSink createOutputSink(String name, String extension, OutputType type) {
75 Map<String, BufferedOutputSink> sinkMap = 79 Map<String, BufferedOutputSink> sinkMap =
76 outputMap.putIfAbsent(type, () => {}); 80 outputMap.putIfAbsent(type, () => {});
77 return sinkMap.putIfAbsent(name, () => new BufferedOutputSink()); 81 return sinkMap.putIfAbsent(name, () => new BufferedOutputSink());
78 } 82 }
79 } 83 }
OLDNEW
« pkg/compiler/lib/src/world.dart ('K') | « tests/compiler/dart2js/kernel/compiler_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698