diff --git a/pkg/_fe_analyzer_shared/lib/src/base/errors.dart b/pkg/_fe_analyzer_shared/lib/src/base/errors.dart index bcaa62b1517..683754d00bc 100644 --- a/pkg/_fe_analyzer_shared/lib/src/base/errors.dart +++ b/pkg/_fe_analyzer_shared/lib/src/base/errors.dart @@ -48,7 +48,7 @@ abstract class ErrorCode { const ErrorCode({ String? correctionMessage, this.hasPublishedDocs = false, - this.isUnresolvedIdentifier: false, + this.isUnresolvedIdentifier = false, required this.name, required String problemMessage, required this.uniqueName, diff --git a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart index 118c57159f1..830a3798d38 100644 --- a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart +++ b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart @@ -1320,7 +1320,7 @@ class FlowAnalysisDebug(String description, T callback(), - {bool isQuery: false, bool? isPure}) { + {bool isQuery = false, bool? isPure}) { isPure ??= isQuery; print(description); T result; diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart index 202dad861e2..9c283e103e0 100644 --- a/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart +++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes.dart @@ -31,7 +31,7 @@ class Code { final Severity severity; const Code(this.name, - {this.index: -1, this.analyzerCodes, this.severity: Severity.error}); + {this.index = -1, this.analyzerCodes, this.severity = Severity.error}); String toString() => name; } diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart index d539c6c17b4..00689b69b70 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart @@ -305,14 +305,14 @@ abstract class IdentifierContext { final Template<_MessageWithArgument> recoveryTemplate; const IdentifierContext(this._name, - {this.inDeclaration: false, - this.inLibraryOrPartOfDeclaration: false, - this.inSymbol: false, - this.isContinuation: false, - this.isScopeReference: false, - this.isBuiltInIdentifierAllowed: true, + {this.inDeclaration = false, + this.inLibraryOrPartOfDeclaration = false, + this.inSymbol = false, + this.isContinuation = false, + this.isScopeReference = false, + this.isBuiltInIdentifierAllowed = true, bool? allowedInConstantExpression, - this.recoveryTemplate: templateExpectedIdentifier}) + this.recoveryTemplate = templateExpectedIdentifier}) : this.allowedInConstantExpression = // Generally, declarations are legal in constant expressions. A // continuation doesn't affect constant expressions: if what it's diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart index ade0f51373e..bd6c0907b4e 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart @@ -58,7 +58,7 @@ class ErrorCollectingListener extends Listener { } List parse(Token tokens, - {bool useImplicitCreationExpression: true}) { + {bool useImplicitCreationExpression = true}) { ErrorCollectingListener listener = new ErrorCollectingListener(); Parser parser = new Parser(listener, useImplicitCreationExpression: useImplicitCreationExpression); diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart index 5465c811d12..93449e3a92e 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart @@ -317,7 +317,7 @@ class Parser { // implicit create expression without the special casing. final bool useImplicitCreationExpression; - Parser(this.listener, {this.useImplicitCreationExpression: true}) + Parser(this.listener, {this.useImplicitCreationExpression = true}) : assert(listener != null); // ignore:unnecessary_null_comparison bool get inGenerator { diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart index f9c5bfc0191..36da5a16269 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart @@ -523,7 +523,7 @@ abstract class StackListener extends Listener { } void addProblem(Message message, int charOffset, int length, - {bool wasHandled: false, List context}); + {bool wasHandled = false, List context}); } abstract class Stack { diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/io.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/io.dart index 066fe881cd5..5a9a9637d26 100644 --- a/pkg/_fe_analyzer_shared/lib/src/scanner/io.dart +++ b/pkg/_fe_analyzer_shared/lib/src/scanner/io.dart @@ -23,7 +23,7 @@ List readBytesFromFileSync(Uri uri) { } Future> readBytesFromFile(Uri uri, - {bool ensureZeroTermination: true}) async { + {bool ensureZeroTermination = true}) async { RandomAccessFile file = await new File.fromUri(uri).open(); Uint8List list; try { diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/scanner.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/scanner.dart index b9b7cbcfb10..62c5159d517 100644 --- a/pkg/_fe_analyzer_shared/lib/src/scanner/scanner.dart +++ b/pkg/_fe_analyzer_shared/lib/src/scanner/scanner.dart @@ -68,7 +68,7 @@ class ScannerResult { /// Scan/tokenize the given UTF8 [bytes]. ScannerResult scan(List bytes, {ScannerConfiguration? configuration, - bool includeComments: false, + bool includeComments = false, LanguageVersionChanged? languageVersionChanged}) { if (bytes.last != 0) { throw new ArgumentError("[bytes]: the last byte must be 0."); @@ -83,7 +83,7 @@ ScannerResult scan(List bytes, /// Scan/tokenize the given [source]. ScannerResult scanString(String source, {ScannerConfiguration? configuration, - bool includeComments: false, + bool includeComments = false, LanguageVersionChanged? languageVersionChanged}) { // ignore: unnecessary_null_comparison assert(source != null, 'source must not be null'); diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/scanner_main.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/scanner_main.dart index 18c7c7e6f74..2d844f7e0bd 100644 --- a/pkg/_fe_analyzer_shared/lib/src/scanner/scanner_main.dart +++ b/pkg/_fe_analyzer_shared/lib/src/scanner/scanner_main.dart @@ -8,7 +8,8 @@ import 'io.dart' show readBytesFromFileSync; import 'scanner.dart' show ErrorToken, Token, scan; -scanAll(Map> files, {bool verbose: false, bool verify: false}) { +scanAll(Map> files, + {bool verbose = false, bool verify = false}) { Stopwatch sw = new Stopwatch()..start(); int byteCount = 0; files.forEach((Uri uri, List bytes) { diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/string_scanner.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/string_scanner.dart index 96f953f1d47..c485d1bc3aa 100644 --- a/pkg/_fe_analyzer_shared/lib/src/scanner/string_scanner.dart +++ b/pkg/_fe_analyzer_shared/lib/src/scanner/string_scanner.dart @@ -39,7 +39,7 @@ class StringScanner extends AbstractScanner { StringScanner(String string, {ScannerConfiguration? configuration, - bool includeComments: false, + bool includeComments = false, LanguageVersionChanged? languageVersionChanged}) : string = ensureZeroTermination(string), super(configuration, includeComments, languageVersionChanged); diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart index 0bbb2546695..bc3fe895337 100644 --- a/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart +++ b/pkg/_fe_analyzer_shared/lib/src/scanner/token.dart @@ -415,9 +415,9 @@ class Keyword extends TokenType { * Initialize a newly created keyword. */ const Keyword(int index, String lexeme, String name, this.keywordStyle, - {bool isModifier: false, - bool isTopLevelKeyword: false, - int precedence: NO_PRECEDENCE}) + {bool isModifier = false, + bool isTopLevelKeyword = false, + int precedence = NO_PRECEDENCE}) : super(index, lexeme, name, precedence, KEYWORD_TOKEN, isModifier: isModifier, isTopLevelKeyword: isTopLevelKeyword); @@ -1684,12 +1684,12 @@ class TokenType { const TokenType( this.index, this.lexeme, this.name, this.precedence, this.kind, {this.binaryOperatorOfCompoundAssignment, - this.isBinaryOperator: false, - this.isModifier: false, - this.isOperator: false, - this.isTopLevelKeyword: false, - this.isUserDefinableOperator: false, - String? stringValue: 'unspecified'}) + this.isBinaryOperator = false, + this.isModifier = false, + this.isOperator = false, + this.isTopLevelKeyword = false, + this.isUserDefinableOperator = false, + String? stringValue = 'unspecified'}) : this.stringValue = stringValue == 'unspecified' ? lexeme : stringValue; /** diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart index 4c869ba3c2a..8f9b505719a 100644 --- a/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart +++ b/pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart @@ -40,7 +40,7 @@ class StringTokenImpl extends SimpleToken implements StringToken { * is canonicalized before the token is created. */ StringTokenImpl.fromString(TokenType type, String value, int charOffset, - {bool canonicalize: false, CommentToken? precedingComments}) + {bool canonicalize = false, CommentToken? precedingComments}) : valueOrLazySubstring = canonicalize ? canonicalizedString(value) : value, super(type, charOffset, precedingComments); @@ -51,7 +51,7 @@ class StringTokenImpl extends SimpleToken implements StringToken { */ StringTokenImpl.fromSubstring( TokenType type, String data, int start, int end, int charOffset, - {bool canonicalize: false, CommentToken? precedingComments}) + {bool canonicalize = false, CommentToken? precedingComments}) : super(type, charOffset, precedingComments) { int length = end - start; if (length <= LAZY_THRESHOLD) { @@ -166,7 +166,7 @@ class LanguageVersionTokenImpl extends CommentTokenImpl LanguageVersionTokenImpl.fromSubstring( String string, int start, int end, int tokenStart, this.major, this.minor, - {bool canonicalize: false}) + {bool canonicalize = false}) : super.fromSubstring( TokenType.SINGLE_LINE_COMMENT, string, start, end, tokenStart, canonicalize: canonicalize); diff --git a/pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart b/pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart index a0fd026bfa6..c734c8861be 100644 --- a/pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart +++ b/pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart @@ -89,7 +89,7 @@ class Utf8BytesScanner extends AbstractScanner { */ Utf8BytesScanner(this.bytes, {ScannerConfiguration? configuration, - bool includeComments: false, + bool includeComments = false, LanguageVersionChanged? languageVersionChanged}) : super(configuration, includeComments, languageVersionChanged, numberOfBytesHint: bytes.length) { diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/features.dart b/pkg/_fe_analyzer_shared/lib/src/testing/features.dart index 113d1d86958..34f508b89c0 100644 --- a/pkg/_fe_analyzer_shared/lib/src/testing/features.dart +++ b/pkg/_fe_analyzer_shared/lib/src/testing/features.dart @@ -30,7 +30,7 @@ class Features { /// Mark the feature [key] as existing. If [value] is provided, the feature /// [key] is set to have this value. - void add(String key, {var value: ''}) { + void add(String key, {var value = ''}) { _features[key] = value.toString(); } diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/id.dart b/pkg/_fe_analyzer_shared/lib/src/testing/id.dart index e1596e1f0ae..8d9db1afc7e 100644 --- a/pkg/_fe_analyzer_shared/lib/src/testing/id.dart +++ b/pkg/_fe_analyzer_shared/lib/src/testing/id.dart @@ -125,8 +125,8 @@ class IdValue { static const String errorPrefix = "error: "; static IdValue decode(Uri sourceUri, Annotation annotation, String text, - {bool preserveWhitespaceInAnnotations: false, - bool preserveInfixWhitespace: false}) { + {bool preserveWhitespaceInAnnotations = false, + bool preserveInfixWhitespace = false}) { int offset = annotation.offset; Id id; String expected; @@ -203,7 +203,7 @@ class MemberId implements Id { @override final bool isGlobal; - factory MemberId(String text, {bool isGlobal: false}) { + factory MemberId(String text, {bool isGlobal = false}) { int dotPos = text.indexOf('.'); if (dotPos != -1) { return new MemberId.internal(text.substring(dotPos + 1), @@ -213,7 +213,7 @@ class MemberId implements Id { } } - MemberId.internal(this.memberName, {this.className, this.isGlobal: false}); + MemberId.internal(this.memberName, {this.className, this.isGlobal = false}); @override int get hashCode => className.hashCode * 13 + memberName.hashCode * 17; @@ -243,7 +243,7 @@ class ClassId implements Id { @override final bool isGlobal; - ClassId(this.className, {this.isGlobal: false}); + ClassId(this.className, {this.isGlobal = false}); @override int get hashCode => className.hashCode * 13; diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart b/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart index a1bbadbcd5b..1be8ff91321 100644 --- a/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart +++ b/pkg/_fe_analyzer_shared/lib/src/testing/id_generation.dart @@ -13,7 +13,7 @@ Map> computeAnnotationsPerUri( Map>>> actualData, DataInterpreter dataInterpreter, {Annotation? Function(Annotation? expected, Annotation? actual)? createDiff, - bool forceUpdate: false}) { + bool forceUpdate = false}) { Set uriSet = {}; Set actualMarkers = actualData.keys.toSet(); Map>> idValuePerUri = {}; @@ -69,8 +69,8 @@ Map> computeAnnotationsPerUri( if (code != null) { // Annotations are not computed from synthesized code. result[uri] = _computeAnnotations(code, expectedMaps.keys, actualMarkers, - idValuePerId, actualDataPerId, dataInterpreter, - sortMarkers: false, createDiff: createDiff, forceUpdate: forceUpdate); + idValuePerId, actualDataPerId, dataInterpreter, + sortMarkers: false, createDiff: createDiff, forceUpdate: forceUpdate); } } return result; @@ -83,11 +83,11 @@ List _computeAnnotations( Map> idValuePerId, Map>> actualDataPerId, DataInterpreter dataInterpreter, - {String defaultPrefix: '/*', - String defaultSuffix: '*/', - bool sortMarkers: true, + {String defaultPrefix = '/*', + String defaultSuffix = '*/', + bool sortMarkers = true, Annotation? Function(Annotation? expected, Annotation? actual)? createDiff, - bool forceUpdate: false}) { + bool forceUpdate = false}) { // ignore: unnecessary_null_comparison assert(annotatedCode != null); @@ -156,7 +156,9 @@ List _computeAnnotations( suffix); } - Set idSet = {}..addAll(idValuePerId.keys)..addAll(actualDataPerId.keys); + Set idSet = {} + ..addAll(idValuePerId.keys) + ..addAll(actualDataPerId.keys); List result = []; for (Id id in idSet) { Map idValuePerMarker = idValuePerId[id] ?? {}; diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart b/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart index 04fe99d02e5..e34d83059fb 100644 --- a/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart +++ b/pkg/_fe_analyzer_shared/lib/src/testing/id_testing.dart @@ -218,8 +218,8 @@ class MemberAnnotations { void computeExpectedMap(Uri sourceUri, String filename, AnnotatedCode code, Map> maps, {required void onFailure(String message), - bool preserveWhitespaceInAnnotations: false, - bool preserveInfixWhitespaceInAnnotations: false}) { + bool preserveWhitespaceInAnnotations = false, + bool preserveInfixWhitespaceInAnnotations = false}) { List mapKeys = maps.keys.toList(); Map split = splitByPrefixes(code, mapKeys); @@ -263,8 +263,8 @@ TestData computeTestData(FileSystemEntity testFile, {required Iterable supportedMarkers, required Uri createTestUri(Uri uri, String fileName), required void onFailure(String message), - bool preserveWhitespaceInAnnotations: false, - bool preserveInfixWhitespaceInAnnotations: false}) { + bool preserveWhitespaceInAnnotations = false, + bool preserveInfixWhitespaceInAnnotations = false}) { Uri? entryPoint; String testName; @@ -406,7 +406,7 @@ abstract class CompiledData { Map> computeDiffAnnotationsAgainst( Map> thisMap, Map> otherMap, Uri uri, - {bool includeMatches: false}) { + {bool includeMatches = false}) { Map> annotations = >{}; thisMap.forEach((Id id, ActualData thisData) { ActualData? otherData = otherMap[id]; @@ -436,7 +436,8 @@ abstract class CompiledData { int getOffsetFromId(Id id, Uri uri); - void reportError(Uri uri, int offset, String message, {bool succinct: false}); + void reportError(Uri uri, int offset, String message, + {bool succinct = false}); } /// Interface used for interpreting annotations. @@ -513,8 +514,8 @@ Future> checkCode( CompiledData compiledData, DataInterpreter dataInterpreter, {bool filterActualData(IdValue? expected, ActualData actualData)?, - bool fatalErrors: true, - bool succinct: false, + bool fatalErrors = true, + bool succinct = false, required void onFailure(String message)}) async { String testName = testData.name; Map code = testData.code; @@ -703,7 +704,7 @@ class MarkerOptions { MarkerOptions.internal(this.markers); factory MarkerOptions.fromDataDir(Directory dataDir, - {bool shouldFindScript: true}) { + {bool shouldFindScript = true}) { File file = new File.fromUri(dataDir.uri.resolve('marker.options')); File script = new File.fromUri(Platform.script); if (!file.existsSync()) { @@ -810,17 +811,17 @@ const List