Chromium Code Reviews| Index: pkg/compiler/lib/src/old_to_new_api.dart |
| diff --git a/pkg/compiler/lib/src/old_to_new_api.dart b/pkg/compiler/lib/src/old_to_new_api.dart |
| index d79b5f9b5ea8905f75e2e9a49e0e179d9149cc15..57f7d954087cd76abf39a59ed8d2dd0e3b24240a 100644 |
| --- a/pkg/compiler/lib/src/old_to_new_api.dart |
| +++ b/pkg/compiler/lib/src/old_to_new_api.dart |
| @@ -40,14 +40,37 @@ class LegacyCompilerDiagnostics implements CompilerDiagnostics { |
| /// Implementation of [CompilerOutput] using an optional |
| /// [CompilerOutputProvider]. |
| +// TODO(johnniwinther): Change Pub to use the new interface and remove this. |
| class LegacyCompilerOutput implements CompilerOutput { |
| final CompilerOutputProvider _outputProvider; |
| LegacyCompilerOutput([this._outputProvider]); |
| @override |
| - EventSink<String> createEventSink(String name, String extension) { |
| - if (_outputProvider != null) return _outputProvider(name, extension); |
| - return NullSink.outputProvider(name, extension); |
| + OutputSink createOutputSink(String name, String extension, OutputType type) { |
| + if (_outputProvider != null) { |
| + switch (type) { |
| + case OutputType.info: |
| + if (extension == '') { |
| + extension = 'deferred_map'; |
|
Siggi Cherem (dart-lang)
2017/02/14 23:14:17
seems odd to inject that here, can you comment why
Johnni Winther
2017/02/20 09:18:11
Pub uses '$name.$extension' as output name, so thi
|
| + } |
| + break; |
| + default: |
| + } |
| + return new LegacyOutputSink(_outputProvider(name, extension)); |
| + } |
| + return NullSink.outputProvider(name, extension, type); |
| } |
| } |
| + |
| +class LegacyOutputSink implements OutputSink { |
| + final EventSink<String> sink; |
| + |
| + LegacyOutputSink(this.sink); |
| + |
| + @override |
| + void add(String event) => sink.add(event); |
| + |
| + @override |
| + void close() => sink.close(); |
| +} |