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

Unified Diff: pkg/compiler/lib/src/null_compiler_output.dart

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 years, 5 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
« no previous file with comments | « pkg/compiler/lib/src/mirrors/analyze.dart ('k') | pkg/compiler/lib/src/old_to_new_api.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/null_compiler_output.dart
diff --git a/pkg/compiler/lib/src/null_compiler_output.dart b/pkg/compiler/lib/src/null_compiler_output.dart
new file mode 100644
index 0000000000000000000000000000000000000000..acc323fe4b2d7c9a640e163fe9100f446e1b30bf
--- /dev/null
+++ b/pkg/compiler/lib/src/null_compiler_output.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Null pattern implementation of the [CompilerOutput] interface.
+
+library compiler.null_api;
+
+import '../compiler_new.dart';
+import 'dart:async';
+
+/// Null pattern implementation of the [CompilerOutput] interface.
+class NullCompilerOutput implements CompilerOutput {
+ const NullCompilerOutput();
+
+ @override
+ EventSink<String> createEventSink(String name, String extension) {
+ return NullSink.outputProvider(name, extension);
+ }
+}
+
+/// A sink that drains into /dev/null.
+class NullSink implements EventSink<String> {
+ final String name;
+
+ NullSink(this.name);
+
+ add(String value) {}
+
+ void addError(Object error, [StackTrace stackTrace]) {}
+
+ void close() {}
+
+ toString() => name;
+
+ /// Convenience method for getting an [api.CompilerOutputProvider].
+ static NullSink outputProvider(String name, String extension) {
+ return new NullSink('$name.$extension');
+ }
+}
« no previous file with comments | « pkg/compiler/lib/src/mirrors/analyze.dart ('k') | pkg/compiler/lib/src/old_to_new_api.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698