OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 front_end.compiler_options; | 5 library front_end.compiler_options; |
6 | 6 |
7 import 'compilation_error.dart'; | 7 import 'compilation_error.dart'; |
8 import 'file_system.dart'; | 8 import 'file_system.dart'; |
9 import 'physical_file_system.dart'; | 9 import 'physical_file_system.dart'; |
10 | 10 |
| 11 /// Default error handler used by [CompielerOptions.onError]. |
| 12 void defaultErrorHandler(CompilationError error) => throw error; |
| 13 |
11 /// Callback used to report errors encountered during compilation. | 14 /// Callback used to report errors encountered during compilation. |
12 typedef void ErrorHandler(CompilationError error); | 15 typedef void ErrorHandler(CompilationError error); |
13 | 16 |
14 /// Front-end options relevant to compiler back ends. | 17 /// Front-end options relevant to compiler back ends. |
15 /// | 18 /// |
16 /// Not intended to be implemented or extended by clients. | 19 /// Not intended to be implemented or extended by clients. |
17 class CompilerOptions { | 20 class CompilerOptions { |
18 /// The path to the Dart SDK. | 21 /// The path to the Dart SDK. |
19 /// | 22 /// |
20 /// If `null`, the SDK will be searched for using | 23 /// If `null`, the SDK will be searched for using |
21 /// [Platform.resolvedExecutable] as a starting point. | 24 /// [Platform.resolvedExecutable] as a starting point. |
22 /// | 25 /// |
23 /// This option is mutually exclusive with [sdkSummary]. | 26 /// This option is mutually exclusive with [sdkSummary]. |
24 String sdkPath; | 27 String sdkPath; |
25 | 28 |
26 /// Callback to which compilation errors should be delivered. | 29 /// Callback to which compilation errors should be delivered. |
27 /// | 30 /// |
28 /// If `null`, the first error will be reported by throwing an exception of | 31 /// By default, the first error will be reported by throwing an exception of |
29 /// type [CompilationError]. | 32 /// type [CompilationError]. |
30 ErrorHandler onError; | 33 ErrorHandler onError = defaultErrorHandler; |
31 | 34 |
32 /// Path to the ".packages" file. | 35 /// Path to the ".packages" file. |
33 /// | 36 /// |
34 /// If `null`, the ".packages" file will be found via the standard | 37 /// If `null`, the ".packages" file will be found via the standard |
35 /// package_config search algorithm. | 38 /// package_config search algorithm. |
36 String packagesFilePath; | 39 String packagesFilePath; |
37 | 40 |
38 /// Paths to the input summary files (excluding the SDK summary). These files | 41 /// Paths to the input summary files (excluding the SDK summary). These files |
39 /// should all be linked summaries. They should also be closed, in the sense | 42 /// should all be linked summaries. They should also be closed, in the sense |
40 /// that any libraries they reference should also appear in [inputSummaries] | 43 /// that any libraries they reference should also appear in [inputSummaries] |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 Map<String, String> declaredVariables; | 94 Map<String, String> declaredVariables; |
92 | 95 |
93 /// The [FileSystem] which should be used by the front end to access files. | 96 /// The [FileSystem] which should be used by the front end to access files. |
94 /// | 97 /// |
95 /// All file system access performed by the front end goes through this | 98 /// All file system access performed by the front end goes through this |
96 /// mechanism, with one exception: if no value is specified for | 99 /// mechanism, with one exception: if no value is specified for |
97 /// [packagesFilePath], the packages file is located using the actual physical | 100 /// [packagesFilePath], the packages file is located using the actual physical |
98 /// file system. TODO(paulberry): fix this. | 101 /// file system. TODO(paulberry): fix this. |
99 FileSystem fileSystem = PhysicalFileSystem.instance; | 102 FileSystem fileSystem = PhysicalFileSystem.instance; |
100 } | 103 } |
OLD | NEW |