Chromium Code Reviews| Index: pkg/compiler/lib/compiler_new.dart |
| diff --git a/pkg/compiler/lib/compiler_new.dart b/pkg/compiler/lib/compiler_new.dart |
| index 5ba94cb370c56339c34c973be4fdfd2e7234b8a7..09ddb6bfd0a64d3f6d56931b2ae5e9fbe0da6799 100644 |
| --- a/pkg/compiler/lib/compiler_new.dart |
| +++ b/pkg/compiler/lib/compiler_new.dart |
| @@ -36,28 +36,49 @@ abstract class CompilerInput { |
| Future/*<String | List<int>>*/ readFromUri(Uri uri); |
| } |
| +/// Output types used in `CompilerOutput.createOutputSink`. |
| +enum OutputType { |
| + /// The main JavaScript output. |
| + js, |
| + |
| + /// A deferred JavaScript output part. |
| + part, |
|
Siggi Cherem (dart-lang)
2017/02/14 23:14:17
nit: rename to jsPart or jsChunk?
Johnni Winther
2017/02/20 09:18:11
Done.
|
| + |
| + /// A source map for a JavaScript output. |
| + js_map, |
|
Siggi Cherem (dart-lang)
2017/02/14 23:14:17
nit: jsMap (maybe sourceMap is better?)
Johnni Winther
2017/02/20 09:18:11
Done.
|
| + |
| + /// Serialization data output. |
| + serialization_data, |
|
Siggi Cherem (dart-lang)
2017/02/14 23:14:17
serializationData
Johnni Winther
2017/02/20 09:18:11
Done.
|
| + |
| + /// Additional information requested by the user, such dump info or a deferred |
| + /// map. |
| + info, |
| + |
| + /// Implementation specific output used for debugging the compiler. |
| + debug, |
| +} |
| + |
| +/// Sink interface used for generating output from the compiler. |
| +abstract class OutputSink { |
| + /// Adds [text] to the sink. |
| + void add(String text); |
| + |
| + /// Closes the sink. |
| + void close(); |
| +} |
| + |
| /// Interface for producing output from the compiler. That is, JavaScript target |
| /// files, source map files, dump info files, etc. |
| abstract class CompilerOutput { |
| - /// Returns an [EventSink] that will serve as compiler output for the given |
| + /// Returns an [OutputSink] that will serve as compiler output for the given |
| /// component. |
| /// |
| - /// Components are identified by [name] and [extension]. By convention, |
| - /// the empty string [:"":] will represent the main script |
| - /// (corresponding to the script parameter of [compile]) even if the |
| - /// main script is a library. For libraries that are compiled |
| - /// separately, the library name is used. |
| - /// |
| - /// At least the following extensions can be expected: |
| - /// |
| - /// * "js" for JavaScript output. |
| - /// * "js.map" for source maps. |
| - /// * "dart" for Dart output. |
| - /// * "dart.map" for source maps. |
| - /// |
| - /// As more features are added to the compiler, new names and |
| - /// extensions may be introduced. |
| - EventSink<String> createEventSink(String name, String extension); |
| + /// Components are identified by [name], [extension], and [type]. By |
| + /// convention, the empty string `""` will represent the main output of the |
| + /// provided [type]. [name] and [extension] are otherwise suggestive. |
| + // TODO(johnniwinther): Replace [name] and [extension] with something like |
| + // [id] and [uri]. |
| + OutputSink createOutputSink(String name, String extension, OutputType type); |
| } |
| /// Interface for receiving diagnostic message from the compiler. That is, |