OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer_cli.src.options; | 5 library analyzer_cli.src.options; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analyzer_cli/src/driver.dart'; | 9 import 'package:analyzer_cli/src/driver.dart'; |
10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
(...skipping 21 matching lines...) Expand all Loading... |
32 class CommandLineOptions { | 32 class CommandLineOptions { |
33 /// The path to an analysis options file | 33 /// The path to an analysis options file |
34 final String analysisOptionsFile; | 34 final String analysisOptionsFile; |
35 | 35 |
36 /// The path to the dart SDK | 36 /// The path to the dart SDK |
37 String dartSdkPath; | 37 String dartSdkPath; |
38 | 38 |
39 /// A table mapping the names of defined variables to their values. | 39 /// A table mapping the names of defined variables to their values. |
40 final Map<String, String> definedVariables; | 40 final Map<String, String> definedVariables; |
41 | 41 |
42 /// Whether to disable the new task model. | |
43 final bool disableNewTaskModel; | |
44 | |
45 /// Whether to report hints | 42 /// Whether to report hints |
46 final bool disableHints; | 43 final bool disableHints; |
47 | 44 |
48 /// Whether to display version information | 45 /// Whether to display version information |
49 final bool displayVersion; | 46 final bool displayVersion; |
50 | 47 |
51 /// Whether to enable null-aware operators (DEP 9). | 48 /// Whether to enable null-aware operators (DEP 9). |
52 final bool enableNullAwareOperators; | 49 final bool enableNullAwareOperators; |
53 | 50 |
54 /// Whether to strictly follow the specification when generating warnings on | 51 /// Whether to strictly follow the specification when generating warnings on |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 /// Whether to use strong static checking. | 98 /// Whether to use strong static checking. |
102 final bool strongMode; | 99 final bool strongMode; |
103 | 100 |
104 /// Initialize options from the given parsed [args]. | 101 /// Initialize options from the given parsed [args]. |
105 CommandLineOptions._fromArgs( | 102 CommandLineOptions._fromArgs( |
106 ArgResults args, Map<String, String> definedVariables) | 103 ArgResults args, Map<String, String> definedVariables) |
107 : dartSdkPath = args['dart-sdk'], | 104 : dartSdkPath = args['dart-sdk'], |
108 this.definedVariables = definedVariables, | 105 this.definedVariables = definedVariables, |
109 analysisOptionsFile = args['options'], | 106 analysisOptionsFile = args['options'], |
110 disableHints = args['no-hints'], | 107 disableHints = args['no-hints'], |
111 disableNewTaskModel = args['disable-new-task-model'], | |
112 displayVersion = args['version'], | 108 displayVersion = args['version'], |
113 enableNullAwareOperators = args['enable-null-aware-operators'], | 109 enableNullAwareOperators = args['enable-null-aware-operators'], |
114 enableStrictCallChecks = args['enable-strict-call-checks'], | 110 enableStrictCallChecks = args['enable-strict-call-checks'], |
115 enableSuperMixins = args['supermixin'], | 111 enableSuperMixins = args['supermixin'], |
116 enableTypeChecks = args['enable_type_checks'], | 112 enableTypeChecks = args['enable_type_checks'], |
117 hintsAreFatal = args['fatal-hints'], | 113 hintsAreFatal = args['fatal-hints'], |
118 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], | 114 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], |
119 lints = args['lints'], | 115 lints = args['lints'], |
120 log = args['log'], | 116 log = args['log'], |
121 machineFormat = args['machine'] || args['format'] == 'machine', | 117 machineFormat = args['machine'] || args['format'] == 'machine', |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 negatable: false) | 249 negatable: false) |
254 ..addOption('url-mapping', | 250 ..addOption('url-mapping', |
255 help: '--url-mapping=libraryUri,/path/to/library.dart directs the ' | 251 help: '--url-mapping=libraryUri,/path/to/library.dart directs the ' |
256 'analyzer to use "library.dart" as the source for an import ' | 252 'analyzer to use "library.dart" as the source for an import ' |
257 'of "libraryUri".', | 253 'of "libraryUri".', |
258 allowMultiple: true, | 254 allowMultiple: true, |
259 splitCommas: false) | 255 splitCommas: false) |
260 // | 256 // |
261 // Hidden flags. | 257 // Hidden flags. |
262 // | 258 // |
263 ..addFlag('disable-new-task-model', | |
264 help: 'Disable the use of the new task model.', | |
265 defaultsTo: false, | |
266 negatable: false, | |
267 hide: true) | |
268 ..addFlag('enable-async', | 259 ..addFlag('enable-async', |
269 help: 'Enable support for the proposed async feature.', | 260 help: 'Enable support for the proposed async feature.', |
270 defaultsTo: false, | 261 defaultsTo: false, |
271 negatable: false, | 262 negatable: false, |
272 hide: true) | 263 hide: true) |
273 ..addFlag('enable-enum', | 264 ..addFlag('enable-enum', |
274 help: 'Enable support for the proposed enum feature.', | 265 help: 'Enable support for the proposed enum feature.', |
275 defaultsTo: false, | 266 defaultsTo: false, |
276 negatable: false, | 267 negatable: false, |
277 hide: true) | 268 hide: true) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 476 |
486 int _getNextFlagIndex(args, i) { | 477 int _getNextFlagIndex(args, i) { |
487 for (; i < args.length; ++i) { | 478 for (; i < args.length; ++i) { |
488 if (args[i].startsWith('--')) { | 479 if (args[i].startsWith('--')) { |
489 return i; | 480 return i; |
490 } | 481 } |
491 } | 482 } |
492 return i; | 483 return i; |
493 } | 484 } |
494 } | 485 } |
OLD | NEW |