OLD | NEW |
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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 } | 871 } |
872 input = new _CompilerInput(input, dataMap); | 872 input = new _CompilerInput(input, dataMap); |
873 List<Uri> resolutionInputs = dataMap.keys.toList(); | 873 List<Uri> resolutionInputs = dataMap.keys.toList(); |
874 if (compilerOptions.resolutionInputs != null) { | 874 if (compilerOptions.resolutionInputs != null) { |
875 for (Uri uri in compilerOptions.resolutionInputs) { | 875 for (Uri uri in compilerOptions.resolutionInputs) { |
876 if (!dataMap.containsKey(uri)) { | 876 if (!dataMap.containsKey(uri)) { |
877 resolutionInputs.add(uri); | 877 resolutionInputs.add(uri); |
878 } | 878 } |
879 } | 879 } |
880 } | 880 } |
881 options = options.copy(resolutionInputs: resolutionInputs); | 881 options = |
| 882 CompilerOptions.copy(options, resolutionInputs: resolutionInputs); |
882 } | 883 } |
883 return oldCompileFunc(options, input, compilerDiagnostics, compilerOutput); | 884 return oldCompileFunc(options, input, compilerDiagnostics, compilerOutput); |
884 } | 885 } |
885 | 886 |
886 /// Serialize [entryPoint] using [serializedData] if provided. | 887 /// Serialize [entryPoint] using [serializedData] if provided. |
887 Future<api.CompilationResult> serialize( | 888 Future<api.CompilationResult> serialize( |
888 Uri entryPoint, | 889 Uri entryPoint, |
889 Uri serializedUri, | 890 Uri serializedUri, |
890 CompilerOptions compilerOptions, | 891 CompilerOptions compilerOptions, |
891 api.CompilerInput compilerInput, | 892 api.CompilerInput compilerInput, |
892 api.CompilerDiagnostics compilerDiagnostics, | 893 api.CompilerDiagnostics compilerDiagnostics, |
893 api.CompilerOutput compilerOutput, | 894 api.CompilerOutput compilerOutput, |
894 [List<_SerializedData> serializedData]) { | 895 [List<_SerializedData> serializedData]) { |
895 CompilerOptions options = new CompilerOptions.parse( | 896 CompilerOptions options = CompilerOptions.copy(compilerOptions, |
896 entryPoint: entryPoint, | 897 entryPoint: entryPoint, |
897 libraryRoot: compilerOptions.libraryRoot, | |
898 packageRoot: compilerOptions.packageRoot, | |
899 packageConfig: compilerOptions.packageConfig, | |
900 packagesDiscoveryProvider: compilerOptions.packagesDiscoveryProvider, | |
901 environment: compilerOptions.environment, | |
902 resolutionOutput: serializedUri, | 898 resolutionOutput: serializedUri, |
903 options: [Flags.resolveOnly]); | 899 analyzeAll: true, |
| 900 analyzeOnly: true, |
| 901 resolveOnly: true); |
904 return compileWithSerializedData(options, compilerInput, | 902 return compileWithSerializedData(options, compilerInput, |
905 compilerDiagnostics, compilerOutput, serializedData); | 903 compilerDiagnostics, compilerOutput, serializedData); |
906 } | 904 } |
907 | 905 |
908 // Local cache for the serialized data for dart:core. | 906 // Local cache for the serialized data for dart:core. |
909 _SerializedData serializedDartCore; | 907 _SerializedData serializedDartCore; |
910 | 908 |
911 /// Serialize the entry point using serialized data from dart:core and run | 909 /// Serialize the entry point using serialized data from dart:core and run |
912 /// [oldCompileFunc] using serialized data for whole program. | 910 /// [oldCompileFunc] using serialized data for whole program. |
913 Future<api.CompilationResult> compileFromSerializedData( | 911 Future<api.CompilationResult> compileFromSerializedData( |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 @override | 1019 @override |
1022 void close() { | 1020 void close() { |
1023 // Do nothing. | 1021 // Do nothing. |
1024 } | 1022 } |
1025 | 1023 |
1026 @override | 1024 @override |
1027 void addError(errorEvent, [StackTrace stackTrace]) { | 1025 void addError(errorEvent, [StackTrace stackTrace]) { |
1028 // Ignore | 1026 // Ignore |
1029 } | 1027 } |
1030 } | 1028 } |
OLD | NEW |