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

Unified Diff: pkg/analyzer/lib/src/command_line/arguments.dart

Issue 2598523003: cmdline flags override analysis options in file (Closed)
Patch Set: enableSuperInMixinFlag --> enableSuperMixinFlag 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/command_line/arguments.dart
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 5ea958eaad61039d80ed01c1b813ad1fd3ed6675..c791f725f868c02a5a0213de01a9241e9c41130b 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -18,7 +18,7 @@ const String analysisOptionsFileOption = 'options';
const String defineVariableOption = 'D';
const String enableInitializingFormalAccessFlag = 'initializing-formal-access';
const String enableStrictCallChecksFlag = 'enable-strict-call-checks';
-const String enableSuperInMixinFlag = 'supermixin';
+const String enableSuperMixinFlag = 'supermixin';
const String ignoreUnrecognizedFlagsFlag = 'ignore-unrecognized-flags';
const String noImplicitCastsFlag = 'no-implicit-casts';
const String noImplicitDynamicFlag = 'no-implicit-dynamic';
@@ -29,11 +29,36 @@ const String sdkSummaryPathOption = 'dart-sdk-summary';
const String strongModeFlag = 'strong';
/**
+ * Update [options] with the value of each analysis option command line flag,
Brian Wilkerson 2016/12/21 21:48:06 "," --> "."
danrubel 2016/12/23 01:32:03 Done.
+ */
+void applyAnalysisOptionFlags(AnalysisOptions options, ArgResults args) {
Brian Wilkerson 2016/12/21 21:48:06 Something to consider: The only call site I see is
danrubel 2016/12/23 01:32:03 Good point. Done.
+ if (args.wasParsed(enableStrictCallChecksFlag)) {
+ (options as AnalysisOptionsImpl).enableStrictCallChecks =
+ args[enableStrictCallChecksFlag];
+ }
+ if (args.wasParsed(enableSuperMixinFlag)) {
+ (options as AnalysisOptionsImpl).enableSuperMixins =
+ args[enableSuperMixinFlag];
+ }
+ if (args.wasParsed(noImplicitCastsFlag)) {
+ (options as AnalysisOptionsImpl).implicitCasts = !args[noImplicitCastsFlag];
+ }
+ if (args.wasParsed(noImplicitDynamicFlag)) {
+ (options as AnalysisOptionsImpl).implicitDynamic =
+ !args[noImplicitDynamicFlag];
+ }
+ if (args.wasParsed(strongModeFlag)) {
+ (options as AnalysisOptionsImpl).strongMode = args[strongModeFlag];
+ }
+}
+
+/**
* Use the given [resourceProvider], [contentCache] and command-line [args] to
* create a context builder.
*/
ContextBuilderOptions createContextBuilderOptions(ArgResults args) {
ContextBuilderOptions builderOptions = new ContextBuilderOptions();
+ builderOptions.argResults = args;
//
// File locations.
//
@@ -46,11 +71,7 @@ ContextBuilderOptions createContextBuilderOptions(ArgResults args) {
// Analysis options.
//
AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
- defaultOptions.enableStrictCallChecks = args[enableStrictCallChecksFlag];
- defaultOptions.enableSuperMixins = args[enableSuperInMixinFlag];
- defaultOptions.implicitCasts = !args[noImplicitCastsFlag];
- defaultOptions.implicitDynamic = !args[noImplicitDynamicFlag];
- defaultOptions.strongMode = args[strongModeFlag];
+ applyAnalysisOptionFlags(defaultOptions, args);
builderOptions.defaultOptions = defaultOptions;
//
// Declared variables.
@@ -163,7 +184,7 @@ void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) {
defaultsTo: false,
negatable: false,
hide: hide || ddc);
- parser.addFlag(enableSuperInMixinFlag,
+ parser.addFlag(enableSuperMixinFlag,
help: 'Relax restrictions on mixins (DEP 34).',
defaultsTo: false,
negatable: false,
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698