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

Side by Side Diff: pkg/compiler/lib/src/null_compiler_output.dart

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Cleanup. Created 3 years, 10 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 /// Null pattern implementation of the [CompilerOutput] interface. 5 /// Null pattern implementation of the [CompilerOutput] interface.
6 6
7 library compiler.null_api; 7 library compiler.null_api;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
11 import '../compiler_new.dart'; 11 import '../compiler_new.dart';
12 12
13 /// Null pattern implementation of the [CompilerOutput] interface. 13 /// Null pattern implementation of the [CompilerOutput] interface.
14 class NullCompilerOutput implements CompilerOutput { 14 class NullCompilerOutput implements CompilerOutput {
15 const NullCompilerOutput(); 15 const NullCompilerOutput();
16 16
17 @override 17 @override
18 EventSink<String> createEventSink(String name, String extension) { 18 OutputSink createOutputSink(String name, String extension, OutputType type) {
19 return NullSink.outputProvider(name, extension); 19 return NullSink.outputProvider(name, extension, type);
20 } 20 }
21 } 21 }
22 22
23 /// A sink that drains into /dev/null. 23 /// A sink that drains into /dev/null.
24 class NullSink implements EventSink<String> { 24 class NullSink implements OutputSink {
25 final String name; 25 final String name;
26 26
27 NullSink(this.name); 27 NullSink(this.name);
28 28
29 add(String value) {} 29 add(String value) {}
30 30
31 void addError(Object error, [StackTrace stackTrace]) {}
32
33 void close() {} 31 void close() {}
34 32
35 toString() => name; 33 toString() => name;
36 34
37 /// Convenience method for getting an [api.CompilerOutputProvider]. 35 /// Convenience method for getting an [api.CompilerOutputProvider].
38 static NullSink outputProvider(String name, String extension) { 36 static NullSink outputProvider(
39 return new NullSink('$name.$extension'); 37 String name, String extension, OutputType type) {
38 return new NullSink('$name.$extension.$type');
40 } 39 }
41 } 40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698