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

Unified Diff: pkg/compiler/lib/compiler_new.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | pkg/compiler/lib/src/old_to_new_api.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | pkg/compiler/lib/src/old_to_new_api.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698