Skip to content

Commit eee20b4

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Fix prefer_equal_for_default_values in analyzer.
Change-Id: Ia72a2ac31d6cf6329c78baad6954ac9595a6c45a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127448 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent f772b57 commit eee20b4

File tree

75 files changed

+305
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+305
-304
lines changed

pkg/analyzer/analysis_options.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ analyzer:
1313
avoid_return_types_on_setters: ignore
1414
empty_catches: ignore
1515
prefer_iterable_wheretype: ignore
16-
# TODO(srawlins): At the time of writing, 230 violations in lib/. The fix
17-
# is mechanical, via `dartfmt --fix-named-default-separator`.
18-
prefer_equal_for_default_values: ignore
1916
# TODO(srawlins): At the time of writing, 2600 violations in lib/. The fix
2017
# is mechanical, via `dartfmt --fix-doc-comments`, but not worth the churn
2118
# today.

pkg/analyzer/lib/analyzer.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export 'package:analyzer/src/generated/utilities_dart.dart';
4949
@Deprecated('Please use parseString instead')
5050
CompilationUnit parseCompilationUnit(String contents,
5151
{String name,
52-
bool suppressErrors: false,
53-
bool parseFunctionBodies: true,
52+
bool suppressErrors = false,
53+
bool parseFunctionBodies = true,
5454
FeatureSet featureSet}) {
5555
// TODO(paulberry): make featureSet a required parameter
5656
featureSet ??= FeatureSet.fromEnableFlags([]);
@@ -74,8 +74,8 @@ CompilationUnit parseCompilationUnit(String contents,
7474
/// callers that don't require function bodies should simply ignore them.
7575
@Deprecated('Please use parseFile2 instead')
7676
CompilationUnit parseDartFile(String path,
77-
{bool suppressErrors: false,
78-
bool parseFunctionBodies: true,
77+
{bool suppressErrors = false,
78+
bool parseFunctionBodies = true,
7979
FeatureSet featureSet}) {
8080
// TODO(paulberry): Make featureSet a required parameter
8181
featureSet ??= FeatureSet.fromEnableFlags([]);
@@ -115,7 +115,7 @@ CompilationUnit parseDartFile(String path,
115115
/// directives should simply ignore the rest of the parse result.
116116
@Deprecated('Please use parseString instead')
117117
CompilationUnit parseDirectives(String contents,
118-
{String name, bool suppressErrors: false, FeatureSet featureSet}) {
118+
{String name, bool suppressErrors = false, FeatureSet featureSet}) {
119119
// TODO(paulberry): make featureSet a required parameter.
120120
featureSet ??= FeatureSet.fromEnableFlags([]);
121121
var source = new StringSource(contents, name);
@@ -141,7 +141,7 @@ String stringLiteralToString(StringLiteral literal) {
141141

142142
CompilationUnit _parseSource(
143143
String contents, Source source, FeatureSet featureSet,
144-
{bool suppressErrors: false, bool parseFunctionBodies: true}) {
144+
{bool suppressErrors = false, bool parseFunctionBodies = true}) {
145145
var reader = new CharSequenceReader(contents);
146146
var errorCollector = new _ErrorCollector();
147147
var scanner = new Scanner(source, reader, errorCollector)

pkg/analyzer/lib/dart/analysis/context_locator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ abstract class ContextLocator {
3838
@deprecated
3939
List<AnalysisContext> locateContexts(
4040
{@required List<String> includedPaths,
41-
List<String> excludedPaths: const <String>[],
41+
List<String> excludedPaths = const <String>[],
4242
String optionsFile,
4343
String packagesFile,
4444
String sdkPath});

pkg/analyzer/lib/dart/analysis/utilities.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ParseStringResult parseFile(
4343
{@required String path,
4444
ResourceProvider resourceProvider,
4545
@required FeatureSet featureSet,
46-
bool throwIfDiagnostics: true}) {
46+
bool throwIfDiagnostics = true}) {
4747
if (featureSet == null) {
4848
throw ArgumentError('A non-null feature set must be provided.');
4949
}
@@ -81,7 +81,7 @@ ParseStringResult parseFile2(
8181
{@required String path,
8282
ResourceProvider resourceProvider,
8383
@required FeatureSet featureSet,
84-
bool throwIfDiagnostics: true}) {
84+
bool throwIfDiagnostics = true}) {
8585
return parseFile(
8686
path: path,
8787
resourceProvider: resourceProvider,
@@ -110,7 +110,7 @@ ParseStringResult parseString(
110110
{@required String content,
111111
FeatureSet featureSet,
112112
String path,
113-
bool throwIfDiagnostics: true}) {
113+
bool throwIfDiagnostics = true}) {
114114
featureSet ??= FeatureSet.fromEnableFlags([]);
115115
var source = StringSource(content, path);
116116
var reader = CharSequenceReader(content);

pkg/analyzer/lib/dart/ast/ast_factory.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ abstract class AstFactory {
826826
@required SimpleIdentifier identifier});
827827

828828
/// Returns a newly created identifier.
829-
SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false});
829+
SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration = false});
830830

831831
/// Returns a newly created simple string literal.
832832
SimpleStringLiteral simpleStringLiteral(Token literal, String value);

pkg/analyzer/lib/dart/element/type.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ abstract class InterfaceType implements ParameterizedType {
353353
/// The [library] determines if a private member name is visible, and does not
354354
/// need to be supplied for public names.
355355
PropertyAccessorElement lookUpInheritedGetter(String name,
356-
{LibraryElement library, bool thisType: true});
356+
{LibraryElement library, bool thisType = true});
357357

358358
/// Look up the member with the given [name] in this type and all extended
359359
/// and mixed in classes, starting from this type. If the search fails,
@@ -377,7 +377,7 @@ abstract class InterfaceType implements ParameterizedType {
377377
/// The [library] determines if a private member name is visible, and does not
378378
/// need to be supplied for public names.
379379
MethodElement lookUpInheritedMethod(String name,
380-
{LibraryElement library, bool thisType: true});
380+
{LibraryElement library, bool thisType = true});
381381

382382
/// Look up the member with the given [name] in this type and all extended
383383
/// and mixed in classes, and by default including [thisType]. If the search
@@ -389,7 +389,7 @@ abstract class InterfaceType implements ParameterizedType {
389389
/// The [library] determines if a private member name is visible, and does not
390390
/// need to be supplied for public names.
391391
PropertyAccessorElement lookUpInheritedSetter(String name,
392-
{LibraryElement library, bool thisType: true});
392+
{LibraryElement library, bool thisType = true});
393393

394394
/// Return the element representing the method that results from looking up
395395
/// the method with the given [name] in this class with respect to the given

pkg/analyzer/lib/file_system/memory_file_system.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MemoryResourceProvider implements ResourceProvider {
2929
final pathos.Context _pathContext;
3030

3131
MemoryResourceProvider(
32-
{pathos.Context context, @deprecated bool isWindows: false})
32+
{pathos.Context context, @deprecated bool isWindows = false})
3333
: _pathContext = (context ??= pathos.style == pathos.Style.windows
3434
// On Windows, ensure that the current drive matches
3535
// the drive inserted by MemoryResourceProvider.convertPath

pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AnalysisOptionsProvider {
2727
/// Recursively merge options referenced by an include directive
2828
/// and remove the include directive from the resulting options map.
2929
/// Return an empty options map if the file does not exist.
30-
YamlMap getOptions(Folder root, {bool crawlUp: false}) {
30+
YamlMap getOptions(Folder root, {bool crawlUp = false}) {
3131
File optionsFile = getOptionsFile(root, crawlUp: crawlUp);
3232
if (optionsFile == null) {
3333
return new YamlMap();
@@ -40,7 +40,7 @@ class AnalysisOptionsProvider {
4040
///
4141
/// The given [root] directory will be searched first. If no file is found and
4242
/// if [crawlUp] is `true`, then enclosing directories will be searched.
43-
File getOptionsFile(Folder root, {bool crawlUp: false}) {
43+
File getOptionsFile(Folder root, {bool crawlUp = false}) {
4444
Resource resource;
4545
for (Folder folder = root; folder != null; folder = folder.parent) {
4646
resource = folder.getChild(AnalysisEngine.ANALYSIS_OPTIONS_FILE);

pkg/analyzer/lib/src/analysis_options/error/option_codes.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class AnalysisOptionsHintCode extends ErrorCode {
6060
const AnalysisOptionsHintCode(
6161
'DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME',
6262
"The name of the analysis options file {0} is deprecated;"
63-
" consider renaming it to analysis_options.yaml.");
63+
" consider renaming it to analysis_options.yaml.");
6464

6565
/**
6666
* An error code indicating that the enablePreviewDart2 setting is deprecated.
@@ -192,7 +192,7 @@ class AnalysisOptionsWarningCode extends ErrorCode {
192192
const AnalysisOptionsWarningCode(
193193
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE',
194194
"The option '{1}' isn't supported by '{0}'. "
195-
"Try using the only supported option: '{2}'.");
195+
"Try using the only supported option: '{2}'.");
196196

197197
/**
198198
* An error code indicating that a plugin is being configured with an

pkg/analyzer/lib/src/command_line/arguments.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ DartSdkManager createDartSdkManager(
140140
* TODO(danrubel) Update DDC to support all the options defined in this method
141141
* then remove the [ddc] named argument from this method.
142142
*/
143-
void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) {
143+
void defineAnalysisArguments(ArgParser parser,
144+
{bool hide = true, ddc = false}) {
144145
parser.addOption(sdkPathOption,
145146
help: 'The path to the Dart SDK.', hide: ddc && hide);
146147
parser.addOption(analysisOptionsFileOption,

0 commit comments

Comments
 (0)