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 27 matching lines...) Expand all Loading... |
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 report hints | 42 /// Whether to report hints |
43 final bool disableHints; | 43 final bool disableHints; |
44 | 44 |
45 /// Whether to display version information | 45 /// Whether to display version information |
46 final bool displayVersion; | 46 final bool displayVersion; |
47 | 47 |
| 48 /// Whether to enable conditional directives (DEP 40). |
| 49 final bool enableConditionalDirectives; |
| 50 |
48 /// Whether to enable null-aware operators (DEP 9). | 51 /// Whether to enable null-aware operators (DEP 9). |
49 final bool enableNullAwareOperators; | 52 final bool enableNullAwareOperators; |
50 | 53 |
51 /// Whether to strictly follow the specification when generating warnings on | 54 /// Whether to strictly follow the specification when generating warnings on |
52 /// "call" methods (fixes dartbug.com/21938). | 55 /// "call" methods (fixes dartbug.com/21938). |
53 final bool enableStrictCallChecks; | 56 final bool enableStrictCallChecks; |
54 | 57 |
55 /// Whether to relax restrictions on mixins (DEP 34). | 58 /// Whether to relax restrictions on mixins (DEP 34). |
56 final bool enableSuperMixins; | 59 final bool enableSuperMixins; |
57 | 60 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 final bool strongMode; | 124 final bool strongMode; |
122 | 125 |
123 /// Initialize options from the given parsed [args]. | 126 /// Initialize options from the given parsed [args]. |
124 CommandLineOptions._fromArgs( | 127 CommandLineOptions._fromArgs( |
125 ArgResults args, Map<String, String> definedVariables) | 128 ArgResults args, Map<String, String> definedVariables) |
126 : dartSdkPath = args['dart-sdk'], | 129 : dartSdkPath = args['dart-sdk'], |
127 definedVariables = definedVariables, | 130 definedVariables = definedVariables, |
128 analysisOptionsFile = args['options'], | 131 analysisOptionsFile = args['options'], |
129 disableHints = args['no-hints'], | 132 disableHints = args['no-hints'], |
130 displayVersion = args['version'], | 133 displayVersion = args['version'], |
| 134 enableConditionalDirectives = args['enable-conditional-directives'], |
131 enableNullAwareOperators = args['enable-null-aware-operators'], | 135 enableNullAwareOperators = args['enable-null-aware-operators'], |
132 enableStrictCallChecks = args['enable-strict-call-checks'], | 136 enableStrictCallChecks = args['enable-strict-call-checks'], |
133 enableSuperMixins = args['supermixin'], | 137 enableSuperMixins = args['supermixin'], |
134 enableTypeChecks = args['enable_type_checks'], | 138 enableTypeChecks = args['enable_type_checks'], |
135 hintsAreFatal = args['fatal-hints'], | 139 hintsAreFatal = args['fatal-hints'], |
136 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], | 140 ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'], |
137 lints = args['lints'], | 141 lints = args['lints'], |
138 log = args['log'], | 142 log = args['log'], |
139 machineFormat = args['machine'] || args['format'] == 'machine', | 143 machineFormat = args['machine'] || args['format'] == 'machine', |
140 packageMode = args['package-mode'], | 144 packageMode = args['package-mode'], |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 ..addFlag('enable-async', | 332 ..addFlag('enable-async', |
329 help: 'Enable support for the proposed async feature.', | 333 help: 'Enable support for the proposed async feature.', |
330 defaultsTo: false, | 334 defaultsTo: false, |
331 negatable: false, | 335 negatable: false, |
332 hide: true) | 336 hide: true) |
333 ..addFlag('enable-enum', | 337 ..addFlag('enable-enum', |
334 help: 'Enable support for the proposed enum feature.', | 338 help: 'Enable support for the proposed enum feature.', |
335 defaultsTo: false, | 339 defaultsTo: false, |
336 negatable: false, | 340 negatable: false, |
337 hide: true) | 341 hide: true) |
| 342 ..addFlag('enable-conditional-directives', |
| 343 help: 'Enable support for conditional directives (DEP 40).', |
| 344 defaultsTo: false, |
| 345 negatable: false, |
| 346 hide: true) |
338 ..addFlag('enable-null-aware-operators', | 347 ..addFlag('enable-null-aware-operators', |
339 help: 'Enable support for null-aware operators (DEP 9).', | 348 help: 'Enable support for null-aware operators (DEP 9).', |
340 defaultsTo: false, | 349 defaultsTo: false, |
341 negatable: false, | 350 negatable: false, |
342 hide: true) | 351 hide: true) |
343 ..addFlag('enable-strict-call-checks', | 352 ..addFlag('enable-strict-call-checks', |
344 help: 'Fix issue 21938.', | 353 help: 'Fix issue 21938.', |
345 defaultsTo: false, | 354 defaultsTo: false, |
346 negatable: false, | 355 negatable: false, |
347 hide: true) | 356 hide: true) |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 582 |
574 int _getNextFlagIndex(args, i) { | 583 int _getNextFlagIndex(args, i) { |
575 for (; i < args.length; ++i) { | 584 for (; i < args.length; ++i) { |
576 if (args[i].startsWith('--')) { | 585 if (args[i].startsWith('--')) { |
577 return i; | 586 return i; |
578 } | 587 } |
579 } | 588 } |
580 return i; | 589 return i; |
581 } | 590 } |
582 } | 591 } |
OLD | NEW |