mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Remove more unused analyzer_cli options for strong mode, implicit casts, implicit dynamic, and declaration-casts.
Bug: https://github.com/dart-lang/sdk/issues/49537 Change-Id: I57e41e1ab82c3486d90c858c400d073645f56b36 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252869 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Janice Collins <jcollins@google.com> Auto-Submit: Janice Collins <jcollins@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
5e267854e1
commit
5ce344ddcd
|
@ -22,8 +22,6 @@ const _defineVariableOption = 'D';
|
|||
const _enableExperimentOption = 'enable-experiment';
|
||||
const _enableInitializingFormalAccessFlag = 'initializing-formal-access';
|
||||
const _ignoreUnrecognizedFlagsFlag = 'ignore-unrecognized-flags';
|
||||
const _implicitCastsFlag = 'implicit-casts';
|
||||
const _noImplicitDynamicFlag = 'no-implicit-dynamic';
|
||||
const _packagesOption = 'packages';
|
||||
const _sdkPathOption = 'dart-sdk';
|
||||
|
||||
|
@ -175,10 +173,6 @@ class CommandLineOptions {
|
|||
return castNullable(_argResults[_enableExperimentOption]);
|
||||
}
|
||||
|
||||
bool? get implicitCasts => _argResults[_implicitCastsFlag] as bool?;
|
||||
|
||||
bool? get noImplicitDynamic => _argResults[_noImplicitDynamicFlag] as bool?;
|
||||
|
||||
/// Update the [analysisOptions] with flags that the user specified
|
||||
/// explicitly. The [analysisOptions] are usually loaded from one of
|
||||
/// `analysis_options.yaml` files, possibly with includes. We consider
|
||||
|
@ -201,16 +195,6 @@ class CommandLineOptions {
|
|||
flags: enabledExperiments,
|
||||
);
|
||||
}
|
||||
|
||||
var implicitCasts = this.implicitCasts;
|
||||
if (implicitCasts != null) {
|
||||
analysisOptions.implicitCasts = implicitCasts;
|
||||
}
|
||||
|
||||
var noImplicitDynamic = this.noImplicitDynamic;
|
||||
if (noImplicitDynamic != null) {
|
||||
analysisOptions.implicitDynamic = !noImplicitDynamic;
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a list of command-line arguments containing all of the given [args]
|
||||
|
@ -327,31 +311,10 @@ class CommandLineOptions {
|
|||
help: 'The path to the Dart SDK.', hide: ddc && hide);
|
||||
parser.addOption(_analysisOptionsFileOption,
|
||||
help: 'Path to an analysis options file.', hide: ddc && hide);
|
||||
parser.addFlag('strong',
|
||||
help: 'Enable strong mode (deprecated); this option is now ignored.',
|
||||
defaultsTo: true,
|
||||
hide: true,
|
||||
negatable: true);
|
||||
parser.addFlag('declaration-casts',
|
||||
negatable: true,
|
||||
help:
|
||||
'Disable declaration casts in strong mode (https://goo.gl/cTLz40)\n'
|
||||
'This option is now ignored and will be removed in a future release.',
|
||||
hide: ddc && hide);
|
||||
parser.addMultiOption(_enableExperimentOption,
|
||||
help: 'Enable one or more experimental features. If multiple features '
|
||||
'are being added, they should be comma separated.',
|
||||
splitCommas: true);
|
||||
parser.addFlag(_implicitCastsFlag,
|
||||
negatable: true,
|
||||
help: 'Disable implicit casts in strong mode (https://goo.gl/cTLz40).',
|
||||
defaultsTo: null,
|
||||
hide: ddc && hide);
|
||||
parser.addFlag(_noImplicitDynamicFlag,
|
||||
defaultsTo: null,
|
||||
negatable: false,
|
||||
help: 'Disable implicit dynamic (https://goo.gl/m0UgXD).',
|
||||
hide: ddc && hide);
|
||||
|
||||
//
|
||||
// Hidden flags and options.
|
||||
|
@ -520,11 +483,6 @@ class CommandLineOptions {
|
|||
}
|
||||
}
|
||||
|
||||
if (results.wasParsed('strong')) {
|
||||
errorSink.writeln(
|
||||
'Note: the --strong flag is deprecated and will be removed in an '
|
||||
'future release.\n');
|
||||
}
|
||||
if (results.wasParsed(_enableExperimentOption)) {
|
||||
var names =
|
||||
(results[_enableExperimentOption] as List).cast<String>().toList();
|
||||
|
|
|
@ -61,11 +61,9 @@ void main() {
|
|||
expect(options.enabledExperiments, isEmpty);
|
||||
expect(options.displayVersion, isFalse);
|
||||
expect(options.ignoreUnrecognizedFlags, isFalse);
|
||||
expect(options.implicitCasts, isNull);
|
||||
expect(options.log, isFalse);
|
||||
expect(options.jsonFormat, isFalse);
|
||||
expect(options.machineFormat, isFalse);
|
||||
expect(options.noImplicitDynamic, isNull);
|
||||
expect(options.batchMode, isFalse);
|
||||
expect(options.sourceFiles, equals(['foo.dart']));
|
||||
expect(options.trainSnapshot, isFalse);
|
||||
|
@ -381,86 +379,6 @@ class ArgumentsTest with ResourceProviderMixin {
|
|||
});
|
||||
}
|
||||
|
||||
void test_updateAnalysisOptions_implicitCasts() {
|
||||
// Turn on.
|
||||
_applyAnalysisOptions(
|
||||
['--implicit-casts', 'a.dart'],
|
||||
(analysisOptions) {
|
||||
analysisOptions.implicitCasts = false;
|
||||
},
|
||||
(analysisOptions) {
|
||||
expect(analysisOptions.implicitCasts, isTrue);
|
||||
},
|
||||
);
|
||||
|
||||
// Turn off.
|
||||
_applyAnalysisOptions(
|
||||
['--no-implicit-casts', 'a.dart'],
|
||||
(analysisOptions) {
|
||||
analysisOptions.implicitCasts = true;
|
||||
},
|
||||
(analysisOptions) {
|
||||
expect(analysisOptions.implicitCasts, isFalse);
|
||||
},
|
||||
);
|
||||
|
||||
// Don't change if not provided, false.
|
||||
_applyAnalysisOptions(
|
||||
['a.dart'],
|
||||
(analysisOptions) {
|
||||
analysisOptions.implicitCasts = false;
|
||||
},
|
||||
(analysisOptions) {
|
||||
expect(analysisOptions.implicitCasts, isFalse);
|
||||
},
|
||||
);
|
||||
|
||||
// Don't change if not provided, true.
|
||||
_applyAnalysisOptions(
|
||||
['a.dart'],
|
||||
(analysisOptions) {
|
||||
analysisOptions.implicitCasts = true;
|
||||
},
|
||||
(analysisOptions) {
|
||||
expect(analysisOptions.implicitCasts, isTrue);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void test_updateAnalysisOptions_noImplicitDynamic() {
|
||||
_applyAnalysisOptions(
|
||||
['--no-implicit-dynamic', 'a.dart'],
|
||||
(analysisOptions) {
|
||||
analysisOptions.implicitDynamic = true;
|
||||
},
|
||||
(analysisOptions) {
|
||||
expect(analysisOptions.implicitDynamic, isFalse);
|
||||
},
|
||||
);
|
||||
|
||||
// Don't change if not provided, false.
|
||||
_applyAnalysisOptions(
|
||||
['a.dart'],
|
||||
(analysisOptions) {
|
||||
analysisOptions.implicitDynamic = false;
|
||||
},
|
||||
(analysisOptions) {
|
||||
expect(analysisOptions.implicitDynamic, isFalse);
|
||||
},
|
||||
);
|
||||
|
||||
// Don't change if not provided, true.
|
||||
_applyAnalysisOptions(
|
||||
['a.dart'],
|
||||
(analysisOptions) {
|
||||
analysisOptions.implicitDynamic = true;
|
||||
},
|
||||
(analysisOptions) {
|
||||
expect(analysisOptions.implicitDynamic, isTrue);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _applyAnalysisOptions(
|
||||
List<String> args,
|
||||
void Function(AnalysisOptionsImpl) configureInitial,
|
||||
|
|
Loading…
Reference in a new issue