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

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

Issue 2976963002: Add --no-declaration-casts option to analyzer. (Closed)
Patch Set: Fix comment Created 3 years, 5 months 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/context.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 b59086b057a514ae0d0f9dcf22fc8af6ccd9b9fc..9102d0f717e90f6fc0e68abfafbab8f50a59db85 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -17,6 +17,7 @@ import 'package:path/path.dart';
const String analysisOptionsFileOption = 'options';
const String bazelAnalysisOptionsPath =
'package:dart.analysis_options/default.yaml';
+const String declarationCastsFlag = 'declaration-casts';
const String defineVariableOption = 'D';
const String enableInitializingFormalAccessFlag = 'initializing-formal-access';
const String enableStrictCallChecksFlag = 'enable-strict-call-checks';
@@ -24,8 +25,8 @@ const String enableSuperMixinFlag = 'supermixin';
const String flutterAnalysisOptionsPath =
'package:flutter/analysis_options_user.yaml';
const String ignoreUnrecognizedFlagsFlag = 'ignore-unrecognized-flags';
+const String implicitCastsFlag = 'implicit-casts';
const String lintsFlag = 'lints';
-const String noImplicitCastsFlag = 'no-implicit-casts';
const String noImplicitDynamicFlag = 'no-implicit-dynamic';
const String packageDefaultAnalysisOptions = 'package-default-analysis-options';
const String packageRootOption = 'package-root';
@@ -54,9 +55,16 @@ void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args,
options.enableSuperMixins = args[enableSuperMixinFlag];
verbose('$enableSuperMixinFlag = ${options.enableSuperMixins}');
}
- if (args.wasParsed(noImplicitCastsFlag)) {
- options.implicitCasts = !args[noImplicitCastsFlag];
- verbose('$noImplicitCastsFlag = ${options.implicitCasts}');
+ if (args.wasParsed(implicitCastsFlag)) {
+ options.implicitCasts = args[implicitCastsFlag];
+ verbose('$implicitCastsFlag = ${options.implicitCasts}');
+ }
+ if (args.wasParsed(declarationCastsFlag)) {
+ options.declarationCasts = args[declarationCastsFlag];
+ verbose('$declarationCastsFlag = ${options.declarationCasts}');
+ } else if (args.wasParsed(implicitCastsFlag)) {
+ options.declarationCasts = args[implicitCastsFlag];
+ verbose('$declarationCastsFlag = ${options.declarationCasts}');
}
if (args.wasParsed(noImplicitDynamicFlag)) {
options.implicitDynamic = !args[noImplicitDynamicFlag];
@@ -174,8 +182,12 @@ void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) {
parser.addFlag(strongModeFlag,
help: 'Enable strong static checks (https://goo.gl/DqcBsw).',
defaultsTo: ddc);
- parser.addFlag(noImplicitCastsFlag,
- negatable: false,
+ parser.addFlag(declarationCastsFlag,
+ negatable: true,
+ help:
+ 'Disable declaration casts in strong mode (https://goo.gl/cTLz40).');
+ parser.addFlag(implicitCastsFlag,
+ negatable: true,
help: 'Disable implicit casts in strong mode (https://goo.gl/cTLz40).');
parser.addFlag(noImplicitDynamicFlag,
negatable: false,
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698