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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Null pattern implementation of the [CompilerOutput] interface.
6
7 library compiler.null_api;
8
9 import '../compiler_new.dart';
10 import 'dart:async';
11
12 /// Null pattern implementation of the [CompilerOutput] interface.
13 class NullCompilerOutput implements CompilerOutput {
14 const NullCompilerOutput();
15
16 @override
17 EventSink<String> createEventSink(String name, String extension) {
18 return NullSink.outputProvider(name, extension);
19 }
20 }
21
22 /// A sink that drains into /dev/null.
23 class NullSink implements EventSink<String> {
24 final String name;
25
26 NullSink(this.name);
27
28 add(String value) {}
29
30 void addError(Object error, [StackTrace stackTrace]) {}
31
32 void close() {}
33
34 toString() => name;
35
36 /// Convenience method for getting an [api.CompilerOutputProvider].
37 static NullSink outputProvider(String name, String extension) {
38 return new NullSink('$name.$extension');
39 }
40 }
OLDNEW
« 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