diff --git a/pkg/analyzer/analysis_options.yaml b/pkg/analyzer/analysis_options.yaml index 58dbe82bb834..702baf3c0951 100644 --- a/pkg/analyzer/analysis_options.yaml +++ b/pkg/analyzer/analysis_options.yaml @@ -13,9 +13,6 @@ analyzer: avoid_return_types_on_setters: ignore empty_catches: ignore prefer_iterable_wheretype: ignore - # TODO(srawlins): At the time of writing, 230 violations in lib/. The fix - # is mechanical, via `dartfmt --fix-named-default-separator`. - prefer_equal_for_default_values: ignore # TODO(srawlins): At the time of writing, 2600 violations in lib/. The fix # is mechanical, via `dartfmt --fix-doc-comments`, but not worth the churn # today. diff --git a/pkg/analyzer/lib/analyzer.dart b/pkg/analyzer/lib/analyzer.dart index d01db7179a9b..80e39a310713 100644 --- a/pkg/analyzer/lib/analyzer.dart +++ b/pkg/analyzer/lib/analyzer.dart @@ -49,8 +49,8 @@ export 'package:analyzer/src/generated/utilities_dart.dart'; @Deprecated('Please use parseString instead') CompilationUnit parseCompilationUnit(String contents, {String name, - bool suppressErrors: false, - bool parseFunctionBodies: true, + bool suppressErrors = false, + bool parseFunctionBodies = true, FeatureSet featureSet}) { // TODO(paulberry): make featureSet a required parameter featureSet ??= FeatureSet.fromEnableFlags([]); @@ -74,8 +74,8 @@ CompilationUnit parseCompilationUnit(String contents, /// callers that don't require function bodies should simply ignore them. @Deprecated('Please use parseFile2 instead') CompilationUnit parseDartFile(String path, - {bool suppressErrors: false, - bool parseFunctionBodies: true, + {bool suppressErrors = false, + bool parseFunctionBodies = true, FeatureSet featureSet}) { // TODO(paulberry): Make featureSet a required parameter featureSet ??= FeatureSet.fromEnableFlags([]); @@ -115,7 +115,7 @@ CompilationUnit parseDartFile(String path, /// directives should simply ignore the rest of the parse result. @Deprecated('Please use parseString instead') CompilationUnit parseDirectives(String contents, - {String name, bool suppressErrors: false, FeatureSet featureSet}) { + {String name, bool suppressErrors = false, FeatureSet featureSet}) { // TODO(paulberry): make featureSet a required parameter. featureSet ??= FeatureSet.fromEnableFlags([]); var source = new StringSource(contents, name); @@ -141,7 +141,7 @@ String stringLiteralToString(StringLiteral literal) { CompilationUnit _parseSource( String contents, Source source, FeatureSet featureSet, - {bool suppressErrors: false, bool parseFunctionBodies: true}) { + {bool suppressErrors = false, bool parseFunctionBodies = true}) { var reader = new CharSequenceReader(contents); var errorCollector = new _ErrorCollector(); var scanner = new Scanner(source, reader, errorCollector) diff --git a/pkg/analyzer/lib/dart/analysis/context_locator.dart b/pkg/analyzer/lib/dart/analysis/context_locator.dart index 2211439430eb..9ee427d39e3e 100644 --- a/pkg/analyzer/lib/dart/analysis/context_locator.dart +++ b/pkg/analyzer/lib/dart/analysis/context_locator.dart @@ -38,7 +38,7 @@ abstract class ContextLocator { @deprecated List locateContexts( {@required List includedPaths, - List excludedPaths: const [], + List excludedPaths = const [], String optionsFile, String packagesFile, String sdkPath}); diff --git a/pkg/analyzer/lib/dart/analysis/utilities.dart b/pkg/analyzer/lib/dart/analysis/utilities.dart index bddafbde7a6c..f69d104ce6ae 100644 --- a/pkg/analyzer/lib/dart/analysis/utilities.dart +++ b/pkg/analyzer/lib/dart/analysis/utilities.dart @@ -43,7 +43,7 @@ ParseStringResult parseFile( {@required String path, ResourceProvider resourceProvider, @required FeatureSet featureSet, - bool throwIfDiagnostics: true}) { + bool throwIfDiagnostics = true}) { if (featureSet == null) { throw ArgumentError('A non-null feature set must be provided.'); } @@ -81,7 +81,7 @@ ParseStringResult parseFile2( {@required String path, ResourceProvider resourceProvider, @required FeatureSet featureSet, - bool throwIfDiagnostics: true}) { + bool throwIfDiagnostics = true}) { return parseFile( path: path, resourceProvider: resourceProvider, @@ -110,7 +110,7 @@ ParseStringResult parseString( {@required String content, FeatureSet featureSet, String path, - bool throwIfDiagnostics: true}) { + bool throwIfDiagnostics = true}) { featureSet ??= FeatureSet.fromEnableFlags([]); var source = StringSource(content, path); var reader = CharSequenceReader(content); diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart index c26c895e7c7f..ac3b8257a4f2 100644 --- a/pkg/analyzer/lib/dart/ast/ast_factory.dart +++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart @@ -826,7 +826,7 @@ abstract class AstFactory { @required SimpleIdentifier identifier}); /// Returns a newly created identifier. - SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false}); + SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration = false}); /// Returns a newly created simple string literal. SimpleStringLiteral simpleStringLiteral(Token literal, String value); diff --git a/pkg/analyzer/lib/dart/element/type.dart b/pkg/analyzer/lib/dart/element/type.dart index b100546c8093..0e20a37e4dcb 100644 --- a/pkg/analyzer/lib/dart/element/type.dart +++ b/pkg/analyzer/lib/dart/element/type.dart @@ -353,7 +353,7 @@ abstract class InterfaceType implements ParameterizedType { /// The [library] determines if a private member name is visible, and does not /// need to be supplied for public names. PropertyAccessorElement lookUpInheritedGetter(String name, - {LibraryElement library, bool thisType: true}); + {LibraryElement library, bool thisType = true}); /// Look up the member with the given [name] in this type and all extended /// and mixed in classes, starting from this type. If the search fails, @@ -377,7 +377,7 @@ abstract class InterfaceType implements ParameterizedType { /// The [library] determines if a private member name is visible, and does not /// need to be supplied for public names. MethodElement lookUpInheritedMethod(String name, - {LibraryElement library, bool thisType: true}); + {LibraryElement library, bool thisType = true}); /// Look up the member with the given [name] in this type and all extended /// and mixed in classes, and by default including [thisType]. If the search @@ -389,7 +389,7 @@ abstract class InterfaceType implements ParameterizedType { /// The [library] determines if a private member name is visible, and does not /// need to be supplied for public names. PropertyAccessorElement lookUpInheritedSetter(String name, - {LibraryElement library, bool thisType: true}); + {LibraryElement library, bool thisType = true}); /// Return the element representing the method that results from looking up /// the method with the given [name] in this class with respect to the given diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart index 414ab6c514c3..c7ad9088827c 100644 --- a/pkg/analyzer/lib/file_system/memory_file_system.dart +++ b/pkg/analyzer/lib/file_system/memory_file_system.dart @@ -29,7 +29,7 @@ class MemoryResourceProvider implements ResourceProvider { final pathos.Context _pathContext; MemoryResourceProvider( - {pathos.Context context, @deprecated bool isWindows: false}) + {pathos.Context context, @deprecated bool isWindows = false}) : _pathContext = (context ??= pathos.style == pathos.Style.windows // On Windows, ensure that the current drive matches // the drive inserted by MemoryResourceProvider.convertPath diff --git a/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart b/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart index 2566e22534d9..b40a3fb59594 100644 --- a/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart +++ b/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart @@ -27,7 +27,7 @@ class AnalysisOptionsProvider { /// Recursively merge options referenced by an include directive /// and remove the include directive from the resulting options map. /// Return an empty options map if the file does not exist. - YamlMap getOptions(Folder root, {bool crawlUp: false}) { + YamlMap getOptions(Folder root, {bool crawlUp = false}) { File optionsFile = getOptionsFile(root, crawlUp: crawlUp); if (optionsFile == null) { return new YamlMap(); @@ -40,7 +40,7 @@ class AnalysisOptionsProvider { /// /// The given [root] directory will be searched first. If no file is found and /// if [crawlUp] is `true`, then enclosing directories will be searched. - File getOptionsFile(Folder root, {bool crawlUp: false}) { + File getOptionsFile(Folder root, {bool crawlUp = false}) { Resource resource; for (Folder folder = root; folder != null; folder = folder.parent) { resource = folder.getChild(AnalysisEngine.ANALYSIS_OPTIONS_FILE); diff --git a/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart b/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart index a82fb5ee5334..ff8c3df78668 100644 --- a/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart +++ b/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart @@ -60,7 +60,7 @@ class AnalysisOptionsHintCode extends ErrorCode { const AnalysisOptionsHintCode( 'DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME', "The name of the analysis options file {0} is deprecated;" - " consider renaming it to analysis_options.yaml."); + " consider renaming it to analysis_options.yaml."); /** * An error code indicating that the enablePreviewDart2 setting is deprecated. @@ -192,7 +192,7 @@ class AnalysisOptionsWarningCode extends ErrorCode { const AnalysisOptionsWarningCode( 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE', "The option '{1}' isn't supported by '{0}'. " - "Try using the only supported option: '{2}'."); + "Try using the only supported option: '{2}'."); /** * An error code indicating that a plugin is being configured with an diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart index 91a13f0536e6..94ad86f32842 100644 --- a/pkg/analyzer/lib/src/command_line/arguments.dart +++ b/pkg/analyzer/lib/src/command_line/arguments.dart @@ -140,7 +140,8 @@ DartSdkManager createDartSdkManager( * TODO(danrubel) Update DDC to support all the options defined in this method * then remove the [ddc] named argument from this method. */ -void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) { +void defineAnalysisArguments(ArgParser parser, + {bool hide = true, ddc = false}) { parser.addOption(sdkPathOption, help: 'The path to the Dart SDK.', hide: ddc && hide); parser.addOption(analysisOptionsFileOption, diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart index 07c9b3828e90..295eef2b622d 100644 --- a/pkg/analyzer/lib/src/context/builder.dart +++ b/pkg/analyzer/lib/src/context/builder.dart @@ -479,7 +479,7 @@ class ContextBuilder { * path. This allows cli to locate what *would* have been the analysis options * file path, and super-impose the defaults over it in-place. */ - File getOptionsFile(String path, {bool forceSearch: false}) { + File getOptionsFile(String path, {bool forceSearch = false}) { if (!forceSearch) { String filePath = builderOptions.defaultAnalysisOptionsFilePath; if (filePath != null) { diff --git a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart index 227701bd2f06..cffb66a9c2c0 100644 --- a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart +++ b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart @@ -20,7 +20,7 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection { /// Initialize a newly created analysis context manager. AnalysisContextCollectionImpl( - {bool enableIndex: false, + {bool enableIndex = false, @required List includedPaths, List excludedPaths, ResourceProvider resourceProvider, diff --git a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart index b918aa8e5045..a45246f97890 100644 --- a/pkg/analyzer/lib/src/dart/analysis/context_builder.dart +++ b/pkg/analyzer/lib/src/dart/analysis/context_builder.dart @@ -54,7 +54,7 @@ class ContextBuilderImpl implements ContextBuilder { AnalysisContext createContext( {@required ContextRoot contextRoot, DeclaredVariables declaredVariables, - bool enableIndex: false, + bool enableIndex = false, List librarySummaryPaths, @deprecated PerformanceLog performanceLog, @deprecated AnalysisDriverScheduler scheduler, diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart index 1f6826ae64d7..1f7ce9d575e4 100644 --- a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart +++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart @@ -75,7 +75,7 @@ class ContextLocatorImpl implements ContextLocator { @override List locateContexts( {@required List includedPaths, - List excludedPaths: const [], + List excludedPaths = const [], String optionsFile, String packagesFile, String sdkPath}) { diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart index 98c9a8a1b04a..bb3083849d1a 100644 --- a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart +++ b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart @@ -314,7 +314,7 @@ class ReferenceCollector { _visitConstructor(node.type, node.name); } - void _visitExpression(Expression node, {bool get: true, bool set: false}) { + void _visitExpression(Expression node, {bool get = true, bool set = false}) { if (node == null) return; if (node is AdjacentStrings) { diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart index cb1f17c407f8..2f92a863c3f6 100644 --- a/pkg/analyzer/lib/src/dart/analysis/driver.dart +++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart @@ -284,10 +284,10 @@ class AnalysisDriver implements AnalysisDriverGeneric { this.contextRoot, SourceFactory sourceFactory, this._analysisOptions, - {this.disableChangesAndCacheAllResults: false, - this.enableIndex: false, + {this.disableChangesAndCacheAllResults = false, + this.enableIndex = false, SummaryDataStore externalSummaries, - bool retainDataForTesting: false}) + bool retainDataForTesting = false}) : _logger = logger, _sourceFactory = sourceFactory, _externalSummaries = externalSummaries, @@ -783,7 +783,7 @@ class AnalysisDriver implements AnalysisDriverGeneric { /// of the files previously reported using [changeFile]), prior to the next /// time the analysis state transitions to "idle". Future getResult(String path, - {bool sendCachedToStream: false}) { + {bool sendCachedToStream = false}) { _throwIfNotAbsolutePath(path); if (!_fsState.hasUri(path)) { return new Future.value(); @@ -1212,9 +1212,9 @@ class AnalysisDriver implements AnalysisDriverGeneric { /// the resolved signature of the file in its library is the same as the one /// that was the most recently produced to the client. AnalysisResult _computeAnalysisResult(String path, - {bool withUnit: false, - bool asIsIfPartWithoutLibrary: false, - bool skipIfSameSignature: false}) { + {bool withUnit = false, + bool asIsIfPartWithoutLibrary = false, + bool skipIfSameSignature = false}) { FileState file = _fsState.getFileForPath(path); // Prepare the library - the file itself, or the known library. @@ -1392,7 +1392,7 @@ class AnalysisDriver implements AnalysisDriverGeneric { } UnitElementResult _computeUnitElement(String path, - {bool asIsIfPartWithoutLibrary: false}) { + {bool asIsIfPartWithoutLibrary = false}) { FileState file = _fsState.getFileForPath(path); // Prepare the library - the file itself, or the known library. @@ -1420,7 +1420,7 @@ class AnalysisDriver implements AnalysisDriverGeneric { } String _computeUnitElementSignature(String path, - {bool asIsIfPartWithoutLibrary: false}) { + {bool asIsIfPartWithoutLibrary = false}) { FileState file = _fsState.getFileForPath(path); // Prepare the library - the file itself, or the known library. diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.dart index cb17efa913e9..caa7d35225cd 100644 --- a/pkg/analyzer/lib/src/dart/analysis/experiments.dart +++ b/pkg/analyzer/lib/src/dart/analysis/experiments.dart @@ -45,7 +45,7 @@ class ExperimentStatus with _CurrentState implements FeatureSet { /// enabled features is used as the starting point. @visibleForTesting ExperimentStatus.forTesting( - {String sdkVersion, List additionalFeatures: const []}) + {String sdkVersion, List additionalFeatures = const []}) : this._(enableFlagsForTesting( sdkVersion: sdkVersion, additionalFeatures: additionalFeatures)); diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart b/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart index 81a437b774dc..3bbb2b618860 100644 --- a/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart +++ b/pkg/analyzer/lib/src/dart/analysis/experiments_impl.dart @@ -35,7 +35,7 @@ List decodeFlags(List flags) { /// If [sdkVersion] is not supplied (or is `null`), then the current set of /// enabled features is used as the starting point. List enableFlagsForTesting( - {String sdkVersion, List additionalFeatures: const []}) { + {String sdkVersion, List additionalFeatures = const []}) { var flags = decodeFlags([]); if (sdkVersion != null) { flags = restrictEnableFlagsToVersion(flags, Version.parse(sdkVersion)); diff --git a/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart b/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart index eecc2ca5a1ee..15a0f2d52485 100644 --- a/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart +++ b/pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart @@ -160,7 +160,7 @@ class FileByteStore implements ByteStore { * If the same cache path is used from more than one isolate of the same * process, then a unique [tempNameSuffix] must be provided for each isolate. */ - FileByteStore(this._cachePath, {String tempNameSuffix: ''}) + FileByteStore(this._cachePath, {String tempNameSuffix = ''}) : _tempSuffix = '-temp-$pid${tempNameSuffix.isEmpty ? '' : '-$tempNameSuffix'}'; diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart index 4aa7862c7cf8..05e9b65bc716 100644 --- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart +++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart @@ -384,7 +384,7 @@ class FileState { * * Return `true` if the API signature changed since the last refresh. */ - bool refresh({bool allowCached: false}) { + bool refresh({bool allowCached = false}) { counterFileStateRefresh++; var timerWasRunning = timerFileStateRefresh.isRunning; diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart index a4aba0d5aa6c..3ee81fe028a7 100644 --- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart +++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart @@ -929,7 +929,7 @@ class AstFactoryImpl extends AstFactory { requiredKeyword, keyword, type, identifier); @override - SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration: false}) { + SimpleIdentifier simpleIdentifier(Token token, {bool isDeclaration = false}) { if (isDeclaration) { return new DeclaredSimpleIdentifier(token); } diff --git a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart index c80aa0f34815..96d95128a8f3 100644 --- a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart +++ b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart @@ -230,9 +230,9 @@ class InheritanceManager3 { ExecutableElement getMember( InterfaceType type, Name name, { - bool concrete: false, - int forMixinIndex: -1, - bool forSuper: false, + bool concrete = false, + int forMixinIndex = -1, + bool forSuper = false, }) { var interface = getInterface(type); if (forSuper) { diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart index e5abf2caeabe..6223f1914457 100644 --- a/pkg/analyzer/lib/src/dart/element/type.dart +++ b/pkg/analyzer/lib/src/dart/element/type.dart @@ -353,7 +353,7 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType { @override DartType replaceTopAndBottom(TypeProvider typeProvider, - {bool isCovariant: true}) { + {bool isCovariant = true}) { var returnType = (this.returnType as TypeImpl) .replaceTopAndBottom(typeProvider, isCovariant: isCovariant); ParameterElement transformParameter(ParameterElement p) { @@ -1224,7 +1224,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType { @override PropertyAccessorElement lookUpInheritedGetter(String name, - {LibraryElement library, bool thisType: true}) { + {LibraryElement library, bool thisType = true}) { PropertyAccessorElement result; if (thisType) { result = lookUpGetter(name, library); @@ -1256,19 +1256,19 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType { } ExecutableElement lookUpInheritedMember(String name, LibraryElement library, - {bool concrete: false, - bool forSuperInvocation: false, + {bool concrete = false, + bool forSuperInvocation = false, int startMixinIndex, - bool setter: false, - bool thisType: false}) { + bool setter = false, + bool thisType = false}) { HashSet visitedClasses = new HashSet(); /// TODO(scheglov) Remove [includeSupers]. It is used only to work around /// the problem with Flutter code base (using old super-mixins). ExecutableElement lookUpImpl(InterfaceTypeImpl type, - {bool acceptAbstract: false, - bool includeType: true, - bool inMixin: false, + {bool acceptAbstract = false, + bool includeType = true, + bool inMixin = false, int startMixinIndex}) { if (type == null || !visitedClasses.add(type.element)) { return null; @@ -1344,7 +1344,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType { @override MethodElement lookUpInheritedMethod(String name, - {LibraryElement library, bool thisType: true}) { + {LibraryElement library, bool thisType = true}) { MethodElement result; if (thisType) { result = lookUpMethod(name, library); @@ -1360,7 +1360,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType { @override PropertyAccessorElement lookUpInheritedSetter(String name, - {LibraryElement library, bool thisType: true}) { + {LibraryElement library, bool thisType = true}) { PropertyAccessorElement result; if (thisType) { result = lookUpSetter(name, library); @@ -1467,7 +1467,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType { @override DartType replaceTopAndBottom(TypeProvider typeProvider, - {bool isCovariant: true}) { + {bool isCovariant = true}) { // First check if this is actually an instance of Bottom if (this.isDartCoreNull) { if (isCovariant) { diff --git a/pkg/analyzer/lib/src/dart/element/type_algebra.dart b/pkg/analyzer/lib/src/dart/element/type_algebra.dart index 2cab0ed1331c..e4b592099917 100644 --- a/pkg/analyzer/lib/src/dart/element/type_algebra.dart +++ b/pkg/analyzer/lib/src/dart/element/type_algebra.dart @@ -148,7 +148,7 @@ abstract class Substitution { DartType getSubstitute(TypeParameterElement parameter, bool upperBound); - DartType substituteType(DartType type, {bool contravariant: false}) { + DartType substituteType(DartType type, {bool contravariant = false}) { return new _TopSubstitutor(this, contravariant).visit(type); } @@ -307,7 +307,7 @@ class _NullSubstitution extends MapSubstitution { } @override - DartType substituteType(DartType type, {bool contravariant: false}) => type; + DartType substituteType(DartType type, {bool contravariant = false}) => type; @override String toString() => "Substitution.empty"; diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart index 6ac99e761029..fd5b848833d5 100644 --- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart +++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart @@ -840,7 +840,7 @@ class MethodInvocationResolver { } void _setDynamicResolution(MethodInvocation node, - {bool setNameTypeToDynamic: true}) { + {bool setNameTypeToDynamic = true}) { if (setNameTypeToDynamic) { node.methodName.staticType = _dynamicType; } diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart index f91cdb4766a8..d2edb39634fe 100644 --- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart +++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart @@ -1170,7 +1170,7 @@ class ResolutionVisitor extends RecursiveAstVisitor { /// declarations are not valid (they declare interfaces and mixins, but not /// classes). void _resolveType(TypeName typeName, ErrorCode errorCode, - {bool asClass: false}) { + {bool asClass = false}) { visitTypeName(typeName); DartType type = typeName.type; diff --git a/pkg/analyzer/lib/src/dart/scanner/scanner.dart b/pkg/analyzer/lib/src/dart/scanner/scanner.dart index 49436804e9bc..9b3b4e452c94 100644 --- a/pkg/analyzer/lib/src/dart/scanner/scanner.dart +++ b/pkg/analyzer/lib/src/dart/scanner/scanner.dart @@ -85,7 +85,7 @@ class Scanner { contents: reader.getContents(), offset: reader.offset); factory Scanner.fasta(Source source, AnalysisErrorListener errorListener, - {String contents, int offset: -1}) { + {String contents, int offset = -1}) { return new Scanner._( source, contents ?? source.contents.data, offset, errorListener); } diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart index 3370d7fb80ac..36bee0e638e2 100644 --- a/pkg/analyzer/lib/src/error/codes.dart +++ b/pkg/analyzer/lib/src/error/codes.dart @@ -5380,7 +5380,7 @@ class CompileTimeErrorCode extends AnalyzerErrorCode { const CompileTimeErrorCode(String name, String message, {String correction, bool hasPublishedDocs, - bool isUnresolvedIdentifier: false}) + bool isUnresolvedIdentifier = false}) : super.temporary(name, message, correction: correction, hasPublishedDocs: hasPublishedDocs, @@ -6323,7 +6323,7 @@ class StaticTypeWarningCode extends AnalyzerErrorCode { const StaticTypeWarningCode(String name, String message, {String correction, bool hasPublishedDocs, - bool isUnresolvedIdentifier: false}) + bool isUnresolvedIdentifier = false}) : super.temporary(name, message, correction: correction, hasPublishedDocs: hasPublishedDocs, @@ -7801,7 +7801,7 @@ class StaticWarningCode extends AnalyzerErrorCode { {String correction, this.errorSeverity = ErrorSeverity.ERROR, bool hasPublishedDocs, - bool isUnresolvedIdentifier: false}) + bool isUnresolvedIdentifier = false}) : super.temporary(name, message, correction: correction, hasPublishedDocs: hasPublishedDocs, diff --git a/pkg/analyzer/lib/src/error/dead_code_verifier.dart b/pkg/analyzer/lib/src/error/dead_code_verifier.dart index dbf5fab6f6e4..893a1209bc9e 100644 --- a/pkg/analyzer/lib/src/error/dead_code_verifier.dart +++ b/pkg/analyzer/lib/src/error/dead_code_verifier.dart @@ -404,7 +404,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor { /// continue, return, or throw statement at the end of a switch case, that are /// mandated by the language spec. void _checkForDeadStatementsInNodeList(NodeList statements, - {bool allowMandated: false}) { + {bool allowMandated = false}) { bool statementExits(Statement statement) { if (statement is BreakStatement) { return statement.label == null; diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart index 3e3f75ffc71e..01f22884fa61 100644 --- a/pkg/analyzer/lib/src/error/inheritance_override.dart +++ b/pkg/analyzer/lib/src/error/inheritance_override.dart @@ -117,7 +117,7 @@ class _ClassVerifier { this.library, this.classNameNode, this.implementsClause, - this.members: const [], + this.members = const [], this.onClause, this.superclass, this.withClause, diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart index feb7883db5ce..fd39f1664075 100644 --- a/pkg/analyzer/lib/src/fasta/ast_builder.dart +++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart @@ -167,7 +167,7 @@ class AstBuilder extends StackListener { @override void addProblem(Message message, int charOffset, int length, - {bool wasHandled: false, List context}) { + {bool wasHandled = false, List context}) { if (directives.isEmpty && (message.code.analyzerCodes ?.contains('NON_PART_OF_DIRECTIVE_IN_PART') ?? diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart index 4f3f96ff688c..8cf09f2c21be 100644 --- a/pkg/analyzer/lib/src/generated/element_resolver.dart +++ b/pkg/analyzer/lib/src/generated/element_resolver.dart @@ -120,7 +120,7 @@ class ElementResolver extends SimpleAstVisitor { * Initialize a newly created visitor to work for the given [_resolver] to * resolve the nodes in a compilation unit. */ - ElementResolver(this._resolver, {this.reportConstEvaluationErrors: true}) + ElementResolver(this._resolver, {this.reportConstEvaluationErrors = true}) : _definingLibrary = _resolver.definingLibrary, _extensionResolver = _resolver.extensionResolver, _methodInvocationResolver = new MethodInvocationResolver(_resolver) { @@ -1097,7 +1097,7 @@ class ElementResolver extends SimpleAstVisitor { * Return the static type of the given [expression] that is to be used for * type analysis. */ - DartType _getStaticType(Expression expression, {bool read: false}) { + DartType _getStaticType(Expression expression, {bool read = false}) { if (expression is NullLiteral) { return _resolver.typeProvider.nullType; } diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart index 3d14d46bcc99..c641c32a986f 100644 --- a/pkg/analyzer/lib/src/generated/error_verifier.dart +++ b/pkg/analyzer/lib/src/generated/error_verifier.dart @@ -294,7 +294,7 @@ class ErrorVerifier extends RecursiveAstVisitor { */ ErrorVerifier(ErrorReporter errorReporter, this._currentLibrary, this._typeProvider, this._inheritanceManager, bool enableSuperMixins, - {this.disableConflictingGenericsCheck: false}) + {this.disableConflictingGenericsCheck = false}) : _errorReporter = errorReporter, _uninstantiatedBoundChecker = new _UninstantiatedBoundChecker(errorReporter), diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart index 621d1eec50ee..078ed7a8705e 100644 --- a/pkg/analyzer/lib/src/generated/parser.dart +++ b/pkg/analyzer/lib/src/generated/parser.dart @@ -324,7 +324,7 @@ class Parser { } /// Return a synthetic identifier. - SimpleIdentifier createSyntheticIdentifier({bool isDeclaration: false}) { + SimpleIdentifier createSyntheticIdentifier({bool isDeclaration = false}) { Token syntheticToken; if (_currentToken.type.isKeyword) { // Consider current keyword token as an identifier. @@ -778,7 +778,7 @@ class Parser { /// unconditionalAssignableSelector /// | '?.' identifier Expression parseAssignableSelector(Expression prefix, bool optional, - {bool allowConditional: true}) { + {bool allowConditional = true}) { TokenType type = _currentToken.type; if (type == TokenType.OPEN_SQUARE_BRACKET) { Token leftBracket = getAndAdvance(); @@ -2720,7 +2720,7 @@ class Parser { /// | 'var' /// | type FinalConstVarOrType parseFinalConstVarOrType(bool optional, - {bool inFunctionType: false}) { + {bool inFunctionType = false}) { Token keywordToken; TypeAnnotation type; Keyword keyword = _currentToken.keyword; @@ -2773,7 +2773,7 @@ class Parser { /// normalFormalParameter ('=' expression)? /// normalFormalParameter (':' expression)? FormalParameter parseFormalParameter(ParameterKind kind, - {bool inFunctionType: false}) { + {bool inFunctionType = false}) { NormalFormalParameter parameter = parseNormalFormalParameter(inFunctionType: inFunctionType); TokenType type = _currentToken.type; @@ -2854,7 +2854,7 @@ class Parser { /// /// namedFormalParameters ::= /// '{' defaultNamedParameter (',' defaultNamedParameter)* '}' - FormalParameterList parseFormalParameterList({bool inFunctionType: false}) { + FormalParameterList parseFormalParameterList({bool inFunctionType = false}) { if (_matches(TokenType.OPEN_PAREN)) { return _parseFormalParameterListUnchecked(inFunctionType: inFunctionType); } @@ -3542,7 +3542,7 @@ class Parser { /// /// label ::= /// identifier ':' - Label parseLabel({bool isDeclaration: false}) { + Label parseLabel({bool isDeclaration = false}) { SimpleIdentifier label = _parseSimpleIdentifierUnchecked(isDeclaration: isDeclaration); Token colon = getAndAdvance(); @@ -4086,7 +4086,7 @@ class Parser { /// declaredIdentifier /// | metadata identifier NormalFormalParameter parseNormalFormalParameter( - {bool inFunctionType: false}) { + {bool inFunctionType = false}) { Token covariantKeyword; CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); if (_matchesKeyword(Keyword.COVARIANT)) { @@ -4588,7 +4588,7 @@ class Parser { /// identifier ::= /// IDENTIFIER SimpleIdentifier parseSimpleIdentifier( - {bool allowKeyword: false, bool isDeclaration: false}) { + {bool allowKeyword = false, bool isDeclaration = false}) { if (_matchesIdentifier() || (allowKeyword && _tokenMatchesIdentifierOrKeyword(_currentToken))) { return _parseSimpleIdentifierUnchecked(isDeclaration: isDeclaration); @@ -5645,7 +5645,7 @@ class Parser { /// Create and return a new token with the given [type]. The token will /// replace the first portion of the given [token], so it will have the same /// offset and will have any comments that might have preceded the token. - Token _createToken(Token token, TokenType type, {bool isBegin: false}) { + Token _createToken(Token token, TokenType type, {bool isBegin = false}) { CommentToken comments = token.precedingComments; if (comments == null) { if (isBegin) { @@ -6322,7 +6322,7 @@ class Parser { /// Parse a list of formal parameters given that the list starts with the /// given [leftParenthesis]. Return the formal parameters that were parsed. FormalParameterList _parseFormalParameterListAfterParen(Token leftParenthesis, - {bool inFunctionType: false}) { + {bool inFunctionType = false}) { if (_matches(TokenType.CLOSE_PAREN)) { return astFactory.formalParameterList( leftParenthesis, null, null, null, getAndAdvance()); @@ -6496,7 +6496,7 @@ class Parser { /// /// This method assumes that the current token matches `TokenType.OPEN_PAREN`. FormalParameterList _parseFormalParameterListUnchecked( - {bool inFunctionType: false}) { + {bool inFunctionType = false}) { return _parseFormalParameterListAfterParen(getAndAdvance(), inFunctionType: inFunctionType); } @@ -6928,7 +6928,7 @@ class Parser { /// identifier ::= /// IDENTIFIER SimpleIdentifier _parseSimpleIdentifierUnchecked( - {bool isDeclaration: false}) { + {bool isDeclaration = false}) { String lexeme = _currentToken.lexeme; if ((_inAsync || _inGenerator) && (lexeme == _AWAIT || lexeme == _YIELD)) { _reportErrorForCurrentToken( diff --git a/pkg/analyzer/lib/src/generated/parser_fasta.dart b/pkg/analyzer/lib/src/generated/parser_fasta.dart index 40d68b3c588d..4308a54f97ca 100644 --- a/pkg/analyzer/lib/src/generated/parser_fasta.dart +++ b/pkg/analyzer/lib/src/generated/parser_fasta.dart @@ -25,7 +25,7 @@ abstract class ParserAdapter implements Parser { ParserAdapter(this.currentToken, ErrorReporter errorReporter, Uri fileUri, FeatureSet featureSet, - {bool allowNativeClause: false}) + {bool allowNativeClause = false}) : fastaParser = new fasta.Parser(null), astBuilder = new AstBuilder(errorReporter, fileUri, true, featureSet) { fastaParser.listener = astBuilder; @@ -215,7 +215,7 @@ abstract class ParserAdapter implements Parser { Expression parseExpressionWithoutCascade() => parseExpression2(); @override - FormalParameterList parseFormalParameterList({bool inFunctionType: false}) { + FormalParameterList parseFormalParameterList({bool inFunctionType = false}) { currentToken = fastaParser .parseFormalParametersRequiredOpt( fastaParser.syntheticPreviousToken(currentToken), @@ -277,7 +277,7 @@ abstract class ParserAdapter implements Parser { @override SimpleIdentifier parseSimpleIdentifier( - {bool allowKeyword: false, bool isDeclaration: false}) => + {bool allowKeyword = false, bool isDeclaration = false}) => parseExpression2(); @override @@ -380,14 +380,14 @@ class _Parser2 extends ParserAdapter { factory _Parser2( Source source, AnalysisErrorListener errorListener, FeatureSet featureSet, - {bool allowNativeClause: false}) { + {bool allowNativeClause = false}) { var errorReporter = new ErrorReporter(errorListener, source); return new _Parser2._(source, errorReporter, source.uri, featureSet, allowNativeClause: allowNativeClause); } _Parser2._(this._source, ErrorReporter errorReporter, Uri fileUri, - FeatureSet featureSet, {bool allowNativeClause: false}) + FeatureSet featureSet, {bool allowNativeClause = false}) : super(null, errorReporter, fileUri, featureSet, allowNativeClause: allowNativeClause); diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart index 7a0bbc7b2c1b..babf196d93af 100644 --- a/pkg/analyzer/lib/src/generated/resolver.dart +++ b/pkg/analyzer/lib/src/generated/resolver.dart @@ -570,8 +570,8 @@ class ResolverVisitor extends ScopedVisitor { AnalysisErrorListener errorListener, {FeatureSet featureSet, Scope nameScope, - bool propagateTypes: true, - reportConstEvaluationErrors: true, + bool propagateTypes = true, + reportConstEvaluationErrors = true, FlowAnalysisHelper flowAnalysisHelper}) : this._( inheritanceManager, @@ -2394,7 +2394,7 @@ class ResolverVisitor extends ScopedVisitor { FunctionType _inferArgumentTypesForGeneric(AstNode inferenceNode, DartType uninstantiatedType, TypeArgumentList typeArguments, - {AstNode errorNode, bool isConst: false}) { + {AstNode errorNode, bool isConst = false}) { errorNode ??= inferenceNode; if (typeArguments == null && uninstantiatedType is FunctionType && @@ -3428,7 +3428,7 @@ class TypeNameResolver { this.definingLibrary, this.source, this.errorListener, - {this.shouldUseWithClauseInferredTypes: true}) + {this.shouldUseWithClauseInferredTypes = true}) : dynamicType = typeProvider.dynamicType, analysisOptions = definingLibrary.context.analysisOptions; diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart index d3e5bba64a73..5a367b12fee6 100644 --- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart +++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart @@ -204,7 +204,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor { return inferred; } - DartType inferListType(ListLiteral node, {bool downwards: false}) { + DartType inferListType(ListLiteral node, {bool downwards = false}) { DartType contextType = InferenceContext.getContext(node); var element = _typeProvider.listElement; @@ -1251,7 +1251,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor { */ void _analyzeLeastUpperBound( Expression node, Expression expr1, Expression expr2, - {bool read: false}) { + {bool read = false}) { DartType staticType1 = _getExpressionType(expr1, read: read); DartType staticType2 = _getExpressionType(expr2, read: read); @@ -1459,7 +1459,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor { * See [getExpressionType] for more information. Without strong mode, this is * equivalent to [_getStaticType]. */ - DartType _getExpressionType(Expression expr, {bool read: false}) => + DartType _getExpressionType(Expression expr, {bool read = false}) => getExpressionType(expr, _typeSystem, _typeProvider, read: read); /** @@ -1483,7 +1483,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor { /** * Return the static type of the given [expression]. */ - DartType _getStaticType(Expression expression, {bool read: false}) { + DartType _getStaticType(Expression expression, {bool read = false}) { DartType type; if (read) { type = getReadType(expression); @@ -1652,7 +1652,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor { TypeArgumentList typeArguments, ArgumentList argumentList, AstNode errorNode, - {bool isConst: false}) { + {bool isConst = false}) { if (typeArguments == null && fnType is FunctionType && fnType.typeFormals.isNotEmpty) { diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart index a041a8a2315a..d7fb2fa022ed 100644 --- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart +++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart @@ -560,7 +560,7 @@ class AstTestFactory { static ForElement forElement( ForLoopParts forLoopParts, CollectionElement body, - {bool hasAwait: false}) => + {bool hasAwait = false}) => astFactory.forElement( awaitKeyword: hasAwait ? TokenFactory.tokenFromKeyword(Keyword.AWAIT) : null, @@ -666,7 +666,7 @@ class AstTestFactory { static GenericFunctionType genericFunctionType(TypeAnnotation returnType, TypeParameterList typeParameters, FormalParameterList parameters, - {bool question: false}) => + {bool question = false}) => astFactory.genericFunctionType(returnType, TokenFactory.tokenFromString("Function"), typeParameters, parameters, question: @@ -975,11 +975,11 @@ class AstTestFactory { body); static MethodDeclaration methodDeclaration4( - {bool external: false, + {bool external = false, Keyword modifier, TypeAnnotation returnType, Keyword property, - bool operator: false, + bool operator = false, String name, FormalParameterList parameters, FunctionBody body}) => diff --git a/pkg/analyzer/lib/src/generated/testing/element_factory.dart b/pkg/analyzer/lib/src/generated/testing/element_factory.dart index 05ea5ae01cc8..dff15710ded7 100644 --- a/pkg/analyzer/lib/src/generated/testing/element_factory.dart +++ b/pkg/analyzer/lib/src/generated/testing/element_factory.dart @@ -405,7 +405,7 @@ class ElementFactory { } static GenericTypeAliasElementImpl genericTypeAliasElement(String name, - {List parameters: const [], DartType returnType}) { + {List parameters = const [], DartType returnType}) { var element = new GenericTypeAliasElementImpl(name, -1); element.function = new GenericFunctionTypeElementImpl.forOffset(-1) ..parameters = parameters @@ -442,7 +442,7 @@ class ElementFactory { } static LibraryElementImpl library(AnalysisContext context, String libraryName, - {bool isNonNullableByDefault: true}) { + {bool isNonNullableByDefault = true}) { String fileName = "/$libraryName.dart"; CompilationUnitElementImpl unit = compilationUnit(fileName); LibraryElementImpl library = new LibraryElementImpl(context, null, diff --git a/pkg/analyzer/lib/src/generated/type_system.dart b/pkg/analyzer/lib/src/generated/type_system.dart index 90d04d47a28f..8ad789059ffd 100644 --- a/pkg/analyzer/lib/src/generated/type_system.dart +++ b/pkg/analyzer/lib/src/generated/type_system.dart @@ -653,8 +653,8 @@ class Dart2TypeSystem extends TypeSystem { @required bool isNonNullableByDefault, ErrorReporter errorReporter, AstNode errorNode, - bool downwards: false, - bool isConst: false, + bool downwards = false, + bool isConst = false, }) { if (typeParameters.isEmpty) { return null; @@ -2097,7 +2097,7 @@ class Dart2TypeSystem extends TypeSystem { * If [lowerBound] is true, this will return the "least closure", otherwise * it returns the "greatest closure". */ - DartType _substituteForUnknownType(DartType type, {bool lowerBound: false}) { + DartType _substituteForUnknownType(DartType type, {bool lowerBound = false}) { return _substituteType(type, lowerBound, (type, lowerBound) { if (identical(type, UnknownInferredType.instance)) { return lowerBound ? typeProvider.nullType : typeProvider.dynamicType; @@ -2268,11 +2268,11 @@ class GenericInferrer { /// false, we are on our final inference pass, have all available information /// including argument types, and must not conclude `?` for any type formal. List infer(List typeFormals, - {bool considerExtendsClause: true, + {bool considerExtendsClause = true, ErrorReporter errorReporter, AstNode errorNode, - bool failAtError: false, - bool downwardsInferPhase: false}) { + bool failAtError = false, + bool downwardsInferPhase = false}) { // Initialize the inferred type array. // // In the downwards phase, they all start as `?` to offer reasonable @@ -2443,7 +2443,7 @@ class GenericInferrer { /// type parameter which means we choose the upper bound rather than the /// lower bound for normally covariant type parameters. DartType _chooseTypeFromConstraints(Iterable<_TypeConstraint> constraints, - {bool toKnownType: false, @required bool isContravariant}) { + {bool toKnownType = false, @required bool isContravariant}) { DartType lower = UnknownInferredType.instance; DartType upper = UnknownInferredType.instance; for (var constraint in constraints) { diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart index 35114ca78f9e..39ef94252ce8 100644 --- a/pkg/analyzer/lib/src/lint/analysis.dart +++ b/pkg/analyzer/lib/src/lint/analysis.dart @@ -46,7 +46,7 @@ Source createSource(Uri sourceUri) { } /// Print the given message and exit with the given [exitCode] -void printAndFail(String message, {int exitCode: 15}) { +void printAndFail(String message, {int exitCode = 15}) { print(message); io.exit(exitCode); } diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart index 319b9e9c8d52..d3bfe2e06541 100644 --- a/pkg/analyzer/lib/src/lint/linter.dart +++ b/pkg/analyzer/lib/src/lint/linter.dart @@ -80,7 +80,7 @@ class DartLinter implements AnalysisErrorListener { int numSourcesAnalyzed; /// Creates a new linter. - DartLinter(this.options, {this.reporter: const PrintingReporter()}); + DartLinter(this.options, {this.reporter = const PrintingReporter()}); Future> lintFiles(List files) async { // TODO(brianwilkerson) Determine whether this await is necessary. @@ -180,14 +180,14 @@ class Group implements Comparable { final String description; final Hyperlink link; - factory Group(String name, {String description: '', Hyperlink link}) { + factory Group(String name, {String description = '', Hyperlink link}) { var n = name.toLowerCase(); return builtin.firstWhere((g) => g.name == n, orElse: () => new Group._(name, custom: true, description: description, link: link)); } - const Group._(this.name, {this.custom: false, this.description, this.link}); + const Group._(this.name, {this.custom = false, this.description, this.link}); @override int compareTo(Group other) => name.compareTo(other.name); @@ -198,7 +198,7 @@ class Hyperlink { final String href; final bool bold; - const Hyperlink(this.label, this.href, {this.bold: false}); + const Hyperlink(this.label, this.href, {this.bold = false}); String get html => '${_emph(label)}'; @@ -453,7 +453,7 @@ abstract class LintRule extends Linter implements Comparable { this.group, this.description, this.details, - this.maturity: Maturity.stable}); + this.maturity = Maturity.stable}); LintCode get lintCode => new _LintCode(name, description); @@ -479,18 +479,18 @@ abstract class LintRule extends Linter implements Comparable { AstVisitor getVisitor() => null; void reportLint(AstNode node, - {List arguments: const [], + {List arguments = const [], ErrorCode errorCode, - bool ignoreSyntheticNodes: true}) { + bool ignoreSyntheticNodes = true}) { if (node != null && (!node.isSynthetic || !ignoreSyntheticNodes)) { reporter.reportErrorForNode(errorCode ?? lintCode, node, arguments); } } void reportLintForToken(Token token, - {List arguments: const [], + {List arguments = const [], ErrorCode errorCode, - bool ignoreSyntheticTokens: true}) { + bool ignoreSyntheticTokens = true}) { if (token != null && (!token.isSynthetic || !ignoreSyntheticTokens)) { reporter.reportErrorForToken(errorCode ?? lintCode, token, arguments); } @@ -593,7 +593,7 @@ class SourceLinter implements DartLinter, AnalysisErrorListener { @override int numSourcesAnalyzed; - SourceLinter(this.options, {this.reporter: const PrintingReporter()}); + SourceLinter(this.options, {this.reporter = const PrintingReporter()}); @override Future> lintFiles(List files) async { diff --git a/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.dart b/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.dart index 0e3461b7e05f..c9d0ec085090 100644 --- a/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.dart +++ b/pkg/analyzer/lib/src/pubspec/pubspec_warning_code.dart @@ -92,7 +92,7 @@ class PubspecWarningCode extends ErrorCode { const PubspecWarningCode( 'UNNECESSARY_DEV_DEPENDENCY', "The dev dependency on {0} is unnecessary because there is also a " - "normal dependency on that package.", + "normal dependency on that package.", correction: "Try removing the dev dependency."); /** diff --git a/pkg/analyzer/lib/src/summary/flat_buffers.dart b/pkg/analyzer/lib/src/summary/flat_buffers.dart index 96d071984188..ba4ae25096f5 100644 --- a/pkg/analyzer/lib/src/summary/flat_buffers.dart +++ b/pkg/analyzer/lib/src/summary/flat_buffers.dart @@ -132,7 +132,7 @@ class Builder { */ Map> _strings = >{}; - Builder({this.initialSize: 1024}) { + Builder({this.initialSize = 1024}) { reset(); } @@ -512,7 +512,7 @@ class Builder { * Additionally allocate the specified [additionalBytes]. Update the current * tail pointer to point at the allocated space. */ - void _prepare(int size, int count, {int additionalBytes: 0}) { + void _prepare(int size, int count, {int additionalBytes = 0}) { // Update the alignment. if (_maxAlign < size) { _maxAlign = size; diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart b/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart index b866a5387aa5..ba41968d12f5 100644 --- a/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart +++ b/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart @@ -225,43 +225,43 @@ class AstBinaryFlags { ); static int encode({ - bool hasAwait: false, - bool hasEqual: false, - bool hasInitializer: false, - bool hasName: false, - bool hasNot: false, - bool hasPeriod: false, - bool hasPeriod2: false, - bool hasQuestion: false, - bool hasSeparatorColon: false, - bool hasSeparatorEquals: false, - bool hasThis: false, - bool hasTypeArguments: false, - bool isAbstract: false, - bool isAsync: false, - bool isConst: false, - bool isCovariant: false, - bool isDeclaration: false, - bool isDeferred: false, - bool isDelimiterCurly: false, - bool isDelimiterSquare: false, - bool isExternal: false, - bool isFactory: false, - bool isFinal: false, - bool isGenerator: false, - bool isGet: false, - bool isLate: false, - bool isMap: false, - bool isNative: false, - bool isNew: false, - bool isOperator: false, - bool isRequired: false, - bool isSet: false, - bool isStar: false, - bool isStatic: false, - bool isStringInterpolationIdentifier: false, - bool isSync: false, - bool isVar: false, + bool hasAwait = false, + bool hasEqual = false, + bool hasInitializer = false, + bool hasName = false, + bool hasNot = false, + bool hasPeriod = false, + bool hasPeriod2 = false, + bool hasQuestion = false, + bool hasSeparatorColon = false, + bool hasSeparatorEquals = false, + bool hasThis = false, + bool hasTypeArguments = false, + bool isAbstract = false, + bool isAsync = false, + bool isConst = false, + bool isCovariant = false, + bool isDeclaration = false, + bool isDeferred = false, + bool isDelimiterCurly = false, + bool isDelimiterSquare = false, + bool isExternal = false, + bool isFactory = false, + bool isFinal = false, + bool isGenerator = false, + bool isGet = false, + bool isLate = false, + bool isMap = false, + bool isNative = false, + bool isNew = false, + bool isOperator = false, + bool isRequired = false, + bool isSet = false, + bool isStar = false, + bool isStatic = false, + bool isStringInterpolationIdentifier = false, + bool isSync = false, + bool isVar = false, }) { var result = 0; if (hasAwait) { diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart index 37aa5f73d634..b08017dd42cd 100644 --- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart +++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart @@ -1624,7 +1624,7 @@ class AstBinaryWriter extends ThrowingAstVisitor { } void _storeTypedLiteral(LinkedNodeBuilder builder, TypedLiteral node, - {bool isMap: false, bool isSet: false}) { + {bool isMap = false, bool isSet = false}) { _storeExpression(builder, node); builder ..flags = AstBinaryFlags.encode( diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart index 9fe89e9ee3cd..876427a59aed 100644 --- a/pkg/analyzer/lib/src/task/strong/checker.dart +++ b/pkg/analyzer/lib/src/task/strong/checker.dart @@ -36,7 +36,7 @@ import 'ast_properties.dart'; /// gets the known static type of the expression. DartType getExpressionType( Expression expression, TypeSystemImpl typeSystem, TypeProvider typeProvider, - {bool read: false}) { + {bool read = false}) { DartType type; if (read) { type = getReadType(expression); @@ -829,10 +829,10 @@ class CodeChecker extends RecursiveAstVisitor { /// [to] or is already a subtype of it, does nothing. void _checkImplicitCast(Expression expr, DartType to, {DartType from, - bool opAssign: false, - bool forSpread: false, - bool forSpreadKey: false, - bool forSpreadValue: false}) { + bool opAssign = false, + bool forSpread = false, + bool forSpreadKey = false, + bool forSpreadValue = false}) { from ??= _getExpressionType(expr); if (_needsImplicitCast(expr, to, from: from) == true) { @@ -943,7 +943,7 @@ class CodeChecker extends RecursiveAstVisitor { } void _checkReturnOrYield(Expression expression, AstNode node, - {bool yieldStar: false}) { + {bool yieldStar = false}) { FunctionBody body = node.thisOrAncestorOfType(); var type = _getExpectedReturnType(body, yieldStar: yieldStar); if (type == null) { @@ -1004,7 +1004,7 @@ class CodeChecker extends RecursiveAstVisitor { /// Gets the expected return type of the given function [body], either from /// a normal return/yield, or from a yield*. - DartType _getExpectedReturnType(FunctionBody body, {bool yieldStar: false}) { + DartType _getExpectedReturnType(FunctionBody body, {bool yieldStar = false}) { FunctionType functionType; var parent = body.parent; if (parent is Declaration) { @@ -1101,10 +1101,10 @@ class CodeChecker extends RecursiveAstVisitor { e is PropertyAccessorElement && e.variable is FieldElement); void _markImplicitCast(Expression expr, DartType to, - {bool opAssign: false, - bool forSpread: false, - bool forSpreadKey: false, - bool forSpreadValue: false}) { + {bool opAssign = false, + bool forSpread = false, + bool forSpreadKey = false, + bool forSpreadValue = false}) { if (opAssign) { setImplicitOperationCast(expr, to); } else if (forSpread) { @@ -1176,10 +1176,10 @@ class CodeChecker extends RecursiveAstVisitor { /// the AST node. void _recordImplicitCast(Expression expr, DartType to, {DartType from, - bool opAssign: false, - forSpread: false, - forSpreadKey: false, - forSpreadValue: false}) { + bool opAssign = false, + forSpread = false, + forSpreadKey = false, + forSpreadValue = false}) { // If this is an implicit tearoff, we need to mark the cast, but we don't // want to warn if it's a legal subtype. if (from is InterfaceType && rules.acceptsFunctionType(to)) { @@ -1799,7 +1799,7 @@ class _TopLevelInitializerValidator extends RecursiveAstVisitor { } void validateIdentifierElement(AstNode n, Element e, - {bool isMethodCall: false}) { + {bool isMethodCall = false}) { if (e == null) { return; } diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart index eb7bc31413e7..1d4e2ee8018b 100644 --- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart +++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart @@ -888,7 +888,7 @@ class MockSdk implements DartSdk { /// Optional [additionalLibraries] should have unique URIs, and paths in /// their units are relative (will be put into `sdkRoot/lib`). MockSdk({ - bool generateSummaryFiles: false, + bool generateSummaryFiles = false, @required this.resourceProvider, AnalysisOptionsImpl analysisOptions, List additionalLibraries = const [], diff --git a/pkg/analyzer/test/generated/constant_test.dart b/pkg/analyzer/test/generated/constant_test.dart index c234d8a6077e..0780d4c39f48 100644 --- a/pkg/analyzer/test/generated/constant_test.dart +++ b/pkg/analyzer/test/generated/constant_test.dart @@ -481,7 +481,7 @@ class C { } Future _getExpressionValue(String expressionCode, - {String context: ''}) async { + {String context = ''}) async { await resolveTestCode(''' var x = $expressionCode; diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart index 8abe2b4f4943..1073f8ccfcec 100644 --- a/pkg/analyzer/test/generated/parser_fasta_test.dart +++ b/pkg/analyzer/test/generated/parser_fasta_test.dart @@ -1992,7 +1992,7 @@ class FastaParserTestCase @override Expression parseAssignableSelector(String code, bool optional, - {bool allowConditional: true}) { + {bool allowConditional = true}) { if (optional) { if (code.isEmpty) { return _parseExpression('foo'); @@ -2173,7 +2173,7 @@ class FastaParserTestCase @override FormalParameter parseFormalParameter(String code, ParameterKind kind, - {List errorCodes: const []}) { + {List errorCodes = const []}) { String parametersCode; if (kind == ParameterKind.REQUIRED) { parametersCode = '($code)'; @@ -2191,8 +2191,8 @@ class FastaParserTestCase @override FormalParameterList parseFormalParameterList(String code, - {bool inFunctionType: false, - List errorCodes: const [], + {bool inFunctionType = false, + List errorCodes = const [], List errors}) { createParser(code); FormalParameterList result = @@ -2284,8 +2284,8 @@ class FastaParserTestCase @override NormalFormalParameter parseNormalFormalParameter(String code, - {bool inFunctionType: false, - List errorCodes: const []}) { + {bool inFunctionType = false, + List errorCodes = const []}) { FormalParameterList list = parseFormalParameterList('($code)', inFunctionType: inFunctionType, errorCodes: errorCodes); return list.parameters.single; @@ -3243,7 +3243,7 @@ class ParserProxy extends analyzer.ParserAdapter { * Fasta token. */ factory ParserProxy(analyzer.Token firstToken, FeatureSet featureSet, - {bool allowNativeClause: false, int expectedEndOffset}) { + {bool allowNativeClause = false, int expectedEndOffset}) { TestSource source = new TestSource(); var errorListener = new GatheringErrorListener(checkRanges: true); var errorReporter = new ErrorReporter(errorListener, source); @@ -3255,7 +3255,7 @@ class ParserProxy extends analyzer.ParserAdapter { ParserProxy._(analyzer.Token firstToken, ErrorReporter errorReporter, Uri fileUri, this._errorListener, FeatureSet featureSet, - {bool allowNativeClause: false, this.expectedEndOffset}) + {bool allowNativeClause = false, this.expectedEndOffset}) : super(firstToken, errorReporter, fileUri, featureSet, allowNativeClause: allowNativeClause) { _eventListener = new ForwardingTestListener(astBuilder); @@ -3329,7 +3329,7 @@ class ParserProxy extends analyzer.ParserAdapter { } @override - FormalParameterList parseFormalParameterList({bool inFunctionType: false}) { + FormalParameterList parseFormalParameterList({bool inFunctionType = false}) { return _run('unspecified', () => super.parseFormalParameterList(inFunctionType: inFunctionType)); } diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart index 4d04bc4fe32b..d2660cf97754 100644 --- a/pkg/analyzer/test/generated/parser_test.dart +++ b/pkg/analyzer/test/generated/parser_test.dart @@ -122,7 +122,7 @@ abstract class AbstractParserTestCase implements ParserTestHelpers { Expression parseAssignableExpression(String code, bool primaryAllowed); Expression parseAssignableSelector(String code, bool optional, - {bool allowConditional: true}); + {bool allowConditional = true}); AwaitExpression parseAwaitExpression(String code); @@ -170,11 +170,11 @@ abstract class AbstractParserTestCase implements ParserTestHelpers { Expression parseExpressionWithoutCascade(String code); FormalParameter parseFormalParameter(String code, ParameterKind kind, - {List errorCodes: const []}); + {List errorCodes = const []}); FormalParameterList parseFormalParameterList(String code, - {bool inFunctionType: false, - List errorCodes: const [], + {bool inFunctionType = false, + List errorCodes = const [], List errors}); /** @@ -213,8 +213,8 @@ abstract class AbstractParserTestCase implements ParserTestHelpers { InstanceCreationExpression parseNewExpression(String code); NormalFormalParameter parseNormalFormalParameter(String code, - {bool inFunctionType: false, - List errorCodes: const []}); + {bool inFunctionType = false, + List errorCodes = const []}); Expression parsePostfixExpression(String code); @@ -9508,7 +9508,7 @@ class ParserTestCase with ParserTestHelpers implements AbstractParserTestCase { @override Expression parseAssignableSelector(String code, bool optional, - {bool allowConditional: true}) { + {bool allowConditional = true}) { if (usingFastaParser) { if (optional) { if (code.isEmpty) { @@ -9720,7 +9720,7 @@ class ParserTestCase with ParserTestHelpers implements AbstractParserTestCase { @override FormalParameter parseFormalParameter(String code, ParameterKind kind, - {List errorCodes: const []}) { + {List errorCodes = const []}) { if (usingFastaParser) { String parametersCode; if (kind == ParameterKind.REQUIRED) { @@ -9745,8 +9745,8 @@ class ParserTestCase with ParserTestHelpers implements AbstractParserTestCase { @override FormalParameterList parseFormalParameterList(String code, - {bool inFunctionType: false, - List errorCodes: const [], + {bool inFunctionType = false, + List errorCodes = const [], List errors}) { createParser(code); FormalParameterList list = @@ -9890,8 +9890,8 @@ class ParserTestCase with ParserTestHelpers implements AbstractParserTestCase { @override NormalFormalParameter parseNormalFormalParameter(String code, - {bool inFunctionType: false, - List errorCodes: const []}) { + {bool inFunctionType = false, + List errorCodes = const []}) { if (usingFastaParser) { FormalParameterList list = parseFormalParameterList('($code)', inFunctionType: inFunctionType, errorCodes: errorCodes); @@ -15945,7 +15945,7 @@ main() { expect(statement.semicolon, isNotNull); } - Statement _parseAsyncStatement(String code, {bool isGenerator: false}) { + Statement _parseAsyncStatement(String code, {bool isGenerator = false}) { var star = isGenerator ? '*' : ''; var localFunction = parseStatement('wrapper() async$star { $code }') as FunctionDeclarationStatement; diff --git a/pkg/analyzer/test/generated/resolver_test_case.dart b/pkg/analyzer/test/generated/resolver_test_case.dart index 4d20c2014582..e7c4aac71961 100644 --- a/pkg/analyzer/test/generated/resolver_test_case.dart +++ b/pkg/analyzer/test/generated/resolver_test_case.dart @@ -420,7 +420,7 @@ class ResolverTestCase with ResourceProviderMixin { */ // TODO(rnystrom): Use this in more tests that have the same structure. Future assertErrorsInCode(String code, List errors, - {bool verify: true, String sourceName: _defaultSourceName}) async { + {bool verify = true, String sourceName = _defaultSourceName}) async { Source source = addNamedSource(sourceName, code); await computeAnalysisResult(source); assertErrors(source, errors); @@ -715,10 +715,10 @@ class StaticTypeAnalyzer2TestShared extends DriverResolutionTest { * output. */ FunctionTypeImpl expectFunctionType(String name, String type, - {String elementTypeParams: '[]', - String typeParams: '[]', - String typeArgs: '[]', - String typeFormals: '[]', + {String elementTypeParams = '[]', + String typeParams = '[]', + String typeArgs = '[]', + String typeFormals = '[]', String identifierType}) { identifierType ??= type; diff --git a/pkg/analyzer/test/generated/type_system_test.dart b/pkg/analyzer/test/generated/type_system_test.dart index 96960ba8bb84..9343d13a3865 100644 --- a/pkg/analyzer/test/generated/type_system_test.dart +++ b/pkg/analyzer/test/generated/type_system_test.dart @@ -1438,7 +1438,7 @@ class GenericFunctionInferenceTest extends AbstractTypeSystemTest { } List _inferCall(FunctionTypeImpl ft, List arguments, - {DartType returnType, bool expectError: false}) { + {DartType returnType, bool expectError = false}) { var listener = new RecordingErrorListener(); var reporter = new ErrorReporter( @@ -1468,7 +1468,7 @@ class GenericFunctionInferenceTest extends AbstractTypeSystemTest { } FunctionType _inferCall2(FunctionTypeImpl ft, List arguments, - {DartType returnType, bool expectError: false}) { + {DartType returnType, bool expectError = false}) { var typeArguments = _inferCall( ft, arguments, diff --git a/pkg/analyzer/test/source/analysis_options_provider_test.dart b/pkg/analyzer/test/source/analysis_options_provider_test.dart index 33e23e410814..0f41d2299ee0 100644 --- a/pkg/analyzer/test/source/analysis_options_provider_test.dart +++ b/pkg/analyzer/test/source/analysis_options_provider_test.dart @@ -241,7 +241,7 @@ analyzer: } } - YamlMap _getOptions(String posixPath, {bool crawlUp: false}) { + YamlMap _getOptions(String posixPath, {bool crawlUp = false}) { Resource resource = pathTranslator.getResource(posixPath); return provider.getOptions(resource, crawlUp: crawlUp); } diff --git a/pkg/analyzer/test/src/dart/analysis/base.dart b/pkg/analyzer/test/src/dart/analysis/base.dart index 29aeeb536c4e..79ddfd620fa1 100644 --- a/pkg/analyzer/test/src/dart/analysis/base.dart +++ b/pkg/analyzer/test/src/dart/analysis/base.dart @@ -70,7 +70,7 @@ class BaseAnalysisDriverTest with ResourceProviderMixin { bool get disableChangesAndCacheAllResults => false; - void addTestFile(String content, {bool priority: false}) { + void addTestFile(String content, {bool priority = false}) { testCode = content; newFile(testFile, content: content); driver.addFile(testFile); diff --git a/pkg/analyzer/test/src/dart/analysis/dependency/reference_collector_test.dart b/pkg/analyzer/test/src/dart/analysis/dependency/reference_collector_test.dart index ff7cce5331cc..a2538a452a7b 100644 --- a/pkg/analyzer/test/src/dart/analysis/dependency/reference_collector_test.dart +++ b/pkg/analyzer/test/src/dart/analysis/dependency/reference_collector_test.dart @@ -2252,10 +2252,10 @@ class _Base extends BaseDependencyTest { void _assertApi(Library library, String name, NodeKind kind, {String memberOf, String typeParameterOf, - List unprefixed: const [], - Map> prefixed: const {}, - List superPrefixed: const [], - List<_ExpectedClassMember> expectedMembers: const []}) { + List unprefixed = const [], + Map> prefixed = const {}, + List superPrefixed = const [], + List<_ExpectedClassMember> expectedMembers = const []}) { var node = getNode( library, name: name, @@ -2273,10 +2273,10 @@ class _Base extends BaseDependencyTest { } void _assertDependencies(Dependencies dependencies, - {List unprefixed: const [], - Map> prefixed: const {}, - List superPrefixed: const [], - List<_ExpectedClassMember> expectedMembers: const []}) { + {List unprefixed = const [], + Map> prefixed = const {}, + List superPrefixed = const [], + List<_ExpectedClassMember> expectedMembers = const []}) { expect(dependencies.unprefixedReferencedNames, unprefixed); expect(dependencies.importPrefixes, prefixed.keys); expect(dependencies.importPrefixedReferencedNames, prefixed.values); @@ -2301,10 +2301,10 @@ class _Base extends BaseDependencyTest { void _assertImpl(Library library, String name, NodeKind kind, {String memberOf, String typeParameterOf, - List unprefixed: const [], - Map> prefixed: const {}, - List superPrefixed: const [], - List<_ExpectedClassMember> expectedMembers: const []}) { + List unprefixed = const [], + Map> prefixed = const {}, + List superPrefixed = const [], + List<_ExpectedClassMember> expectedMembers = const []}) { var node = getNode( library, name: name, diff --git a/pkg/analyzer/test/src/dart/analysis/index_test.dart b/pkg/analyzer/test/src/dart/analysis/index_test.dart index d7b788fa76f6..9b765c380342 100644 --- a/pkg/analyzer/test/src/dart/analysis/index_test.dart +++ b/pkg/analyzer/test/src/dart/analysis/index_test.dart @@ -62,7 +62,7 @@ class IndexTest extends BaseAnalysisDriverTest { return findChildElement(testUnitElement, name, kind); } - CompilationUnitElement importedUnit({int index: 0}) { + CompilationUnitElement importedUnit({int index = 0}) { List imports = testLibraryElement.imports; return imports[index].importedLibrary.definingCompilationUnit; } diff --git a/pkg/analyzer/test/src/dart/analysis/search_test.dart b/pkg/analyzer/test/src/dart/analysis/search_test.dart index c6a0a664b4c4..31504678e6ee 100644 --- a/pkg/analyzer/test/src/dart/analysis/search_test.dart +++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart @@ -35,7 +35,7 @@ class ExpectedResult { final bool isQualified; ExpectedResult(this.enclosingElement, this.kind, this.offset, this.length, - {this.isResolved: true, this.isQualified: false}); + {this.isResolved = true, this.isQualified = false}); bool operator ==(Object result) { return result is SearchResult && @@ -1430,7 +1430,7 @@ class A { var searchedFiles = new SearchedFiles(); var results = await driver.search.subTypes(listElement, searchedFiles); - void assertHasResult(String path, String name, {bool not: false}) { + void assertHasResult(String path, String name, {bool not = false}) { var matcher = contains(predicate((SearchResult r) { var element = r.enclosingElement; return element.name == name && element.source.fullName == path; @@ -1557,7 +1557,7 @@ class NoMatchABCDEF {} ExpectedResult _expectId( Element enclosingElement, SearchResultKind kind, String search, - {int length, bool isResolved: true, bool isQualified: false}) { + {int length, bool isResolved = true, bool isQualified = false}) { int offset = findOffset(search); if (length == null) { length = getLeadingIdentifierLength(search); @@ -1571,7 +1571,7 @@ class NoMatchABCDEF {} */ ExpectedResult _expectIdQ( Element element, SearchResultKind kind, String search, - {int length, bool isResolved: true}) { + {int length, bool isResolved = true}) { return _expectId(element, kind, search, isQualified: true, length: length); } @@ -1605,7 +1605,7 @@ class NoMatchABCDEF {} return ElementLocator.locate(node); } - Future _resolveTestUnit(String code, {bool addToDriver: true}) async { + Future _resolveTestUnit(String code, {bool addToDriver = true}) async { if (addToDriver) { addTestFile(code); } else { diff --git a/pkg/analyzer/test/src/dart/constant/utilities_test.dart b/pkg/analyzer/test/src/dart/constant/utilities_test.dart index c3745912fb24..16bd4ae8f01b 100644 --- a/pkg/analyzer/test/src/dart/constant/utilities_test.dart +++ b/pkg/analyzer/test/src/dart/constant/utilities_test.dart @@ -206,9 +206,9 @@ class ConstantFinderTest { VariableDeclaration _setupFieldDeclaration( String className, String fieldName, Keyword keyword, - {bool isInitialized: true, - bool isStatic: false, - bool hasConstConstructor: false}) { + {bool isInitialized = true, + bool isStatic = false, + bool hasConstConstructor = false}) { VariableDeclaration variableDeclaration = isInitialized ? AstTestFactory.variableDeclaration2( fieldName, AstTestFactory.integer(0)) @@ -252,7 +252,7 @@ class ConstantFinderTest { VariableElement _setupVariableDeclaration( String name, bool isConst, bool isInitialized, - {isFinal: false}) { + {isFinal = false}) { VariableDeclaration variableDeclaration = isInitialized ? AstTestFactory.variableDeclaration2(name, AstTestFactory.integer(0)) : AstTestFactory.variableDeclaration(name); diff --git a/pkg/analyzer/test/src/dart/element/function_type_test.dart b/pkg/analyzer/test/src/dart/element/function_type_test.dart index bee0bbf2d03f..75c200cbd023 100644 --- a/pkg/analyzer/test/src/dart/element/function_type_test.dart +++ b/pkg/analyzer/test/src/dart/element/function_type_test.dart @@ -38,18 +38,18 @@ class FunctionTypeTest with ElementsTypesMixin { void basicChecks(FunctionType f, {element, - displayName: 'dynamic Function()', + displayName = 'dynamic Function()', returnType, - namedParameterTypes: isEmpty, - normalParameterNames: isEmpty, - normalParameterTypes: isEmpty, - optionalParameterNames: isEmpty, - optionalParameterTypes: isEmpty, - parameters: isEmpty, - typeFormals: isEmpty, - typeArguments: isEmpty, - typeParameters: isEmpty, - name: isNull}) { + namedParameterTypes = isEmpty, + normalParameterNames = isEmpty, + normalParameterTypes = isEmpty, + optionalParameterNames = isEmpty, + optionalParameterTypes = isEmpty, + parameters = isEmpty, + typeFormals = isEmpty, + typeArguments = isEmpty, + typeParameters = isEmpty, + name = isNull}) { // DartType properties expect(f.displayName, displayName, reason: 'displayName'); expect(f.element, element, reason: 'element'); @@ -74,10 +74,10 @@ class FunctionTypeTest with ElementsTypesMixin { GenericTypeAliasElementImpl genericTypeAliasElement( String name, { - List parameters: const [], + List parameters = const [], DartType returnType, - List typeParameters: const [], - List innerTypeParameters: const [], + List typeParameters = const [], + List innerTypeParameters = const [], }) { var aliasElement = GenericTypeAliasElementImpl(name, 0); aliasElement.typeParameters = typeParameters; @@ -515,16 +515,16 @@ class MockFunctionTypedElement implements FunctionTypedElement { final Element enclosingElement; MockFunctionTypedElement( - {this.parameters: const [], + {this.parameters = const [], DartType returnType, - this.typeParameters: const [], - this.enclosingElement: const MockCompilationUnitElement()}) + this.typeParameters = const [], + this.enclosingElement = const MockCompilationUnitElement()}) : returnType = returnType ?? dynamicType; MockFunctionTypedElement.withNullReturn( - {this.parameters: const [], - this.typeParameters: const [], - this.enclosingElement: const MockCompilationUnitElement()}) + {this.parameters = const [], + this.typeParameters = const [], + this.enclosingElement = const MockCompilationUnitElement()}) : returnType = null; noSuchMethod(Invocation invocation) { diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart index f521fdb8626d..f86378bb5e03 100644 --- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart @@ -1775,8 +1775,8 @@ main() { void _assertInvalidInvocation(String search, Element expectedElement, {String expectedMethodNameType, String expectedNameType, - List expectedTypeArguments: const [], - bool dynamicNameType: false}) { + List expectedTypeArguments = const [], + bool dynamicNameType = false}) { var invocation = findNode.methodInvocation(search); if (dynamicNameType) { assertTypeDynamic(invocation.methodName); @@ -1796,7 +1796,7 @@ main() { void _assertUnresolvedMethodInvocation( String search, { - List expectedTypeArguments: const [], + List expectedTypeArguments = const [], }) { // TODO(scheglov) clean up _assertInvalidInvocation( diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart index bc7c30642b23..5e327c2f9bbb 100644 --- a/pkg/analyzer/test/src/dart/resolution/resolution.dart +++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart @@ -250,7 +250,7 @@ mixin ResolutionTest implements ResourceProviderMixin { void assertInstanceCreation(InstanceCreationExpression creation, ClassElement expectedClassElement, String expectedType, {String constructorName, - bool expectedConstructorMember: false, + bool expectedConstructorMember = false, Map expectedSubstitution, PrefixElement expectedPrefix}) { String expectedClassName = expectedClassElement.name; @@ -344,7 +344,7 @@ mixin ResolutionTest implements ResourceProviderMixin { String expectedMethodNameType, String expectedNameType, String expectedType, - List expectedTypeArguments: const [], + List expectedTypeArguments = const [], }) { MethodInvocationImpl invocationImpl = invocation; diff --git a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart index 43bfb89f1adf..ab89396d8523 100644 --- a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart +++ b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart @@ -274,7 +274,7 @@ class FolderBasedDartSdkTest with ResourceProviderMixin { } void _createFile(Folder directory, List segments, - {String content: ''}) { + {String content = ''}) { Folder parent = directory; int last = segments.length - 1; for (int i = 0; i < last; i++) { diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/partial_code_support.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/partial_code_support.dart index 45263e5814e9..540bb14c4813 100644 --- a/pkg/analyzer/test/src/fasta/recovery/partial_code/partial_code_support.dart +++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/partial_code_support.dart @@ -111,7 +111,7 @@ abstract class PartialCodeTest extends AbstractRecoveryTest { List suffixes, {FeatureSet featureSet, String head, - bool includeEof: true, + bool includeEof = true, String tail}) { group(groupName, () { for (TestDescriptor descriptor in descriptors) { @@ -284,7 +284,7 @@ class TestDescriptor { * Initialize a newly created test descriptor. */ TestDescriptor(this.name, this.invalid, this.errorCodes, this.valid, - {this.allFailing: false, + {this.allFailing = false, this.failing, this.expectedErrorsInValidCode, this.adjustValidUnitBeforeComparison}); diff --git a/pkg/analyzer/test/src/services/available_declarations_test.dart b/pkg/analyzer/test/src/services/available_declarations_test.dart index 0a3945be5dcf..6a9996ae5ebd 100644 --- a/pkg/analyzer/test/src/services/available_declarations_test.dart +++ b/pkg/analyzer/test/src/services/available_declarations_test.dart @@ -3168,7 +3168,7 @@ class _ExpectedDeclaration { final String name; final List<_ExpectedDeclaration> children; - _ExpectedDeclaration(this.kind, this.name, {this.children: const []}); + _ExpectedDeclaration(this.kind, this.name, {this.children = const []}); _ExpectedDeclaration.class_(String name, List<_ExpectedDeclaration> children) : this(DeclarationKind.CLASS, name, children: children); diff --git a/pkg/analyzer/test/src/summary/element_text.dart b/pkg/analyzer/test/src/summary/element_text.dart index 24d29bdf4461..edc970a92634 100644 --- a/pkg/analyzer/test/src/summary/element_text.dart +++ b/pkg/analyzer/test/src/summary/element_text.dart @@ -57,15 +57,15 @@ void applyCheckElementTextReplacements() { void checkElementText( LibraryElement library, String expected, { - bool withCodeRanges: false, - bool withConstElements: true, - bool withExportScope: false, - bool withFullyResolvedAst: false, - bool withOffsets: false, - bool withSyntheticAccessors: false, - bool withSyntheticFields: false, - bool withTypes: false, - bool annotateNullability: false, + bool withCodeRanges = false, + bool withConstElements = true, + bool withExportScope = false, + bool withFullyResolvedAst = false, + bool withOffsets = false, + bool withSyntheticAccessors = false, + bool withSyntheticFields = false, + bool withTypes = false, + bool annotateNullability = false, }) { var writer = new _ElementWriter( selfUriStr: '${library.source.uri}', @@ -156,14 +156,14 @@ class _ElementWriter { _ElementWriter({ this.selfUriStr, this.withCodeRanges, - this.withConstElements: true, - this.withExportScope: false, - this.withFullyResolvedAst: false, - this.withOffsets: false, - this.withSyntheticAccessors: false, - this.withSyntheticFields: false, - this.withTypes: false, - this.annotateNullability: false, + this.withConstElements = true, + this.withExportScope = false, + this.withFullyResolvedAst = false, + this.withOffsets = false, + this.withSyntheticAccessors = false, + this.withSyntheticFields = false, + this.withTypes = false, + this.annotateNullability = false, }); bool isDynamicType(DartType type) => type is DynamicTypeImpl; @@ -503,7 +503,7 @@ class _ElementWriter { void writeList(String open, String close, List items, String separator, writeItem(T item), - {bool includeEmpty: false}) { + {bool includeEmpty = false}) { if (!includeEmpty && items.isEmpty) { return; } diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart index d0f08cddacbf..baf80c048b6b 100644 --- a/pkg/analyzer/test/src/summary/resynthesize_common.dart +++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart @@ -11428,7 +11428,7 @@ int j; /// to be applied to a class implementing [ResynthesizeTestStrategy]. mixin ResynthesizeTestHelpers implements ResynthesizeTestStrategy { Future checkLibrary(String text, - {bool allowErrors: false, bool dumpSummaries: false}) async { + {bool allowErrors = false, bool dumpSummaries = false}) async { throw 42; // Source source = addTestSource(text); // SummaryResynthesizer resynthesizer = encodeLibrary(source); diff --git a/pkg/analyzer/test/src/summary2/ast_text_printer_test.dart b/pkg/analyzer/test/src/summary2/ast_text_printer_test.dart index a20b7da10934..447016b0f01d 100644 --- a/pkg/analyzer/test/src/summary2/ast_text_printer_test.dart +++ b/pkg/analyzer/test/src/summary2/ast_text_printer_test.dart @@ -22,7 +22,7 @@ main() { /// /// Whitespaces and newlines are normalized and ignored. void assertParseCodeAndPrintAst(ParseBase base, String code, - {bool mightHasParseErrors: false}) { + {bool mightHasParseErrors = false}) { code = code.trimRight(); code = code.replaceAll('\t', ' '); code = code.replaceAll('\r\n', '\n'); diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart index 653e1ee91802..d9c0486c794e 100644 --- a/pkg/analyzer/test/src/task/options_test.dart +++ b/pkg/analyzer/test/src/task/options_test.dart @@ -509,12 +509,12 @@ linter: ])); } - YamlMap _getOptions(String posixPath, {bool crawlUp: false}) { + YamlMap _getOptions(String posixPath, {bool crawlUp = false}) { Resource resource = pathTranslator.getResource(posixPath); return provider.getOptions(resource, crawlUp: crawlUp); } - AnalysisOptions _getOptionsObject(String posixPath, {bool crawlUp: false}) { + AnalysisOptions _getOptionsObject(String posixPath, {bool crawlUp = false}) { final map = _getOptions(posixPath, crawlUp: crawlUp); final options = new AnalysisOptionsImpl(); applyToAnalysisOptions(options, map); diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart index ce2d4c7945cc..1a7aea7feb02 100644 --- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart +++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart @@ -32,14 +32,14 @@ mixin InferredTypeMixin { /** * Add a new file with the given [name] and [content]. */ - void addFile(String content, {String name: '/main.dart'}); + void addFile(String content, {String name = '/main.dart'}); /** * Add the file, process it (resolve, validate, etc) and return the resolved * unit. */ Future checkFile(String content, - {bool implicitCasts: true, bool implicitDynamic: true}); + {bool implicitCasts = true, bool implicitDynamic = true}); /** * Add the file, process it (resolve, validate, etc) and return the resolved @@ -1701,7 +1701,7 @@ main() { {String declared, String downwards, String upwards, - String expectedInfo: ''}) => + String expectedInfo = ''}) => ''' import 'dart:async'; class MyFuture implements Future { @@ -1732,7 +1732,7 @@ $downwards g3(bool x) async { {String declared, String downwards, String upwards, - String expectedError: ''}) { + String expectedError = ''}) { return ''' import 'dart:async'; class MyFuture implements Future { diff --git a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart index 5068c517e0b3..d756aa2fe510 100644 --- a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart +++ b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart @@ -184,7 +184,8 @@ void _reportFailure( span.message(error.message); } - String formatExpectedError(_ErrorExpectation error, {bool showSource: true}) { + String formatExpectedError(_ErrorExpectation error, + {bool showSource = true}) { int offset = error.offset; var severity = error.severity.displayName; var result = '@$offset $severity:${error.typeName}'; @@ -248,7 +249,7 @@ class AbstractStrongTest with ResourceProviderMixin { /// check(); /// /// For a single file, you may also use [checkFile]. - void addFile(String content, {String name: '/main.dart'}) { + void addFile(String content, {String name = '/main.dart'}) { name = name.replaceFirst(RegExp('^package:'), '/packages/'); newFile(name, content: content); _checkCalled = false; @@ -262,10 +263,10 @@ class AbstractStrongTest with ResourceProviderMixin { /// /// Returns the main resolved library. This can be used for further checks. Future check( - {bool implicitCasts: true, - bool implicitDynamic: true, - bool strictInference: false, - bool strictRawTypes: false}) async { + {bool implicitCasts = true, + bool implicitDynamic = true, + bool strictInference = false, + bool strictRawTypes = false}) async { _checkCalled = true; File mainFile = getFile('/main.dart'); @@ -356,7 +357,7 @@ class AbstractStrongTest with ResourceProviderMixin { /// /// Also returns the resolved compilation unit. Future checkFile(String content, - {bool implicitCasts: true, bool implicitDynamic: true}) async { + {bool implicitCasts = true, bool implicitDynamic = true}) async { addFile(content); return await check( implicitCasts: implicitCasts, diff --git a/pkg/analyzer/test/src/workspace/bazel_test.dart b/pkg/analyzer/test/src/workspace/bazel_test.dart index 5a9a6430418c..d49ca3cdda13 100644 --- a/pkg/analyzer/test/src/workspace/bazel_test.dart +++ b/pkg/analyzer/test/src/workspace/bazel_test.dart @@ -451,7 +451,8 @@ class BazelPackageUriResolverTest with ResourceProviderMixin { 'package:third_party.something/foo.dart'); } - void _addResources(List paths, {String workspacePath: '/workspace'}) { + void _addResources(List paths, + {String workspacePath = '/workspace'}) { for (String path in paths) { if (path.endsWith('/')) { newFolder(path.substring(0, path.length - 1)); @@ -465,7 +466,7 @@ class BazelPackageUriResolverTest with ResourceProviderMixin { } void _assertResolve(String uriStr, String posixPath, - {bool exists: true, bool restore: true}) { + {bool exists = true, bool restore = true}) { Uri uri = Uri.parse(uriStr); Source source = resolver.resolveAbsolute(uri); expect(source, isNotNull); diff --git a/pkg/analyzer/test/src/workspace/package_build_test.dart b/pkg/analyzer/test/src/workspace/package_build_test.dart index 0a25d2cc55a4..784c12aa622e 100644 --- a/pkg/analyzer/test/src/workspace/package_build_test.dart +++ b/pkg/analyzer/test/src/workspace/package_build_test.dart @@ -132,7 +132,7 @@ class PackageBuildPackageUriResolverTest with ResourceProviderMixin { PackageBuildPackageUriResolver resolver; MockUriResolver packageUriResolver; - Uri addPackageSource(String path, String uriStr, {bool create: true}) { + Uri addPackageSource(String path, String uriStr, {bool create = true}) { Uri uri = Uri.parse(uriStr); final File file = create ? newFile(path) @@ -196,7 +196,8 @@ class PackageBuildPackageUriResolverTest with ResourceProviderMixin { exists: false); } - void _addResources(List paths, {String workspacePath: '/workspace'}) { + void _addResources(List paths, + {String workspacePath = '/workspace'}) { for (String path in paths) { if (path.endsWith('/')) { newFolder(path.substring(0, path.length - 1)); @@ -216,7 +217,7 @@ class PackageBuildPackageUriResolverTest with ResourceProviderMixin { } Source _assertResolveUri(Uri uri, String posixPath, - {bool exists: true, bool restore: true}) { + {bool exists = true, bool restore = true}) { Source source = resolver.resolveAbsolute(uri); expect(source, isNotNull); expect(source.fullName, convertPath(posixPath)); diff --git a/pkg/analyzer/test/util/id_testing_helper.dart b/pkg/analyzer/test/util/id_testing_helper.dart index 81f7eaac2f26..c10b70317d3b 100644 --- a/pkg/analyzer/test/util/id_testing_helper.dart +++ b/pkg/analyzer/test/util/id_testing_helper.dart @@ -77,8 +77,8 @@ void onFailure(String message) { Future runTest(TestData testData, DataComputer dataComputer, List testedConfigs, {bool testAfterFailures, - bool forUserLibrariesOnly: true, - Iterable globalIds: const [], + bool forUserLibrariesOnly = true, + Iterable globalIds = const [], void onFailure(String message)}) async { bool hasFailures = false; for (TestConfig config in testedConfigs) { @@ -238,7 +238,7 @@ class AnalyzerCompiledData extends CompiledData { @override void reportError(Uri uri, int offset, String message, - {bool succinct: false}) { + {bool succinct = false}) { print('$offset: $message'); } } diff --git a/pkg/analyzer/tool/summary/mini_ast.dart b/pkg/analyzer/tool/summary/mini_ast.dart index cdbb435366a4..e7eb391f2746 100644 --- a/pkg/analyzer/tool/summary/mini_ast.dart +++ b/pkg/analyzer/tool/summary/mini_ast.dart @@ -193,7 +193,7 @@ class MiniAstBuilder extends StackListener { @override void addProblem(Message message, int charOffset, int length, - {bool wasHandled: false, List context}) { + {bool wasHandled = false, List context}) { internalProblem(message, charOffset, uri); }