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

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

Issue 1975153002: Support (de)serialization from command-line (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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
Index: pkg/compiler/lib/src/source_file_provider.dart
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index da154195c312ebffb08e74dcb87089b446ac043d..78a5802b0200b7a20ea8be4b6f2ee6c5d6dd729e 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -238,9 +238,10 @@ class FormattingDiagnosticHandler implements CompilerDiagnostics {
typedef void MessageCallback(String message);
-class RandomAccessFileOutputProvider {
+class RandomAccessFileOutputProvider implements CompilerOutput {
final Uri out;
final Uri sourceMapOut;
+ final Uri serializationTarget;
final MessageCallback onInfo;
final MessageCallback onFailure;
@@ -248,7 +249,7 @@ class RandomAccessFileOutputProvider {
List<String> allOutputFiles = new List<String>();
RandomAccessFileOutputProvider(this.out, this.sourceMapOut,
- {this.onInfo, this.onFailure});
+ {this.onInfo, this.onFailure, this.serializationTarget});
static Uri computePrecompiledUri(Uri out) {
String extension = 'precompiled.js';
@@ -262,6 +263,10 @@ class RandomAccessFileOutputProvider {
}
EventSink<String> call(String name, String extension) {
+ return createEventSink(name, extension);
+ }
+
+ EventSink<String> createEventSink(String name, String extension) {
Uri uri;
bool isPrimaryOutput = false;
// TODO (johnniwinther, sigurdm): Make a better interface for
@@ -278,9 +283,14 @@ class RandomAccessFileOutputProvider {
" \"Content-Security-Policy: script-src 'self'\"");
} else if (extension == 'js.map' || extension == 'dart.map') {
uri = sourceMapOut;
- } else if (extension == "info.json") {
+ } else if (extension == 'info.json') {
String outName = out.path.substring(out.path.lastIndexOf('/') + 1);
uri = out.resolve('$outName.$extension');
+ } else if (extension == 'data') {
+ if (serializationTarget == null) {
+ onFailure('Serialization target unspecified.');
+ }
+ uri = serializationTarget;
} else {
onFailure('Unknown extension: $extension');
}

Powered by Google App Engine
This is Rietveld 408576698