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

Side by Side Diff: pkg/compiler/lib/src/dart2js.dart

Issue 2239933003: Ensure that no scripts are resolved when compiling purely from deserialized data. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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/compiler.dart ('k') | pkg/compiler/lib/src/options.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.cmdline; 5 library dart2js.cmdline;
6 6
7 import 'dart:async' show EventSink, Future; 7 import 'dart:async' show EventSink, Future;
8 import 'dart:convert' show UTF8, LineSplitter; 8 import 'dart:convert' show UTF8, LineSplitter;
9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr;
10 10
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 final Uri _SERIALIZED_DART_CORE_URI = Uri.parse('file:core.data'); 829 final Uri _SERIALIZED_DART_CORE_URI = Uri.parse('file:core.data');
830 final Uri _SERIALIZED_TEST_URI = Uri.parse('file:test.data'); 830 final Uri _SERIALIZED_TEST_URI = Uri.parse('file:test.data');
831 831
832 void _useSerializedDataForDartCore(CompileFunc oldCompileFunc) { 832 void _useSerializedDataForDartCore(CompileFunc oldCompileFunc) {
833 /// Run the [oldCompileFunc] with [serializedData] added as resolution input. 833 /// Run the [oldCompileFunc] with [serializedData] added as resolution input.
834 Future<api.CompilationResult> compileWithSerializedData( 834 Future<api.CompilationResult> compileWithSerializedData(
835 CompilerOptions compilerOptions, 835 CompilerOptions compilerOptions,
836 api.CompilerInput compilerInput, 836 api.CompilerInput compilerInput,
837 api.CompilerDiagnostics compilerDiagnostics, 837 api.CompilerDiagnostics compilerDiagnostics,
838 api.CompilerOutput compilerOutput, 838 api.CompilerOutput compilerOutput,
839 List<_SerializedData> serializedData) { 839 List<_SerializedData> serializedData,
840 {bool compileOnly: false}) {
840 api.CompilerInput input = compilerInput; 841 api.CompilerInput input = compilerInput;
841 CompilerOptions options = compilerOptions; 842 CompilerOptions options = compilerOptions;
842 if (serializedData != null && serializedData.isNotEmpty) { 843 if (serializedData != null && serializedData.isNotEmpty) {
843 Map<Uri, String> dataMap = <Uri, String>{}; 844 Map<Uri, String> dataMap = <Uri, String>{};
844 for (_SerializedData data in serializedData) { 845 for (_SerializedData data in serializedData) {
845 dataMap[data.uri] = data.data; 846 dataMap[data.uri] = data.data;
846 } 847 }
847 input = new _CompilerInput(input, dataMap); 848 input = new _CompilerInput(input, dataMap);
848 List<Uri> resolutionInputs = dataMap.keys.toList(); 849 List<Uri> resolutionInputs = dataMap.keys.toList();
849 if (compilerOptions.resolutionInputs != null) { 850 if (compilerOptions.resolutionInputs != null) {
850 for (Uri uri in compilerOptions.resolutionInputs) { 851 for (Uri uri in compilerOptions.resolutionInputs) {
851 if (!dataMap.containsKey(uri)) { 852 if (!dataMap.containsKey(uri)) {
852 resolutionInputs.add(uri); 853 resolutionInputs.add(uri);
853 } 854 }
854 } 855 }
855 } 856 }
856 options = 857 options =
857 CompilerOptions.copy(options, resolutionInputs: resolutionInputs); 858 CompilerOptions.copy(options,
859 resolutionInputs: resolutionInputs,
860 compileOnly: compileOnly);
858 } 861 }
859 return oldCompileFunc(options, input, compilerDiagnostics, compilerOutput); 862 return oldCompileFunc(options, input, compilerDiagnostics, compilerOutput);
860 } 863 }
861 864
862 /// Serialize [entryPoint] using [serializedData] if provided. 865 /// Serialize [entryPoint] using [serializedData] if provided.
863 Future<api.CompilationResult> serialize( 866 Future<api.CompilationResult> serialize(
864 Uri entryPoint, 867 Uri entryPoint,
865 Uri serializedUri, 868 Uri serializedUri,
866 CompilerOptions compilerOptions, 869 CompilerOptions compilerOptions,
867 api.CompilerInput compilerInput, 870 api.CompilerInput compilerInput,
(...skipping 30 matching lines...) Expand all
898 output, 901 output,
899 [serializedDartCore]); 902 [serializedDartCore]);
900 if (!result.isSuccess) { 903 if (!result.isSuccess) {
901 return result; 904 return result;
902 } 905 }
903 return compileWithSerializedData( 906 return compileWithSerializedData(
904 compilerOptions, 907 compilerOptions,
905 compilerInput, 908 compilerInput,
906 compilerDiagnostics, 909 compilerDiagnostics,
907 compilerOutput, 910 compilerOutput,
908 [serializedDartCore, output.serializedData]); 911 [serializedDartCore, output.serializedData],
912 compileOnly: true);
909 } 913 }
910 914
911 /// Compiles the entry point using the serialized data from dart:core. 915 /// Compiles the entry point using the serialized data from dart:core.
912 Future<api.CompilationResult> compileWithSerializedDartCoreData( 916 Future<api.CompilationResult> compileWithSerializedDartCoreData(
913 CompilerOptions compilerOptions, 917 CompilerOptions compilerOptions,
914 api.CompilerInput compilerInput, 918 api.CompilerInput compilerInput,
915 api.CompilerDiagnostics compilerDiagnostics, 919 api.CompilerDiagnostics compilerDiagnostics,
916 api.CompilerOutput compilerOutput) async { 920 api.CompilerOutput compilerOutput) async {
917 return compileWithSerializedData(compilerOptions, compilerInput, 921 return compileWithSerializedData(compilerOptions, compilerInput,
918 compilerDiagnostics, compilerOutput, [serializedDartCore]); 922 compilerDiagnostics, compilerOutput, [serializedDartCore]);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 @override 998 @override
995 void close() { 999 void close() {
996 // Do nothing. 1000 // Do nothing.
997 } 1001 }
998 1002
999 @override 1003 @override
1000 void addError(errorEvent, [StackTrace stackTrace]) { 1004 void addError(errorEvent, [StackTrace stackTrace]) {
1001 // Ignore 1005 // Ignore
1002 } 1006 }
1003 } 1007 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698