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 analyzer.src.command_line.arguments; | 5 library analyzer.src.command_line.arguments; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
10 import 'package:analyzer/src/context/builder.dart'; | 10 import 'package:analyzer/src/context/builder.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 const String noImplicitDynamicFlag = 'no-implicit-dynamic'; | 25 const String noImplicitDynamicFlag = 'no-implicit-dynamic'; |
26 const String packageRootOption = 'package-root'; | 26 const String packageRootOption = 'package-root'; |
27 const String packagesOption = 'packages'; | 27 const String packagesOption = 'packages'; |
28 const String sdkPathOption = 'dart-sdk'; | 28 const String sdkPathOption = 'dart-sdk'; |
29 const String sdkSummaryPathOption = 'dart-sdk-summary'; | 29 const String sdkSummaryPathOption = 'dart-sdk-summary'; |
30 const String strongModeFlag = 'strong'; | 30 const String strongModeFlag = 'strong'; |
31 | 31 |
32 /** | 32 /** |
33 * Update [options] with the value of each analysis option command line flag. | 33 * Update [options] with the value of each analysis option command line flag. |
34 */ | 34 */ |
35 void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args) { | 35 void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args, |
| 36 {void verbosePrint(String text)}) { |
| 37 void verbose(String text) { |
| 38 if (verbosePrint != null) { |
| 39 verbosePrint('Analysis options: $text'); |
| 40 } |
| 41 } |
| 42 |
36 if (args.wasParsed(enableStrictCallChecksFlag)) { | 43 if (args.wasParsed(enableStrictCallChecksFlag)) { |
37 options.enableStrictCallChecks = args[enableStrictCallChecksFlag]; | 44 options.enableStrictCallChecks = args[enableStrictCallChecksFlag]; |
| 45 verbose('$enableStrictCallChecksFlag = ${options.enableStrictCallChecks}'); |
38 } | 46 } |
39 if (args.wasParsed(enableSuperMixinFlag)) { | 47 if (args.wasParsed(enableSuperMixinFlag)) { |
40 options.enableSuperMixins = args[enableSuperMixinFlag]; | 48 options.enableSuperMixins = args[enableSuperMixinFlag]; |
| 49 verbose('$enableSuperMixinFlag = ${options.enableSuperMixins}'); |
41 } | 50 } |
42 if (args.wasParsed(noImplicitCastsFlag)) { | 51 if (args.wasParsed(noImplicitCastsFlag)) { |
43 options.implicitCasts = !args[noImplicitCastsFlag]; | 52 options.implicitCasts = !args[noImplicitCastsFlag]; |
| 53 verbose('$noImplicitCastsFlag = ${options.implicitCasts}'); |
44 } | 54 } |
45 if (args.wasParsed(noImplicitDynamicFlag)) { | 55 if (args.wasParsed(noImplicitDynamicFlag)) { |
46 options.implicitDynamic = !args[noImplicitDynamicFlag]; | 56 options.implicitDynamic = !args[noImplicitDynamicFlag]; |
| 57 verbose('$noImplicitDynamicFlag = ${options.implicitDynamic}'); |
47 } | 58 } |
48 if (args.wasParsed(strongModeFlag)) { | 59 if (args.wasParsed(strongModeFlag)) { |
49 options.strongMode = args[strongModeFlag]; | 60 options.strongMode = args[strongModeFlag]; |
| 61 verbose('$strongModeFlag = ${options.strongMode}'); |
50 } | 62 } |
51 try { | 63 try { |
52 if (args.wasParsed(lintsFlag)) { | 64 if (args.wasParsed(lintsFlag)) { |
53 options.lint = args[lintsFlag]; | 65 options.lint = args[lintsFlag]; |
| 66 verbose('$lintsFlag = ${options.lint}'); |
54 } | 67 } |
55 } on ArgumentError { | 68 } on ArgumentError { |
56 // lints were not defined - ignore and fall through | 69 // lints were not defined - ignore and fall through |
57 } | 70 } |
58 } | 71 } |
59 | 72 |
60 /** | 73 /** |
61 * Use the given [resourceProvider], [contentCache] and command-line [args] to | 74 * Use the given [resourceProvider], [contentCache] and command-line [args] to |
62 * create a context builder. | 75 * create a context builder. |
63 */ | 76 */ |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 .replaceAll('\r\n', '\n') | 327 .replaceAll('\r\n', '\n') |
315 .replaceAll('\r', '\n') | 328 .replaceAll('\r', '\n') |
316 .split('\n') | 329 .split('\n') |
317 .where((String line) => line.isNotEmpty)); | 330 .where((String line) => line.isNotEmpty)); |
318 } on FileSystemException catch (e) { | 331 } on FileSystemException catch (e) { |
319 throw new Exception('Failed to read file specified by $lastArg : $e'); | 332 throw new Exception('Failed to read file specified by $lastArg : $e'); |
320 } | 333 } |
321 } | 334 } |
322 return args; | 335 return args; |
323 } | 336 } |
OLD | NEW |