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

Side by Side Diff: pkg/front_end/lib/compiler_options.dart

Issue 2568583002: Create a default error handler to avoid the need for null checks. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | 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) 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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698