diff --git a/pkg/analysis_server/analysis_options.yaml b/pkg/analysis_server/analysis_options.yaml index a56350fc35b..87e88571ef3 100644 --- a/pkg/analysis_server/analysis_options.yaml +++ b/pkg/analysis_server/analysis_options.yaml @@ -21,6 +21,8 @@ analyzer: linter: rules: + - unnecessary_type_name_in_constructor + - unnecessary_const_in_enum_constructor - avoid_bool_literals_in_conditional_expressions - avoid_redundant_argument_values - deprecated_member_use_from_same_package diff --git a/pkg/analysis_server/benchmark/benchmarks.dart b/pkg/analysis_server/benchmark/benchmarks.dart index a21d18c5109..61ef7a16058 100644 --- a/pkg/analysis_server/benchmark/benchmarks.dart +++ b/pkg/analysis_server/benchmark/benchmarks.dart @@ -70,12 +70,7 @@ abstract class Benchmark { /// One of 'memory', 'cpu', or 'group'. final String kind; - Benchmark( - this.id, - this.description, { - this.enabled = true, - required this.kind, - }); + new(this.id, this.description, {this.enabled = true, required this.kind}); int get maxIterations => 0; @@ -108,7 +103,7 @@ class BenchMarkResult { final int value; - BenchMarkResult(this.kindName, this.value); + new(this.kindName, this.value); BenchMarkResult combine(BenchMarkResult other) { return BenchMarkResult(kindName, math.min(value, other.value)); @@ -125,7 +120,7 @@ class CompoundBenchMarkResult extends BenchMarkResult { Map results = {}; - CompoundBenchMarkResult(this.name) : super('compound', 0); + new(this.name) : super('compound', 0); void add(String name, BenchMarkResult result) { results[name] = result; @@ -171,7 +166,7 @@ abstract class FlutterBenchmark { class ListCommand extends Command { final List benchmarks; - ListCommand(this.benchmarks) { + new(this.benchmarks) { argParser.addFlag( 'machine', negatable: false, @@ -206,7 +201,7 @@ class ListCommand extends Command { class RunCommand extends Command { final List benchmarks; - RunCommand(this.benchmarks) { + new(this.benchmarks) { argParser.addOption( 'dart-sdk', help: 'The absolute normalized path of the Dart SDK.', diff --git a/pkg/analysis_server/benchmark/integration/driver.dart b/pkg/analysis_server/benchmark/integration/driver.dart index a3af7c86c35..cefc58f3ad8 100644 --- a/pkg/analysis_server/benchmark/integration/driver.dart +++ b/pkg/analysis_server/benchmark/integration/driver.dart @@ -38,7 +38,7 @@ class Driver extends IntegrationTest { /// The [Completer] for [runComplete]. final Completer _runCompleter = Completer(); - Driver({this.diagnosticPort}); + new({this.diagnosticPort}); /// Return a [Future] that completes with the [Results] of running /// the analysis server once all operations have been performed. @@ -126,7 +126,7 @@ class Measurement { int errorCount = 0; int unexpectedResultCount = 0; - Measurement(this.tag, this.notification); + new(this.tag, this.notification); int get count => elapsedTimes.length; diff --git a/pkg/analysis_server/benchmark/integration/input_converter.dart b/pkg/analysis_server/benchmark/integration/input_converter.dart index 091c7296b88..33cf1e0caf4 100644 --- a/pkg/analysis_server/benchmark/integration/input_converter.dart +++ b/pkg/analysis_server/benchmark/integration/input_converter.dart @@ -54,7 +54,7 @@ abstract class CommonInputConverter extends Converter { /// during performance measurement. final String tmpSrcDirPath; - CommonInputConverter(this.tmpSrcDirPath, this.srcPathMap); + new(this.tmpSrcDirPath, this.srcPathMap); Map asMap(dynamic value) => value as Map; @@ -268,7 +268,7 @@ class InputConverter extends Converter { /// or `false` if an exception has occurred. bool _active = true; - InputConverter(this.tmpSrcDirPath, this.srcPathMap); + new(this.tmpSrcDirPath, this.srcPathMap); @override Operation? convert(String line) { @@ -340,7 +340,7 @@ class PathMapEntry { final String oldSrcPrefix; final String newSrcPrefix; - PathMapEntry(this.oldSrcPrefix, this.newSrcPrefix); + new(this.oldSrcPrefix, this.newSrcPrefix); String translate(String original) { return original.startsWith(oldSrcPrefix) @@ -353,7 +353,7 @@ class _InputSink implements ChunkedConversionSink { final Converter converter; final Sink outSink; - _InputSink(this.converter, this.outSink); + new(this.converter, this.outSink); @override void add(String line) { diff --git a/pkg/analysis_server/benchmark/integration/instrumentation_input_converter.dart b/pkg/analysis_server/benchmark/integration/instrumentation_input_converter.dart index fdaa134169d..ceac8c176fc 100644 --- a/pkg/analysis_server/benchmark/integration/instrumentation_input_converter.dart +++ b/pkg/analysis_server/benchmark/integration/instrumentation_input_converter.dart @@ -23,7 +23,7 @@ class InstrumentationInputConverter extends CommonInputConverter { /// or `null` if not converting a "Read" entry. StringBuffer? readBuffer; - InstrumentationInputConverter(super.tmpSrcDirPath, super.srcPathMap); + new(super.tmpSrcDirPath, super.srcPathMap); @override Operation? convert(String line) { diff --git a/pkg/analysis_server/benchmark/integration/log_file_input_converter.dart b/pkg/analysis_server/benchmark/integration/log_file_input_converter.dart index f5454b6fd05..acae3fdd039 100644 --- a/pkg/analysis_server/benchmark/integration/log_file_input_converter.dart +++ b/pkg/analysis_server/benchmark/integration/log_file_input_converter.dart @@ -20,7 +20,7 @@ class LogFileInputConverter extends CommonInputConverter { static final _nine = '9'.codeUnitAt(0); static final _zero = '0'.codeUnitAt(0); - LogFileInputConverter(super.tmpSrcDirPath, super.srcPathMap); + new(super.tmpSrcDirPath, super.srcPathMap); @override Operation? convert(String line) { diff --git a/pkg/analysis_server/benchmark/integration/operation.dart b/pkg/analysis_server/benchmark/integration/operation.dart index 0a120d4cc4d..9cf4de0892a 100644 --- a/pkg/analysis_server/benchmark/integration/operation.dart +++ b/pkg/analysis_server/benchmark/integration/operation.dart @@ -20,7 +20,7 @@ class RequestOperation extends Operation { final CommonInputConverter converter; final Map json; - RequestOperation(this.converter, this.json); + new(this.converter, this.json); @override Future? perform(Driver driver) { @@ -71,7 +71,7 @@ class ResponseOperation extends Operation { final Completer completer = Completer(); late Driver driver; - ResponseOperation(this.converter, this.requestJson, this.responseJson) { + new(this.converter, this.requestJson, this.responseJson) { completer.future.then(_processResult).timeout(responseTimeout); } diff --git a/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart b/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart index 7adf0839c23..c0754f67395 100644 --- a/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart +++ b/pkg/analysis_server/benchmark/perf/benchmarks_impl.dart @@ -18,7 +18,7 @@ import 'memory_tests.dart'; class AnalysisBenchmark extends Benchmark { final AbstractBenchmarkTest Function() testConstructor; - AnalysisBenchmark(ServerBenchmark benchmarkTest) + new(ServerBenchmark benchmarkTest) : testConstructor = benchmarkTest.testConstructor, super( benchmarkTest.id, @@ -162,7 +162,7 @@ class AnalysisBenchmark extends Benchmark { class ColdAnalysisBenchmark extends Benchmark { final AbstractBenchmarkTest Function() testConstructor; - ColdAnalysisBenchmark(ServerBenchmark benchmarkTest) + new(ServerBenchmark benchmarkTest) : testConstructor = benchmarkTest.testConstructor, super( '${benchmarkTest.id}-cold', @@ -222,5 +222,5 @@ class ServerBenchmark { final String name; final AbstractBenchmarkTest Function() testConstructor; - ServerBenchmark(this.id, this.name, this.testConstructor); + new(this.id, this.name, this.testConstructor); } diff --git a/pkg/analysis_server/benchmark/perf/dart_analyze.dart b/pkg/analysis_server/benchmark/perf/dart_analyze.dart index 3d20f0cb088..444fed6222c 100644 --- a/pkg/analysis_server/benchmark/perf/dart_analyze.dart +++ b/pkg/analysis_server/benchmark/perf/dart_analyze.dart @@ -11,7 +11,7 @@ import '../benchmarks.dart'; import 'utils.dart'; abstract class AbstractCmdLineBenchmark extends Benchmark { - AbstractCmdLineBenchmark(super.id, super.description, {required super.kind}); + new(super.id, super.description, {required super.kind}); @override int get maxIterations => 3; @@ -112,7 +112,7 @@ abstract class AbstractCmdLineBenchmark extends Benchmark { } class CmdLineOneProjectBenchmark extends AbstractCmdLineBenchmark { - CmdLineOneProjectBenchmark() + new() : super( 'dart-analyze-one-project', 'Run dart analyze on one project with and without a cache', @@ -128,7 +128,7 @@ class CmdLineOneProjectBenchmark extends AbstractCmdLineBenchmark { } class CmdLineSeveralProjectsBenchmark extends AbstractCmdLineBenchmark { - CmdLineSeveralProjectsBenchmark() + new() : super( 'dart-analyze-several-projects', 'Run dart analyze on several projects with and without a cache', @@ -155,7 +155,7 @@ class CmdLineSeveralProjectsBenchmark extends AbstractCmdLineBenchmark { class CmdLineSmallFileBenchmark extends AbstractCmdLineBenchmark { Directory? _tempDir; - CmdLineSmallFileBenchmark() + new() : super( 'dart-analyze-small-file', 'Run dart analyze on a small file with and without a cache', diff --git a/pkg/analysis_server/benchmark/perf/flutter_analyze_benchmark.dart b/pkg/analysis_server/benchmark/perf/flutter_analyze_benchmark.dart index e5987a6813d..30843899da5 100644 --- a/pkg/analysis_server/benchmark/perf/flutter_analyze_benchmark.dart +++ b/pkg/analysis_server/benchmark/perf/flutter_analyze_benchmark.dart @@ -10,7 +10,7 @@ import 'utils.dart'; class FlutterAnalyzeBenchmark extends Benchmark implements FlutterBenchmark { late final String flutterRepositoryPath; - FlutterAnalyzeBenchmark() + new() : super( 'analysis-flutter-analyze', 'Clone the flutter/flutter repo and run ' diff --git a/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart b/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart index 85d4f6bcbd6..a9f357275c7 100644 --- a/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart +++ b/pkg/analysis_server/benchmark/perf/flutter_completion_benchmark.dart @@ -25,7 +25,7 @@ class FlutterCompletionBenchmark extends Benchmark implements FlutterBenchmark { late final String flutterRepositoryPath; - FlutterCompletionBenchmark(String protocolName, this.testConstructor) + new(String protocolName, this.testConstructor) : super( '$protocolName-flutter', 'Completion benchmarks with Flutter.', diff --git a/pkg/analysis_server/benchmark/perf/memory_tests.dart b/pkg/analysis_server/benchmark/perf/memory_tests.dart index ad0fa1d9024..5d122583993 100644 --- a/pkg/analysis_server/benchmark/perf/memory_tests.dart +++ b/pkg/analysis_server/benchmark/perf/memory_tests.dart @@ -276,7 +276,7 @@ class ServiceProtocol { int _id = 0; final Map>> _completers = {}; - ServiceProtocol._(this.socket) { + new _(this.socket) { socket.listen(_handleMessage); } diff --git a/pkg/analysis_server/integration_test/lsp_server/integration_tests.dart b/pkg/analysis_server/integration_test/lsp_server/integration_tests.dart index 4a2f0fd08dd..cefd12572b7 100644 --- a/pkg/analysis_server/integration_test/lsp_server/integration_tests.dart +++ b/pkg/analysis_server/integration_test/lsp_server/integration_tests.dart @@ -185,7 +185,7 @@ class LspServerClient { /// these whole line is used for this completer. final Completer _devToolsLineCompleter = Completer(); - LspServerClient(this.instrumentationService); + new(this.instrumentationService); /// Completes with the DevTools URI line, maybe never. Future get devToolsLine => _devToolsLineCompleter.future; diff --git a/pkg/analysis_server/integration_test/search/get_type_hierarchy_test.dart b/pkg/analysis_server/integration_test/search/get_type_hierarchy_test.dart index d1838b34489..de5e0b23cb7 100644 --- a/pkg/analysis_server/integration_test/search/get_type_hierarchy_test.dart +++ b/pkg/analysis_server/integration_test/search/get_type_hierarchy_test.dart @@ -262,7 +262,7 @@ class HierarchyResults { /// Create a [HierarchyResults] object based on the result from a /// getTypeHierarchy request. - HierarchyResults(this.items) : pivot = items[0] { + new(this.items) : pivot = items[0] { for (var i = 0; i < items.length; i++) { nameToIndex[items[i].classElement.name] = i; } diff --git a/pkg/analysis_server/integration_test/support/dart_tooling_daemon.dart b/pkg/analysis_server/integration_test/support/dart_tooling_daemon.dart index 080fc39c794..26223f43efb 100644 --- a/pkg/analysis_server/integration_test/support/dart_tooling_daemon.dart +++ b/pkg/analysis_server/integration_test/support/dart_tooling_daemon.dart @@ -15,7 +15,7 @@ class DtdProcess { /// A completer for the DTD URI that is printed to stdout by the process. final Completer _dtdUriCompleter = Completer(); - DtdProcess._(this._proc) { + new _(this._proc) { // Read output for the URI. _proc.stdout.transform(utf8.decoder).transform(LineSplitter()).listen(( data, diff --git a/pkg/analysis_server/integration_test/support/integration_tests.dart b/pkg/analysis_server/integration_test/support/integration_tests.dart index b65fc11de5c..984ae6d86fc 100644 --- a/pkg/analysis_server/integration_test/support/integration_tests.dart +++ b/pkg/analysis_server/integration_test/support/integration_tests.dart @@ -390,7 +390,7 @@ class LazyMatcher implements Matcher { /// Otherwise null. Matcher? _wrappedMatcher; - LazyMatcher(this._creator); + new(this._creator); /// Create the wrapped matcher object, if it hasn't been created already. Matcher get _matcher { @@ -431,7 +431,7 @@ class MatchesEnum extends Matcher { /// The set of enum values that are allowed. final List allowedValues; - const MatchesEnum(this.description, this.allowedValues); + const new(this.description, this.allowedValues); @override Description describe(Description description) => @@ -457,11 +457,7 @@ class MatchesJsonObject extends _RecursiveMatcher { /// their expected types. final Map? optionalFields; - const MatchesJsonObject( - this.description, - this.requiredFields, { - this.optionalFields, - }); + const new(this.description, this.requiredFields, {this.optionalFields}); @override Description describe(Description description) => @@ -834,7 +830,7 @@ class Server { class ServerErrorMessage { final Map message; - ServerErrorMessage(this.message); + new(this.message); dynamic get error => message['error']; @@ -851,7 +847,7 @@ class _ListOf extends Matcher { /// Iterable matcher which we use to test the contents of the list. final Matcher iterableMatcher; - _ListOf(this.elementMatcher) : iterableMatcher = everyElement(elementMatcher); + new(this.elementMatcher) : iterableMatcher = everyElement(elementMatcher); @override Description describe(Description description) => @@ -899,7 +895,7 @@ class _MapOf extends _RecursiveMatcher { /// Matcher which every value in the map must satisfy. final Matcher valueMatcher; - _MapOf(this.keyMatcher, this.valueMatcher); + new(this.keyMatcher, this.valueMatcher); @override Description describe(Description description) => description @@ -939,7 +935,7 @@ class _OneOf extends Matcher { /// Matchers for the individual choices. final List choiceMatchers; - _OneOf(this.choiceMatchers); + new(this.choiceMatchers); @override Description describe(Description description) { @@ -974,7 +970,7 @@ class _OneOf extends Matcher { /// Base class for matchers that operate by recursing through the contents of /// an object. abstract class _RecursiveMatcher extends Matcher { - const _RecursiveMatcher(); + const new(); /// Check the type of a substructure whose value is [item], using [matcher]. /// If it doesn't match, record a closure in [mismatches] which can describe diff --git a/pkg/analysis_server/lib/protocol/protocol.dart b/pkg/analysis_server/lib/protocol/protocol.dart index 905000c39fd..61bbd1a7d05 100644 --- a/pkg/analysis_server/lib/protocol/protocol.dart +++ b/pkg/analysis_server/lib/protocol/protocol.dart @@ -34,10 +34,10 @@ class Notification { /// Initialize a newly created [Notification] to have the given [event] name. /// If [params] is provided, it will be used as the params; otherwise no /// params will be used. - Notification(this.event, [this.params]); + new(this.event, [this.params]); /// Initialize a newly created instance based on the given JSON data. - factory Notification.fromJson(Map json) { + factory fromJson(Map json) { return Notification( json[Notification.eventAttributeName] as String, json[Notification.paramsAttributeName] as Map?, @@ -86,7 +86,7 @@ class Request extends RequestOrResponse { /// Initialize a newly created [Request] to have the given [id] and [method] /// name. If [params] is supplied, it is used as the "params" map for the /// request. Otherwise an empty "params" map is allocated. - Request( + new( this.id, this.method, [ Map? params, @@ -221,7 +221,7 @@ class RequestFailure implements Exception { final Response response; /// Initialize a newly created exception to return the given response. - RequestFailure(this.response); + new(this.response); } /// An object that can handle requests and produce responses for them. @@ -274,11 +274,11 @@ class Response extends RequestOrResponse { /// with the given [id]. If [result] is provided, it will be used as the /// result; otherwise an empty result will be used. If an [error] is provided /// then the response will represent an error condition. - Response(this.id, {this.result, this.error}); + new(this.id, {this.result, this.error}); /// Initialize a newly created instance to represent the CONTENT_MODIFIED /// error condition. - Response.contentModified(Request request) + new contentModified(Request request) : this( request.id, error: RequestError( @@ -288,7 +288,7 @@ class Response extends RequestOrResponse { ); /// Create and return the `DEBUG_PORT_COULD_NOT_BE_OPENED` error response. - Response.debugPortCouldNotBeOpened(Request request, Object? error) + new debugPortCouldNotBeOpened(Request request, Object? error) : this( request.id, error: RequestError( @@ -299,7 +299,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the FILE_NOT_ANALYZED /// error condition. - Response.fileNotAnalyzed(Request request, String file) + new fileNotAnalyzed(Request request, String file) : this( request.id, error: RequestError( @@ -310,7 +310,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the FORMAT_INVALID_FILE /// error condition. - Response.formatInvalidFile(Request request) + new formatInvalidFile(Request request) : this( request.id, error: RequestError( @@ -321,7 +321,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the FORMAT_WITH_ERROR /// error condition. - Response.formatWithErrors(Request request) + new formatWithErrors(Request request) : this( request.id, error: RequestError( @@ -332,7 +332,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_ERRORS_INVALID_FILE error condition. - Response.getErrorsInvalidFile(Request request) + new getErrorsInvalidFile(Request request) : this( request.id, error: RequestError( @@ -343,7 +343,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_FIXES_INVALID_FILE error condition. - Response.getFixesInvalidFile(Request request) + new getFixesInvalidFile(Request request) : this( request.id, error: RequestError( @@ -354,7 +354,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_IMPORTED_ELEMENTS_INVALID_FILE error condition. - Response.getImportedElementsInvalidFile(Request request) + new getImportedElementsInvalidFile(Request request) : this( request.id, error: RequestError( @@ -365,7 +365,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_NAVIGATION_INVALID_FILE error condition. - Response.getNavigationInvalidFile(Request request) + new getNavigationInvalidFile(Request request) : this( request.id, error: RequestError( @@ -376,7 +376,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_REACHABLE_SOURCES_INVALID_FILE error condition. - Response.getReachableSourcesInvalidFile(Request request) + new getReachableSourcesInvalidFile(Request request) : this( request.id, error: RequestError( @@ -387,7 +387,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_SIGNATURE_INVALID_FILE error condition. - Response.getSignatureInvalidFile(Request request) + new getSignatureInvalidFile(Request request) : this( request.id, error: RequestError( @@ -398,7 +398,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_SIGNATURE_INVALID_OFFSET error condition. - Response.getSignatureInvalidOffset(Request request) + new getSignatureInvalidOffset(Request request) : this( request.id, error: RequestError( @@ -409,7 +409,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// GET_SIGNATURE_UNKNOWN_FUNCTION error condition. - Response.getSignatureUnknownFunction(Request request) + new getSignatureUnknownFunction(Request request) : this( request.id, error: RequestError( @@ -420,7 +420,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// IMPORT_ELEMENTS_INVALID_FILE error condition. - Response.importElementsInvalidFile(Request request) + new importElementsInvalidFile(Request request) : this( request.id, error: RequestError( @@ -432,7 +432,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent an error condition caused /// by an analysis.reanalyze [request] that specifies an analysis root that is /// not in the current list of analysis roots. - Response.invalidAnalysisRoot(Request request, String rootPath) + new invalidAnalysisRoot(Request request, String rootPath) : this( request.id, error: RequestError( @@ -444,7 +444,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent an error condition caused /// by a [request] that specifies an execution context whose context root does /// not exist. - Response.invalidExecutionContext(Request request, String contextId) + new invalidExecutionContext(Request request, String contextId) : this( request.id, error: RequestError( @@ -455,7 +455,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// INVALID_FILE_PATH_FORMAT error condition. - Response.invalidFilePathFormat(Request request, Object? path) + new invalidFilePathFormat(Request request, Object? path) : this( request.id, error: RequestError( @@ -469,7 +469,7 @@ class Response extends RequestOrResponse { /// invalid parameter, in JavaScript notation (e.g. "foo.bar" means that the /// parameter "foo" contained a key "bar" whose value was the wrong type). /// [expectation] is a description of the type of data that was expected. - Response.invalidParameter(Request request, String path, String expectation) + new invalidParameter(Request request, String path, String expectation) : this( request.id, error: RequestError( @@ -480,7 +480,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent an error condition caused /// by a malformed request. - Response.invalidRequestFormat() + new invalidRequestFormat() : this( '', error: RequestError( @@ -491,7 +491,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// ORGANIZE_DIRECTIVES_ERROR error condition. - Response.organizeDirectivesError(Request request, String message) + new organizeDirectivesError(Request request, String message) : this( request.id, error: RequestError( @@ -502,7 +502,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// REFACTORING_REQUEST_CANCELLED error condition. - Response.refactoringRequestCancelled(Request request) + new refactoringRequestCancelled(Request request) : this( request.id, error: RequestError( @@ -513,11 +513,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the SERVER_ERROR error /// condition. - factory Response.serverError( - Request request, - Object? exception, - Object? stackTrace, - ) { + factory serverError(Request request, Object? exception, Object? stackTrace) { var error = RequestError( RequestErrorCode.SERVER_ERROR, exception.toString(), @@ -530,7 +526,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// SORT_MEMBERS_INVALID_FILE error condition. - Response.sortMembersInvalidFile(Request request) + new sortMembersInvalidFile(Request request) : this( request.id, error: RequestError( @@ -541,7 +537,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent the /// SORT_MEMBERS_PARSE_ERRORS error condition. - Response.sortMembersParseErrors(Request request, int numErrors) + new sortMembersParseErrors(Request request, int numErrors) : this( request.id, error: RequestError( @@ -552,7 +548,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent an error condition caused /// by a [request] that cannot be handled by any known handlers. - Response.unknownRequest(Request request) + new unknownRequest(Request request) : this( request.id, error: RequestError( @@ -563,7 +559,7 @@ class Response extends RequestOrResponse { /// Initialize a newly created instance to represent an error condition caused /// by a [request] for a service that is not supported. - Response.unsupportedFeature(String requestId, String message) + new unsupportedFeature(String requestId, String message) : this( requestId, error: RequestError(RequestErrorCode.UNSUPPORTED_FEATURE, message), diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart index 1a03b46cb9a..c406026a14e 100644 --- a/pkg/analysis_server/lib/src/analysis_server.dart +++ b/pkg/analysis_server/lib/src/analysis_server.dart @@ -293,7 +293,7 @@ abstract class AnalysisServer { /// temporary content. bool suppressAnalysisResults = false; - AnalysisServer( + new( this.options, this.sdkManager, this.diagnosticServer, @@ -1211,7 +1211,7 @@ abstract class CommonServerContextManagerCallbacks /// The set of files for which notifications were sent. final Set filesToFlush = {}; - CommonServerContextManagerCallbacks(this.resourceProvider); + new(this.resourceProvider); @override @mustCallSuper @@ -1323,7 +1323,7 @@ enum MessageType { final lsp.MessageType forLsp; final legacy.MessageType forLegacy; - const MessageType(this.forLsp, this.forLegacy); + new(this.forLsp, this.forLegacy); } class ServerRecentPerformance { diff --git a/pkg/analysis_server/lib/src/analytics/active_request_data.dart b/pkg/analysis_server/lib/src/analytics/active_request_data.dart index ab054c6d4fb..9ad36f48763 100644 --- a/pkg/analysis_server/lib/src/analytics/active_request_data.dart +++ b/pkg/analysis_server/lib/src/analytics/active_request_data.dart @@ -14,5 +14,5 @@ class ActiveRequestData { final DateTime startTime; /// Initialize a newly created data holder. - ActiveRequestData(this.method, this.clientRequestTime, this.startTime); + new(this.method, this.clientRequestTime, this.startTime); } diff --git a/pkg/analysis_server/lib/src/analytics/analytics_manager.dart b/pkg/analysis_server/lib/src/analytics/analytics_manager.dart index c7528ea81f5..3411e3e7f83 100644 --- a/pkg/analysis_server/lib/src/analytics/analytics_manager.dart +++ b/pkg/analysis_server/lib/src/analytics/analytics_manager.dart @@ -102,7 +102,7 @@ class AnalyticsManager { /// Initialize a newly created analytics manager to report to the [analytics] /// service. - AnalyticsManager(this.analytics) { + new(this.analytics) { if (analytics is! NoOpAnalytics) { periodicTimer = Timer.periodic(Duration(minutes: 30), (_) { _sendPeriodicData(); diff --git a/pkg/analysis_server/lib/src/analytics/context_structure.dart b/pkg/analysis_server/lib/src/analytics/context_structure.dart index 04c5d1ce286..96e2b3398f5 100644 --- a/pkg/analysis_server/lib/src/analytics/context_structure.dart +++ b/pkg/analysis_server/lib/src/analytics/context_structure.dart @@ -63,7 +63,7 @@ class ContextStructure { final PercentileCalculator libraryCycleLineCounts; /// Initialize a newly created data holder. - ContextStructure({ + new({ required this.numberOfContexts, required this.immediateFileCount, required this.immediateFileLineCount, diff --git a/pkg/analysis_server/lib/src/analytics/notification_data.dart b/pkg/analysis_server/lib/src/analytics/notification_data.dart index 0fee5914bc5..3ef7071215d 100644 --- a/pkg/analysis_server/lib/src/analytics/notification_data.dart +++ b/pkg/analysis_server/lib/src/analytics/notification_data.dart @@ -22,5 +22,5 @@ class NotificationData { /// Initialize a newly create data holder for notifications with the given /// [method]. - NotificationData(this.method); + new(this.method); } diff --git a/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart b/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart index cb49e9de015..ab6f8ccd37d 100644 --- a/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart +++ b/pkg/analysis_server/lib/src/analytics/percentile_calculator.dart @@ -15,9 +15,9 @@ class PercentileCalculator { int _valueCount = 0; /// Initialize a newly created percentile calculator. - PercentileCalculator(); + new(); - factory PercentileCalculator.from(List values) { + factory from(List values) { var calculator = PercentileCalculator(); for (var value in values) { calculator.addValue(value); diff --git a/pkg/analysis_server/lib/src/analytics/plugin_data.dart b/pkg/analysis_server/lib/src/analytics/plugin_data.dart index 681e7219386..78faddaf60a 100644 --- a/pkg/analysis_server/lib/src/analytics/plugin_data.dart +++ b/pkg/analysis_server/lib/src/analytics/plugin_data.dart @@ -110,7 +110,7 @@ class PluginDataPerIsolate { /// are registered in each plugin. PercentileCalculator assistCounts = PercentileCalculator(); - PluginDataPerIsolate({required this.pluginCount}); + new({required this.pluginCount}); } extension on String { diff --git a/pkg/analysis_server/lib/src/analytics/request_data.dart b/pkg/analysis_server/lib/src/analytics/request_data.dart index a7395ab3e50..2471d2bd41d 100644 --- a/pkg/analysis_server/lib/src/analytics/request_data.dart +++ b/pkg/analysis_server/lib/src/analytics/request_data.dart @@ -32,7 +32,7 @@ class RequestData { /// Initialize a newly create data holder for requests with the given /// [method]. - RequestData(this.method); + new(this.method); /// Record the occurrence of the enum constant with the given [enumName] for /// the field with the given [name]. diff --git a/pkg/analysis_server/lib/src/analytics/session_data.dart b/pkg/analysis_server/lib/src/analytics/session_data.dart index 3942f8cd6fb..281c4a2116f 100644 --- a/pkg/analysis_server/lib/src/analytics/session_data.dart +++ b/pkg/analysis_server/lib/src/analytics/session_data.dart @@ -71,7 +71,7 @@ class AnalyticsAnalysisWorkingStatistics { final Map libraryDiagnosticsBundleRequirementsFailures = {}; - AnalyticsAnalysisWorkingStatistics({required this.withFineDependencies}); + new({required this.withFineDependencies}); void append(AnalysisStatusWorkingStatistics statistics) { uniqueChangedFiles.addAll(statistics.changedFiles); @@ -134,7 +134,7 @@ class SessionData { final String clientVersion; /// Initialize a newly created data holder. - SessionData({ + new({ required this.startTime, required this.commandLineArguments, required this.clientId, diff --git a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart index 107e36e6eb0..8602659da36 100644 --- a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart +++ b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart @@ -26,7 +26,7 @@ class ByteStreamClientChannel implements ClientCommunicationChannel { @override Stream notificationStream; - factory ByteStreamClientChannel(Stream> input, IOSink output) { + factory(Stream> input, IOSink output) { var jsonStream = input .transform(const Utf8Decoder()) .transform(LineSplitter()) @@ -51,11 +51,7 @@ class ByteStreamClientChannel implements ClientCommunicationChannel { ); } - ByteStreamClientChannel._( - this.output, - this.responseStream, - this.notificationStream, - ); + new _(this.output, this.responseStream, this.notificationStream); @override Future close() { @@ -102,7 +98,7 @@ abstract class ByteStreamServerChannel implements ServerCommunicationChannel { ), ); - ByteStreamServerChannel( + new( this._instrumentationService, this._sessionLogger, { this._requestStatistics, @@ -258,7 +254,7 @@ class InputOutputByteStreamServerChannel extends ByteStreamServerChannel { .transform(const Utf8Decoder()) .transform(const LineSplitter()); - InputOutputByteStreamServerChannel( + new( this._input, this._output, super._instrumentationService, @@ -281,7 +277,7 @@ class StdinStdoutLineStreamServerChannel extends ByteStreamServerChannel { @override late final Stream _lines = _linesFromIsolate.cast(); - StdinStdoutLineStreamServerChannel( + new( super._instrumentationService, super._sessionLogger, { super.requestStatistics, diff --git a/pkg/analysis_server/lib/src/channel/channel.dart b/pkg/analysis_server/lib/src/channel/channel.dart index 2c00681f903..215854cd6b9 100644 --- a/pkg/analysis_server/lib/src/channel/channel.dart +++ b/pkg/analysis_server/lib/src/channel/channel.dart @@ -23,7 +23,7 @@ class ChannelChunkSink implements ChunkedConversionSink { /// Initialize a newly create sink to use the given [converter] to convert /// chunks before adding them to the given [sink]. - ChannelChunkSink(this.converter, this.sink); + new(this.converter, this.sink); @override void add(S chunk) { diff --git a/pkg/analysis_server/lib/src/cider/assists.dart b/pkg/analysis_server/lib/src/cider/assists.dart index 0983d0a5394..dbd255e86ab 100644 --- a/pkg/analysis_server/lib/src/cider/assists.dart +++ b/pkg/analysis_server/lib/src/cider/assists.dart @@ -15,7 +15,7 @@ class CiderAssistsComputer { final PerformanceLog _logger; final FileResolver _fileResolver; - CiderAssistsComputer(this._logger, this._fileResolver); + new(this._logger, this._fileResolver); /// Compute quick assists on the line and character position. Future> compute( diff --git a/pkg/analysis_server/lib/src/cider/completion.dart b/pkg/analysis_server/lib/src/cider/completion.dart index 830f932caf3..85789ab98e1 100644 --- a/pkg/analysis_server/lib/src/cider/completion.dart +++ b/pkg/analysis_server/lib/src/cider/completion.dart @@ -40,7 +40,7 @@ class CiderCompletionComputer { @visibleForTesting final List computedImportedLibraries = []; - CiderCompletionComputer(this._logger, this._cache, this._fileResolver); + new(this._logger, this._cache, this._fileResolver); /// Return completion suggestions for the file and position. /// @@ -232,7 +232,7 @@ class CiderCompletionPerformance { /// The tree of operation performances. final OperationPerformance operations; - CiderCompletionPerformance._({required this.operations}); + new _({required this.operations}); } class CiderCompletionResult { @@ -245,7 +245,7 @@ class CiderCompletionResult { /// completion request. final CiderPosition prefixStart; - CiderCompletionResult._({ + new _({ required this.suggestions, required this.performance, required this.prefixStart, @@ -256,12 +256,12 @@ class CiderPosition { final int line; final int column; - CiderPosition(this.line, this.column); + new(this.line, this.column); } class _CiderImportedLibrarySuggestions { final String signature; final List suggestionBuilders; - _CiderImportedLibrarySuggestions(this.signature, this.suggestionBuilders); + new(this.signature, this.suggestionBuilders); } diff --git a/pkg/analysis_server/lib/src/cider/document_symbols.dart b/pkg/analysis_server/lib/src/cider/document_symbols.dart index afa1dc1e32c..f99c6dbe69d 100644 --- a/pkg/analysis_server/lib/src/cider/document_symbols.dart +++ b/pkg/analysis_server/lib/src/cider/document_symbols.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; class CiderDocumentSymbolsComputer { final FileResolver _fileResolver; - CiderDocumentSymbolsComputer(this._fileResolver); + new(this._fileResolver); Future> compute2(String filePath) async { var result = []; diff --git a/pkg/analysis_server/lib/src/cider/fixes.dart b/pkg/analysis_server/lib/src/cider/fixes.dart index add0127224e..8e60a5b4402 100644 --- a/pkg/analysis_server/lib/src/cider/fixes.dart +++ b/pkg/analysis_server/lib/src/cider/fixes.dart @@ -23,18 +23,14 @@ class CiderErrorFixes { final LineInfo lineInfo; - CiderErrorFixes({ - required this.diagnostic, - required this.fixes, - required this.lineInfo, - }); + new({required this.diagnostic, required this.fixes, required this.lineInfo}); } class CiderFixesComputer { final PerformanceLog _logger; final FileResolver _fileResolver; - CiderFixesComputer(this._logger, this._fileResolver); + new(this._logger, this._fileResolver); /// Compute quick fixes for errors on the line at [lineNumber]. Future> compute(String path, int lineNumber) async { @@ -78,7 +74,7 @@ class CiderFixesComputer { class _CiderDartFixContextImpl extends DartFixContext { final FileResolver _fileResolver; - _CiderDartFixContextImpl( + new( this._fileResolver, { required super.workspace, required super.libraryResult, diff --git a/pkg/analysis_server/lib/src/cider/local_library_contributor.dart b/pkg/analysis_server/lib/src/cider/local_library_contributor.dart index 0fec7f804ab..15706c967a2 100644 --- a/pkg/analysis_server/lib/src/cider/local_library_contributor.dart +++ b/pkg/analysis_server/lib/src/cider/local_library_contributor.dart @@ -31,7 +31,7 @@ class LibraryElementSuggestionBuilder /// The set of libraries that have been, or are currently being, visited. final Set visitedLibraries = {}; - factory LibraryElementSuggestionBuilder( + factory( DartCompletionRequest request, SuggestionBuilder builder, [ String? prefix, @@ -49,13 +49,7 @@ class LibraryElementSuggestionBuilder ); } - LibraryElementSuggestionBuilder._( - this.request, - this.builder, - this.opType, - this.kind, - this.prefix, - ); + new _(this.request, this.builder, this.opType, this.kind, this.prefix); @override void visitClassElement(ClassElement element) { diff --git a/pkg/analysis_server/lib/src/cider/rename.dart b/pkg/analysis_server/lib/src/cider/rename.dart index d437501031c..83962ac7775 100644 --- a/pkg/analysis_server/lib/src/cider/rename.dart +++ b/pkg/analysis_server/lib/src/cider/rename.dart @@ -27,7 +27,7 @@ class CanRenameResponse { FlutterWidgetState? _flutterWidgetState; - CanRenameResponse( + new( this.lineInfo, this.refactoringElement, this._fileResolver, @@ -117,7 +117,7 @@ class CheckNameResponse { final CanRenameResponse canRename; final String newName; - CheckNameResponse(this.status, this.canRename, this.newName); + new(this.status, this.canRename, this.newName); LineInfo get lineInfo => canRename.lineInfo; @@ -428,7 +428,7 @@ class CheckNameResponse { class CiderRenameComputer { final FileResolver _fileResolver; - CiderRenameComputer(this._fileResolver); + new(this._fileResolver); /// Check if the identifier at the [line], [column] for the file at the /// [filePath] can be renamed. @@ -490,7 +490,7 @@ class CiderReplaceMatch { final String path; List matches; - CiderReplaceMatch(this.path, this.matches); + new(this.path, this.matches); } class FlutterWidgetRename { @@ -501,7 +501,7 @@ class FlutterWidgetRename { final List matches; final List replacements; - FlutterWidgetRename(this.name, this.matches, this.replacements); + new(this.name, this.matches, this.replacements); } /// The corresponding `State` declaration of a Flutter `StatefulWidget`. @@ -509,7 +509,7 @@ class FlutterWidgetState { ClassElement state; String newName; - FlutterWidgetState(this.state, this.newName); + new(this.state, this.newName); } class RenameResponse { @@ -521,7 +521,7 @@ class RenameResponse { final List replaceMatches; FlutterWidgetRename? flutterWidgetRename; - RenameResponse( + new( this.matches, this.checkName, this.replaceMatches, { @@ -534,7 +534,7 @@ class ReplaceInfo { final CharacterLocation startPosition; final int length; - ReplaceInfo(this.replacementText, this.startPosition, this.length); + new(this.replacementText, this.startPosition, this.length); @override int get hashCode => Object.hash(replacementText, startPosition, length); diff --git a/pkg/analysis_server/lib/src/cider/signature_help.dart b/pkg/analysis_server/lib/src/cider/signature_help.dart index b39b83d011e..bb50d06cba5 100644 --- a/pkg/analysis_server/lib/src/cider/signature_help.dart +++ b/pkg/analysis_server/lib/src/cider/signature_help.dart @@ -13,7 +13,7 @@ import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart'; class CiderSignatureHelpComputer { final FileResolver _fileResolver; - CiderSignatureHelpComputer(this._fileResolver); + new(this._fileResolver); Future compute2( String filePath, @@ -67,5 +67,5 @@ class SignatureHelpResponse { /// The location of the left parenthesis. final CharacterLocation callStart; - SignatureHelpResponse(this.signatureHelp, this.callStart); + new(this.signatureHelp, this.callStart); } diff --git a/pkg/analysis_server/lib/src/collections.dart b/pkg/analysis_server/lib/src/collections.dart index 81610854c0a..83ae2422540 100644 --- a/pkg/analysis_server/lib/src/collections.dart +++ b/pkg/analysis_server/lib/src/collections.dart @@ -21,7 +21,7 @@ class RecentBuffer { final Queue _buffer; - RecentBuffer(this.capacity) : _buffer = Queue(); + new(this.capacity) : _buffer = Queue(); Iterable get items => _buffer; diff --git a/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart b/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart index b9501c0de6e..c96da34a8b2 100644 --- a/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart +++ b/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart @@ -55,7 +55,7 @@ class CallHierarchyCalls { final CallHierarchyItem item; final List ranges = []; - CallHierarchyCalls(this.item); + new(this.item); } /// An item that can appear in a Call Hierarchy. @@ -92,7 +92,7 @@ class CallHierarchyItem { /// The range of the code for the declaration of this item. final SourceRange codeRange; - CallHierarchyItem({ + new({ required this.displayName, required this.containerName, required this.kind, @@ -101,7 +101,7 @@ class CallHierarchyItem { required this.codeRange, }); - CallHierarchyItem.forElement(Element element) + new forElement(Element element) : displayName = _getDisplayName(element), nameRange = _nameRangeForElement(element), codeRange = _codeRangeForElement(element), @@ -210,7 +210,7 @@ enum CallHierarchyKind { class DartCallHierarchyComputer { final ResolvedUnitResult _result; - DartCallHierarchyComputer(this._result); + new(this._result); /// Finds incoming calls to [target], returning the elements that call them /// and ranges of those calls within. @@ -483,7 +483,7 @@ class _OutboundCallVisitor extends RecursiveAstVisitor { final AstNode root; final void Function(AstNode) collect; - _OutboundCallVisitor(this.root, this.collect); + new(this.root, this.collect); @override void visitConstructorName(ConstructorName node) { diff --git a/pkg/analysis_server/lib/src/computer/computer_closing_labels.dart b/pkg/analysis_server/lib/src/computer/computer_closing_labels.dart index 7387266f0ca..c4b3e48db5a 100644 --- a/pkg/analysis_server/lib/src/computer/computer_closing_labels.dart +++ b/pkg/analysis_server/lib/src/computer/computer_closing_labels.dart @@ -16,7 +16,7 @@ class DartUnitClosingLabelsComputer { final Set hasNestingSet = {}; final Set isSingleLineSet = {}; - DartUnitClosingLabelsComputer(this._lineInfo, this._unit); + new(this._lineInfo, this._unit); /// Returns a list of closing labels, not `null`. List compute() { @@ -45,7 +45,7 @@ class _DartUnitClosingLabelsComputerVisitor extends RecursiveAstVisitor { int interpolatedStringsEntered = 0; List labelStack = []; - _DartUnitClosingLabelsComputerVisitor(this.computer); + new(this.computer); ClosingLabel? get _currentLabel => labelStack.isEmpty ? null : labelStack.last; diff --git a/pkg/analysis_server/lib/src/computer/computer_color.dart b/pkg/analysis_server/lib/src/computer/computer_color.dart index b2f509e79cf..f368cca67b9 100644 --- a/pkg/analysis_server/lib/src/computer/computer_color.dart +++ b/pkg/analysis_server/lib/src/computer/computer_color.dart @@ -18,7 +18,7 @@ class ColorComputer { final ResolvedUnitResult resolvedUnit; final List _colors = []; - ColorComputer(this.resolvedUnit, path.Context pathContext); + new(this.resolvedUnit, path.Context pathContext); /// Returns information about the color references in [resolvedUnit]. /// @@ -326,7 +326,7 @@ class ColorInformation { /// Blue as a value from 0 to 255. final int blue; - ColorInformation(this.alpha, this.red, this.green, this.blue); + new(this.alpha, this.red, this.green, this.blue); } /// Information about a specific known location of a [ColorInformation] @@ -336,13 +336,13 @@ class ColorReference { final int length; final ColorInformation color; - ColorReference(this.offset, this.length, this.color); + new(this.offset, this.length, this.color); } class _ColorBuilder extends RecursiveAstVisitor { final ColorComputer computer; - _ColorBuilder(this.computer); + new(this.computer); @override void visitDotShorthandConstructorInvocation( diff --git a/pkg/analysis_server/lib/src/computer/computer_document_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_document_highlights.dart index c2ab6909ce8..9b3d287cfbc 100644 --- a/pkg/analysis_server/lib/src/computer/computer_document_highlights.dart +++ b/pkg/analysis_server/lib/src/computer/computer_document_highlights.dart @@ -17,7 +17,7 @@ import 'package:analyzer/src/utilities/extensions/collection.dart'; class DartDocumentHighlightsComputer { final CompilationUnit _unit; - DartDocumentHighlightsComputer(this._unit); + new(this._unit); /// Computes matching highlight tokens for the requested offset. List<({Token token, DocumentHighlightKind kind})> compute( @@ -163,7 +163,7 @@ class _DartDocumentHighlightsVisitor extends GeneralizingAstVisitor { /// Stack to track the current function for return/yield keywords. final List _functionStack = []; - _DartDocumentHighlightsVisitor(this._target); + new(this._target); @override void visitAssignedVariablePattern(AssignedVariablePattern node) { @@ -519,13 +519,13 @@ class _HighlightTargets { final Set _targetElementNames; final AstNode? _targetNode; - _HighlightTargets.elements(this._targetElements) + new elements(this._targetElements) : _targetNode = null, _targetElementNames = { for (var element in _targetElements) ?element.name, }; - _HighlightTargets.node(this._targetNode) + new node(this._targetNode) : _targetElements = const {}, _targetElementNames = const {}; diff --git a/pkg/analysis_server/lib/src/computer/computer_documentation.dart b/pkg/analysis_server/lib/src/computer/computer_documentation.dart index d36ba5554dc..b0fbd43a136 100644 --- a/pkg/analysis_server/lib/src/computer/computer_documentation.dart +++ b/pkg/analysis_server/lib/src/computer/computer_documentation.dart @@ -10,7 +10,7 @@ import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart'; class DartDocumentationComputer { final DartdocDirectiveInfo dartdocInfo; - DartDocumentationComputer(this.dartdocInfo); + new(this.dartdocInfo); Documentation? compute( Element elementBeingDocumented, { diff --git a/pkg/analysis_server/lib/src/computer/computer_folding.dart b/pkg/analysis_server/lib/src/computer/computer_folding.dart index c97a2b00d9f..2a820e39d8b 100644 --- a/pkg/analysis_server/lib/src/computer/computer_folding.dart +++ b/pkg/analysis_server/lib/src/computer/computer_folding.dart @@ -22,7 +22,7 @@ class DartUnitFoldingComputer { /// editors typically only show one folding action button per line. final _linesWithRegions = {}; - DartUnitFoldingComputer(this._lineInfo, this._unit); + new(this._lineInfo, this._unit); void addRegionForConditionalBlock(Block block) { // For class/function/method blocks, we usually include the whitespace up @@ -230,7 +230,7 @@ class DartUnitFoldingComputer { class _DartUnitFoldingComputerVisitor extends RecursiveAstVisitor { final DartUnitFoldingComputer _computer; - _DartUnitFoldingComputerVisitor(this._computer); + new(this._computer); @override void visitArgumentList(ArgumentList node) { @@ -571,7 +571,7 @@ class _Directive { final Directive directive; final Token keyword; - _Directive(this.directive, this.keyword); + new(this.directive, this.keyword); } extension _CommentTokenExtensions on Token { diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart index 6bafb579421..54c228e9b63 100644 --- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart +++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart @@ -46,7 +46,7 @@ class DartUnitHighlightsComputer { /// /// If [range] is supplied, tokens outside of this range will not be included /// in results. - DartUnitHighlightsComputer(this._unit, {this.range}); + new(this._unit, {this.range}); /// Returns the computed highlight regions, not `null`. List compute() { @@ -736,7 +736,7 @@ class DartUnitHighlightsComputer { class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor { final DartUnitHighlightsComputer computer; - _DartUnitHighlightsComputerVisitor(this.computer); + new(this.computer); @override void visitAnnotation(Annotation node) { diff --git a/pkg/analysis_server/lib/src/computer/computer_hover.dart b/pkg/analysis_server/lib/src/computer/computer_hover.dart index 8040dd8e685..fba0e60cf95 100644 --- a/pkg/analysis_server/lib/src/computer/computer_hover.dart +++ b/pkg/analysis_server/lib/src/computer/computer_hover.dart @@ -25,7 +25,7 @@ class DartUnitHoverComputer { final DocumentationPreference documentationPreference; final DartDocumentationComputer _documentationComputer; - DartUnitHoverComputer( + new( DartdocDirectiveInfo dartdocInfo, this._unit, this._offset, { diff --git a/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart b/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart index 06d08ece192..769452c1c0e 100644 --- a/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart +++ b/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart @@ -28,7 +28,7 @@ class DartInlayHintComputer { final List _hints = []; final LspClientInlayHintsConfiguration _config; - DartInlayHintComputer( + new( this.pathContext, ResolvedUnitResult result, [ // This parameter is optional because this class is used internally @@ -332,7 +332,7 @@ class DartInlayHintComputer { class _DartInlayHintComputerVisitor extends GeneralizingAstVisitor { final DartInlayHintComputer _computer; - _DartInlayHintComputerVisitor(this._computer); + new(this._computer); @override void visitArgumentList(ArgumentList node) { diff --git a/pkg/analysis_server/lib/src/computer/computer_lazy_type_hierarchy.dart b/pkg/analysis_server/lib/src/computer/computer_lazy_type_hierarchy.dart index 87837614069..bf34a104ffc 100644 --- a/pkg/analysis_server/lib/src/computer/computer_lazy_type_hierarchy.dart +++ b/pkg/analysis_server/lib/src/computer/computer_lazy_type_hierarchy.dart @@ -33,7 +33,7 @@ import 'package:analyzer/src/dart/element/element.dart'; class DartLazyTypeHierarchyComputer { final ResolvedUnitResult _result; - DartLazyTypeHierarchyComputer(this._result); + new(this._result); /// Finds subtypes for the [Element] at [location]. Future?> findSubtypes( @@ -163,7 +163,7 @@ class TypeHierarchyAnchor { /// The supertype path from [location] to the target element. final List path; - TypeHierarchyAnchor({required this.location, required this.path}); + new({required this.location, required this.path}); } /// An item that can appear in a Type Hierarchy. @@ -191,7 +191,7 @@ class TypeHierarchyItem { /// The range of the code for the declaration of this item. final SourceRange codeRange; - TypeHierarchyItem({ + new({ required this.displayName, required this.location, required this.file, @@ -200,14 +200,12 @@ class TypeHierarchyItem { required this.codeRange, }); - TypeHierarchyItem._forElement({ - required InterfaceElement element, - required this.location, - }) : displayName = _displayNameForElement(element), - nameRange = _nameRangeForElement(element), - codeRange = _codeRangeForElement(element), - file = element.firstFragment.libraryFragment.source.fullName, - lineInfo = element.firstFragment.libraryFragment.lineInfo; + new _forElement({required InterfaceElement element, required this.location}) + : displayName = _displayNameForElement(element), + nameRange = _nameRangeForElement(element), + codeRange = _codeRangeForElement(element), + file = element.firstFragment.libraryFragment.source.fullName, + lineInfo = element.firstFragment.libraryFragment.lineInfo; static TypeHierarchyItem? forElement(InterfaceElement element) { var location = ElementLocation.forElement(element); @@ -254,7 +252,7 @@ class TypeHierarchyRelatedItem extends TypeHierarchyItem { /// The relationship this item has with the target item. final TypeHierarchyItemRelationship relationship; - TypeHierarchyRelatedItem.forElement({ + new forElement({ required super.element, required this.relationship, required super.location, diff --git a/pkg/analysis_server/lib/src/computer/computer_outline.dart b/pkg/analysis_server/lib/src/computer/computer_outline.dart index 035257e3e59..6b8bb80f1e7 100644 --- a/pkg/analysis_server/lib/src/computer/computer_outline.dart +++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart @@ -16,7 +16,7 @@ class DartUnitOutlineComputer { final ResolvedUnitResult resolvedUnit; final bool withBasicFlutter; - DartUnitOutlineComputer(this.resolvedUnit, {this.withBasicFlutter = false}); + new(this.resolvedUnit, {this.withBasicFlutter = false}); /// Returns the computed outline, not `null`. Outline compute() { @@ -672,7 +672,7 @@ class _FunctionBodyOutlinesVisitor extends RecursiveAstVisitor { final DartUnitOutlineComputer outlineComputer; final List contents; - _FunctionBodyOutlinesVisitor(this.outlineComputer, this.contents); + new(this.outlineComputer, this.contents); /// Return `true` if the given [element] is the method 'group' defined in the /// test package. diff --git a/pkg/analysis_server/lib/src/computer/computer_overrides.dart b/pkg/analysis_server/lib/src/computer/computer_overrides.dart index a322978a221..89944959f64 100644 --- a/pkg/analysis_server/lib/src/computer/computer_overrides.dart +++ b/pkg/analysis_server/lib/src/computer/computer_overrides.dart @@ -22,7 +22,7 @@ class DartUnitOverridesComputer { final CompilationUnit _unit; final List _overrides = []; - DartUnitOverridesComputer(this._unit); + new(this._unit); /// Returns the computed occurrences, not `null`. List compute() { @@ -105,7 +105,7 @@ class OverriddenElements { /// which is implemented by the class that defines [element]. final List interfaceElements; - OverriddenElements(this.element, this.superElements, this.interfaceElements); + new(this.element, this.superElements, this.interfaceElements); } class _OverriddenElementsFinder { @@ -119,7 +119,7 @@ class _OverriddenElementsFinder { final List _interfaceElements = []; final Set _visited = {}; - factory _OverriddenElementsFinder(Element seed) { + factory(Element seed) { var class_ = seed.enclosingElement as InterfaceElement; var library = class_.library; var name = seed.displayName; @@ -138,13 +138,7 @@ class _OverriddenElementsFinder { return _OverriddenElementsFinder._(seed, library, class_, name, kinds); } - _OverriddenElementsFinder._( - this._seed, - this._library, - this._class, - this._name, - this._kinds, - ); + new _(this._seed, this._library, this._class, this._name, this._kinds); /// Add the [OverriddenElements] for this element. OverriddenElements find() { diff --git a/pkg/analysis_server/lib/src/computer/computer_selection_ranges.dart b/pkg/analysis_server/lib/src/computer/computer_selection_ranges.dart index fcaeea68f71..dfb2cc64d8a 100644 --- a/pkg/analysis_server/lib/src/computer/computer_selection_ranges.dart +++ b/pkg/analysis_server/lib/src/computer/computer_selection_ranges.dart @@ -13,7 +13,7 @@ class DartSelectionRangeComputer { final int _offset; final _selectionRanges = []; - DartSelectionRangeComputer(this._unit, this._offset); + new(this._unit, this._offset); /// Returns selection ranges for nodes containing [_offset], starting with the /// closest working up to the outer-most node. @@ -98,5 +98,5 @@ class SelectionRange { final int offset; final int length; - SelectionRange(this.offset, this.length); + new(this.offset, this.length); } diff --git a/pkg/analysis_server/lib/src/computer/computer_signature.dart b/pkg/analysis_server/lib/src/computer/computer_signature.dart index eb7ebd65d0d..f643353bc22 100644 --- a/pkg/analysis_server/lib/src/computer/computer_signature.dart +++ b/pkg/analysis_server/lib/src/computer/computer_signature.dart @@ -19,7 +19,7 @@ class DartUnitSignatureComputer { final DocumentationPreference documentationPreference; final DartDocumentationComputer _documentationComputer; - DartUnitSignatureComputer( + new( DartdocDirectiveInfo dartdocInfo, CompilationUnit unit, this._offset, { @@ -162,7 +162,7 @@ class SignatureInformation { /// name will not be returned. final int? activeParameterIndex; - SignatureInformation({ + new({ required this.name, required this.parameters, required this.argumentList, diff --git a/pkg/analysis_server/lib/src/computer/computer_type_arguments_signature.dart b/pkg/analysis_server/lib/src/computer/computer_type_arguments_signature.dart index dd7a6c18c4d..b4125177ff3 100644 --- a/pkg/analysis_server/lib/src/computer/computer_type_arguments_signature.dart +++ b/pkg/analysis_server/lib/src/computer/computer_type_arguments_signature.dart @@ -21,7 +21,7 @@ class DartTypeArgumentsSignatureComputer { final DocumentationPreference documentationPreference; final DartDocumentationComputer _documentationComputer; - DartTypeArgumentsSignatureComputer( + new( DartdocDirectiveInfo dartdocInfo, CompilationUnit unit, int offset, diff --git a/pkg/analysis_server/lib/src/computer/import_elements_computer.dart b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart index b53963de03f..30e26abfd68 100644 --- a/pkg/analysis_server/lib/src/computer/import_elements_computer.dart +++ b/pkg/analysis_server/lib/src/computer/import_elements_computer.dart @@ -26,7 +26,7 @@ class ImportElementsComputer { final ResolvedUnitResult libraryResult; /// Initialize a newly created builder. - ImportElementsComputer(this.resourceProvider, this.libraryResult); + new(this.resourceProvider, this.libraryResult); /// Creates the edits that will cause the list of [importedElementsList] to be /// imported into the library. @@ -402,7 +402,7 @@ class _ImportUpdate { /// Initialize a newly created information holder to hold information about /// updates to the given [import]. - _ImportUpdate(this.import); + new(this.import); /// Record that the given [name] needs to be added to show combinators. void show(String name) { @@ -420,7 +420,7 @@ class _InsertionDescription { final int offset; final int newLinesAfter; - _InsertionDescription(this.offset, {int before = 0, int after = 0}) + new(this.offset, {int before = 0, int after = 0}) : newLinesBefore = before, newLinesAfter = after; } diff --git a/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart b/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart index d77ba4a1a0c..af861e79fa4 100644 --- a/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart +++ b/pkg/analysis_server/lib/src/computer/imported_elements_computer.dart @@ -24,7 +24,7 @@ class ImportedElementsComputer { /// Initialize a newly created computer to compute the list of imported /// elements referenced in the given [unit] within the region with the given /// [offset] and [length]. - ImportedElementsComputer(this.unit, this.offset, this.length); + new(this.unit, this.offset, this.length); /// Compute and return the list of imported elements. List compute() { @@ -65,7 +65,7 @@ class _Visitor extends UnifyingAstVisitor { /// Initialize a newly created visitor to visit nodes within a specified /// portion. - _Visitor(this.startOffset, this.endOffset); + new(this.startOffset, this.endOffset); @override void visitNamedType(NamedType node) { diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart index 10f3d9ce818..316122a9c61 100644 --- a/pkg/analysis_server/lib/src/context_manager.dart +++ b/pkg/analysis_server/lib/src/context_manager.dart @@ -271,7 +271,7 @@ class ContextManagerImpl implements ContextManager { /// rebuild and wait for it to terminate before starting the next. final _CancellingTaskQueue _currentContextRebuild = _CancellingTaskQueue(); - ContextManagerImpl( + new( this.resourceProvider, this.sdkManager, this.packageConfigFile, @@ -1027,7 +1027,7 @@ class NoopContextManagerCallbacks implements ContextManagerCallbacks { class _BlazeWatchedFiles { final String workspace; final paths = {}; - _BlazeWatchedFiles(this.workspace); + new(this.workspace); } /// Handles a task queue of tasks that cannot run concurrently. diff --git a/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart b/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart index 9070aa3305b..d4fb6730a5c 100644 --- a/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart +++ b/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart @@ -15,7 +15,7 @@ class ImplementedComputer { Set? subtypeMembers; - ImplementedComputer(this.searchEngine, this.unitElement); + new(this.searchEngine, this.unitElement); Future compute() async { for (var fragment in unitElement.classes) { diff --git a/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart b/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart index 0efba2c948f..7d6fe4f9988 100644 --- a/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart +++ b/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart @@ -18,7 +18,7 @@ class FlutterOutlineComputer { final List _depthFirstOrder = []; - FlutterOutlineComputer(this.resolvedUnit); + new(this.resolvedUnit); protocol.FlutterOutline compute() { var dartOutline = DartUnitOutlineComputer(resolvedUnit).compute(); @@ -282,7 +282,7 @@ class _FlutterOutlineBuilder extends GeneralizingAstVisitor { final FlutterOutlineComputer computer; final List outlines = []; - _FlutterOutlineBuilder(this.computer); + new(this.computer); @override void visitExpression(Expression node) { diff --git a/pkg/analysis_server/lib/src/g3/fixes.dart b/pkg/analysis_server/lib/src/g3/fixes.dart index eaf0121515c..76a95f3a2ed 100644 --- a/pkg/analysis_server/lib/src/g3/fixes.dart +++ b/pkg/analysis_server/lib/src/g3/fixes.dart @@ -37,7 +37,7 @@ class LintFixTester { /// not be allowed. bool _canUpdateResourceProvider = true; - LintFixTester({ + new({ required ResourceProvider resourceProvider, required this.sdkPath, required this.packageConfigPath, @@ -140,7 +140,7 @@ class LintFixTesterWithFixes { final LintFixTester _parent; final List fixes; - LintFixTesterWithFixes({required this._parent, required this.fixes}); + new({required this._parent, required this.fixes}); void assertNoFixes() { if (fixes.isNotEmpty) { @@ -161,7 +161,7 @@ class LintFixTesterWithSingleFix { final LintFixTesterWithFixes _parent; final Fix fix; - LintFixTesterWithSingleFix({required this._parent, required this.fix}); + new({required this._parent, required this.fix}); void assertFixedContentOfFile({ required String path, diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_errors.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_errors.dart index 4da90c9151f..563204b40c5 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_errors.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_errors.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/protocol_server.dart'; class AnalysisGetErrorsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisGetErrorsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_hover.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_hover.dart index 2c03e3b3219..63aac42bda0 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_hover.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_hover.dart @@ -14,12 +14,7 @@ import 'package:analyzer/dart/analysis/results.dart'; class AnalysisGetHoverHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisGetHoverHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_imported_elements.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_imported_elements.dart index 9fac2eb8bd5..d2acc4c5666 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_imported_elements.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_imported_elements.dart @@ -14,12 +14,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalysisGetImportedElementsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisGetImportedElementsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_navigation.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_navigation.dart index 3db0c51450d..d7bb2f3e51b 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_navigation.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_navigation.dart @@ -20,12 +20,7 @@ class AnalysisGetNavigationHandler extends LegacyHandler with RequestHandlerMixin { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisGetNavigationHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_signature.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_signature.dart index a19c340fd1c..2967fcf6c6c 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_get_signature.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_get_signature.dart @@ -13,12 +13,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalysisGetSignatureHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisGetSignatureHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_reanalyze.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_reanalyze.dart index 23f7e4bfbdd..1d737babfcb 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_reanalyze.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_reanalyze.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalysisReanalyzeHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisReanalyzeHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_analysis_roots.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_analysis_roots.dart index 32c9907f8b5..4073f6400db 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_analysis_roots.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_analysis_roots.dart @@ -14,12 +14,7 @@ import 'package:analysis_server/src/utilities/extensions/resource_provider.dart' class AnalysisSetAnalysisRootsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisSetAnalysisRootsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_general_subscriptions.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_general_subscriptions.dart index c901fb2c2db..a3844574b86 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_general_subscriptions.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_general_subscriptions.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalysisSetGeneralSubscriptionsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisSetGeneralSubscriptionsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_priority_files.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_priority_files.dart index b659748f183..e26e55fda77 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_priority_files.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_priority_files.dart @@ -14,12 +14,7 @@ import 'package:analysis_server/src/utilities/extensions/resource_provider.dart' class AnalysisSetPriorityFilesHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisSetPriorityFilesHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_subscriptions.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_subscriptions.dart index a38b270cdca..ba249f91236 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_set_subscriptions.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_set_subscriptions.dart @@ -15,12 +15,7 @@ import 'package:analysis_server/src/utilities/extensions/resource_provider.dart' class AnalysisSetSubscriptionsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisSetSubscriptionsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_update_content.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_update_content.dart index e46dbeab915..66afa22ab49 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_update_content.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_update_content.dart @@ -14,12 +14,7 @@ import 'package:analysis_server/src/utilities/extensions/resource_provider.dart' class AnalysisUpdateContentHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisUpdateContentHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analysis_update_options.dart b/pkg/analysis_server/lib/src/handler/legacy/analysis_update_options.dart index 0b052f281a9..be52587f90d 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analysis_update_options.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analysis_update_options.dart @@ -13,12 +13,7 @@ import 'package:analyzer/src/dart/analysis/analysis_options.dart'; class AnalysisUpdateOptionsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalysisUpdateOptionsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analytics_enable.dart b/pkg/analysis_server/lib/src/handler/legacy/analytics_enable.dart index 8ee98744d49..75f1fd8bc38 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analytics_enable.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analytics_enable.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalyticsEnableHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalyticsEnableHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analytics_is_enabled.dart b/pkg/analysis_server/lib/src/handler/legacy/analytics_is_enabled.dart index 388822b8906..903d1d907e1 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analytics_is_enabled.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analytics_is_enabled.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalyticsIsEnabledHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalyticsIsEnabledHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analytics_send_event.dart b/pkg/analysis_server/lib/src/handler/legacy/analytics_send_event.dart index 3b4aff1dc3a..487c2ea75cd 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analytics_send_event.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analytics_send_event.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalyticsSendEventHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalyticsSendEventHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/analytics_send_timing.dart b/pkg/analysis_server/lib/src/handler/legacy/analytics_send_timing.dart index 00c56892a9b..d9bac6dfc72 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/analytics_send_timing.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/analytics_send_timing.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class AnalyticsSendTimingHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - AnalyticsSendTimingHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestion_details2.dart b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestion_details2.dart index 008dce57c92..8b7783902ff 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestion_details2.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestion_details2.dart @@ -18,12 +18,7 @@ class CompletionGetSuggestionDetails2Handler extends CompletionHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - CompletionGetSuggestionDetails2Handler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart index c5762394eb8..53831aa3db9 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/completion_get_suggestions2.dart @@ -25,12 +25,7 @@ class CompletionGetSuggestions2Handler extends CompletionHandler with RequestHandlerMixin { /// Initialize a newly created handler to be able to service requests for the /// [server]. - CompletionGetSuggestions2Handler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); /// Computes completion results for [request] and append them to the stream. /// diff --git a/pkg/analysis_server/lib/src/handler/legacy/completion_utils.dart b/pkg/analysis_server/lib/src/handler/legacy/completion_utils.dart index fd63e5c77bd..e515f16ffa9 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/completion_utils.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/completion_utils.dart @@ -800,7 +800,7 @@ class _ParameterData { bool? hasNamedParameters; CompletionDefaultArgumentList? defaultArgumentList; - _ParameterData( + new( this.parameterNames, this.parameterTypes, this.requiredParameterCount, diff --git a/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_diagnostics.dart b/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_diagnostics.dart index 96f015fdf7a..d2bd63845fd 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_diagnostics.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_diagnostics.dart @@ -12,12 +12,7 @@ import 'package:analyzer/src/dart/analysis/driver.dart'; class DiagnosticGetDiagnosticsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - DiagnosticGetDiagnosticsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_server_port.dart b/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_server_port.dart index 86f300dde0e..6a445f53395 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_server_port.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/diagnostic_get_server_port.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class DiagnosticGetServerPortHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - DiagnosticGetServerPortHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_bulk_fixes.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_bulk_fixes.dart index a99d3ba3ec6..1c7436b9b83 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_bulk_fixes.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_bulk_fixes.dart @@ -17,12 +17,7 @@ import 'package:analyzer/src/lint/registry.dart'; class EditBulkFixes extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditBulkFixes( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_format.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_format.dart index a2da8d5cae9..d890b8561dc 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_format.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_format.dart @@ -16,12 +16,7 @@ import 'package:dart_style/dart_style.dart' hide TrailingCommas; class EditFormatHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditFormatHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_format_if_enabled.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_format_if_enabled.dart index 3a17e721bdf..aa0f4634fc5 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_format_if_enabled.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_format_if_enabled.dart @@ -20,12 +20,7 @@ import 'package:pub_semver/pub_semver.dart'; class EditFormatIfEnabledHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditFormatIfEnabledHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); /// Format the given [file] with the given [languageVersion]. /// diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_get_assists.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_get_assists.dart index 1c15642d004..bd7c485dada 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_get_assists.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_get_assists.dart @@ -25,12 +25,7 @@ class EditGetAssistsHandler extends LegacyHandler with RequestHandlerMixin { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditGetAssistsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_get_available_refactorings.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_get_available_refactorings.dart index ed97af5ab7f..86f4d14ad1c 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_get_available_refactorings.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_get_available_refactorings.dart @@ -15,12 +15,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; class EditGetAvailableRefactoringsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditGetAvailableRefactoringsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart index e5ec2c20bf7..c6b69a953d7 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart @@ -38,12 +38,7 @@ class EditGetFixesHandler extends LegacyHandler with RequestHandlerMixin { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditGetFixesHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_get_postfix_completion.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_get_postfix_completion.dart index ac6c8b1abc8..02873658af4 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_get_postfix_completion.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_get_postfix_completion.dart @@ -13,12 +13,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; class EditGetPostfixCompletionHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditGetPostfixCompletionHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_get_refactoring.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_get_refactoring.dart index 9c33401f1df..ef720e9fb41 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_get_refactoring.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_get_refactoring.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class EditGetRefactoringHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditGetRefactoringHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_get_statement_completion.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_get_statement_completion.dart index 36cb778ba8e..d4de1153690 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_get_statement_completion.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_get_statement_completion.dart @@ -13,12 +13,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; class EditGetStatementCompletionHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditGetStatementCompletionHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart index 3cc9187d1aa..99c9d546e57 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart @@ -13,12 +13,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class EditImportElementsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditImportElementsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_is_postfix_completion_applicable.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_is_postfix_completion_applicable.dart index 6afc1de1cad..6f661a71b84 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_is_postfix_completion_applicable.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_is_postfix_completion_applicable.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/services/completion/postfix/postfix_completi class EditIsPostfixCompletionApplicableHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditIsPostfixCompletionApplicableHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_list_postfix_completion_templates.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_list_postfix_completion_templates.dart index 9827d617b33..2b00a9814ae 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_list_postfix_completion_templates.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_list_postfix_completion_templates.dart @@ -17,12 +17,7 @@ class EditListPostfixCompletionTemplatesHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditListPostfixCompletionTemplatesHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_organize_directives.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_organize_directives.dart index d968b42f387..669aecf01bf 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_organize_directives.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_organize_directives.dart @@ -15,12 +15,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; class EditOrganizeDirectivesHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditOrganizeDirectivesHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_sort_members.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_sort_members.dart index 48e8f301e9c..339c3a60110 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/edit_sort_members.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/edit_sort_members.dart @@ -15,12 +15,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; class EditSortMembersHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - EditSortMembersHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/execution_create_context.dart b/pkg/analysis_server/lib/src/handler/legacy/execution_create_context.dart index baf99e10a20..ba6695af3fe 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/execution_create_context.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/execution_create_context.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ExecutionCreateContextHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ExecutionCreateContextHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/execution_delete_context.dart b/pkg/analysis_server/lib/src/handler/legacy/execution_delete_context.dart index 45fd99a20c6..c98641b77f5 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/execution_delete_context.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/execution_delete_context.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ExecutionDeleteContextHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ExecutionDeleteContextHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/execution_get_suggestions.dart b/pkg/analysis_server/lib/src/handler/legacy/execution_get_suggestions.dart index 63765decbc8..7d2c7b40745 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/execution_get_suggestions.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/execution_get_suggestions.dart @@ -12,12 +12,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; class ExecutionGetSuggestionsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ExecutionGetSuggestionsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/execution_map_uri.dart b/pkg/analysis_server/lib/src/handler/legacy/execution_map_uri.dart index f1cf46a7146..457dbf8187b 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/execution_map_uri.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/execution_map_uri.dart @@ -14,12 +14,7 @@ import 'package:analyzer/file_system/file_system.dart'; class ExecutionMapUriHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ExecutionMapUriHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/execution_set_subscriptions.dart b/pkg/analysis_server/lib/src/handler/legacy/execution_set_subscriptions.dart index 307c309678c..646ab1c715d 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/execution_set_subscriptions.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/execution_set_subscriptions.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ExecutionSetSubscriptionsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ExecutionSetSubscriptionsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/flutter_get_widget_description.dart b/pkg/analysis_server/lib/src/handler/legacy/flutter_get_widget_description.dart index 7f6e10d6f0d..88092a6e843 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/flutter_get_widget_description.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/flutter_get_widget_description.dart @@ -13,12 +13,7 @@ import 'package:analyzer/dart/analysis/session.dart'; class FlutterGetWidgetDescriptionHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - FlutterGetWidgetDescriptionHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/flutter_set_subscriptions.dart b/pkg/analysis_server/lib/src/handler/legacy/flutter_set_subscriptions.dart index 4c374612f42..9dc0750cbe5 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/flutter_set_subscriptions.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/flutter_set_subscriptions.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/protocol/protocol_internal.dart'; class FlutterSetSubscriptionsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - FlutterSetSubscriptionsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/flutter_set_widget_property_value.dart b/pkg/analysis_server/lib/src/handler/legacy/flutter_set_widget_property_value.dart index afba9e6b43f..2a3cfa5e061 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/flutter_set_widget_property_value.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/flutter_set_widget_property_value.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class FlutterSetWidgetPropertyValueHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - FlutterSetWidgetPropertyValueHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/legacy_handler.dart b/pkg/analysis_server/lib/src/handler/legacy/legacy_handler.dart index 38d0a1470ba..0920aee8a36 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/legacy_handler.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/legacy_handler.dart @@ -20,12 +20,7 @@ import 'package:pub_semver/pub_semver.dart'; abstract class CompletionHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - CompletionHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); /// Return `true` if completion is disabled and the handler should return. If /// `true` is returned then a response will already have been returned, so @@ -61,12 +56,7 @@ abstract class LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - LegacyHandler( - this.server, - this.request, - this.cancellationToken, - this.performance, - ); + new(this.server, this.request, this.cancellationToken, this.performance); /// Whether this command records its own analytics and should be excluded from /// logging by the server. diff --git a/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart b/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart index 28f8f0e9356..83f101761bd 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/lsp_over_legacy_handler.dart @@ -18,12 +18,7 @@ import 'package:language_server_protocol/protocol_special.dart'; /// The handler for the `lsp.handle` request. class LspOverLegacyHandler extends LegacyHandler { - LspOverLegacyHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override bool get recordsOwnAnalytics => true; diff --git a/pkg/analysis_server/lib/src/handler/legacy/search_find_element_references.dart b/pkg/analysis_server/lib/src/handler/legacy/search_find_element_references.dart index 9e13b79628c..7c6de32a9da 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/search_find_element_references.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/search_find_element_references.dart @@ -15,12 +15,7 @@ import 'package:analyzer/dart/element/element.dart'; class SearchFindElementReferencesHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - SearchFindElementReferencesHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/search_find_member_declarations.dart b/pkg/analysis_server/lib/src/handler/legacy/search_find_member_declarations.dart index cce971b0766..6433245f6ed 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/search_find_member_declarations.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/search_find_member_declarations.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/protocol_server.dart' as protocol; class SearchFindMemberDeclarationsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - SearchFindMemberDeclarationsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/search_find_member_references.dart b/pkg/analysis_server/lib/src/handler/legacy/search_find_member_references.dart index 2cc25895679..8c0f1570688 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/search_find_member_references.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/search_find_member_references.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/protocol_server.dart' as protocol; class SearchFindMemberReferencesHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - SearchFindMemberReferencesHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/search_find_top_level_declarations.dart b/pkg/analysis_server/lib/src/handler/legacy/search_find_top_level_declarations.dart index 40dfaa073d7..89a6ee9945f 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/search_find_top_level_declarations.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/search_find_top_level_declarations.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/protocol_server.dart' as protocol; class SearchFindTopLevelDeclarationsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - SearchFindTopLevelDeclarationsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/search_get_element_declarations.dart b/pkg/analysis_server/lib/src/handler/legacy/search_get_element_declarations.dart index 0ee4d48012f..989036dbcd6 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/search_get_element_declarations.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/search_get_element_declarations.dart @@ -14,12 +14,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart' as protocol; class SearchGetElementDeclarationsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - SearchGetElementDeclarationsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/search_get_type_hierarchy.dart b/pkg/analysis_server/lib/src/handler/legacy/search_get_type_hierarchy.dart index 9e71c7d07ce..11e37dd04a1 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/search_get_type_hierarchy.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/search_get_type_hierarchy.dart @@ -13,12 +13,7 @@ import 'package:analysis_server/src/search/type_hierarchy.dart'; class SearchGetTypeHierarchyHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - SearchGetTypeHierarchyHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/server_cancel_request.dart b/pkg/analysis_server/lib/src/handler/legacy/server_cancel_request.dart index 204fd36fdfa..52482f551eb 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/server_cancel_request.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/server_cancel_request.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ServerCancelRequestHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ServerCancelRequestHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/server_get_version.dart b/pkg/analysis_server/lib/src/handler/legacy/server_get_version.dart index abf61ffbc56..1aabedde0e1 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/server_get_version.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/server_get_version.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ServerGetVersionHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ServerGetVersionHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/server_set_client_capabilities.dart b/pkg/analysis_server/lib/src/handler/legacy/server_set_client_capabilities.dart index 563574cd86f..810998c161b 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/server_set_client_capabilities.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/server_set_client_capabilities.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ServerSetClientCapabilitiesHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ServerSetClientCapabilitiesHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/server_set_subscriptions.dart b/pkg/analysis_server/lib/src/handler/legacy/server_set_subscriptions.dart index ffe9162bc5c..0888fa7bb82 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/server_set_subscriptions.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/server_set_subscriptions.dart @@ -12,12 +12,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ServerSetSubscriptionsHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ServerSetSubscriptionsHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/server_shutdown.dart b/pkg/analysis_server/lib/src/handler/legacy/server_shutdown.dart index 7b034ede632..bfa7e5aa4ee 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/server_shutdown.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/server_shutdown.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class ServerShutdownHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - ServerShutdownHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/handler/legacy/unsupported_request.dart b/pkg/analysis_server/lib/src/handler/legacy/unsupported_request.dart index 470a0a3c619..7eb1bab11e1 100644 --- a/pkg/analysis_server/lib/src/handler/legacy/unsupported_request.dart +++ b/pkg/analysis_server/lib/src/handler/legacy/unsupported_request.dart @@ -11,12 +11,7 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart'; class UnsupportedRequestHandler extends LegacyHandler { /// Initialize a newly created handler to be able to service requests for the /// [server]. - UnsupportedRequestHandler( - super.server, - super.request, - super.cancellationToken, - super.performance, - ); + new(super.server, super.request, super.cancellationToken, super.performance); @override Future handle() async { diff --git a/pkg/analysis_server/lib/src/legacy_analysis_server.dart b/pkg/analysis_server/lib/src/legacy_analysis_server.dart index 4b30a4a4635..bfea47b59db 100644 --- a/pkg/analysis_server/lib/src/legacy_analysis_server.dart +++ b/pkg/analysis_server/lib/src/legacy_analysis_server.dart @@ -382,7 +382,7 @@ class LegacyAnalysisServer extends AnalysisServer { /// Initialize a newly created server to receive requests from and send /// responses to the given [channel]. - LegacyAnalysisServer( + new( this.channel, ResourceProvider baseResourceProvider, AnalysisServerOptions options, @@ -1228,7 +1228,7 @@ class ServerContextManagerCallbacks @override final LegacyAnalysisServer analysisServer; - ServerContextManagerCallbacks(this.analysisServer, super.resourceProvider); + new(this.analysisServer, super.resourceProvider); AbstractNotificationManager get _notificationManager => analysisServer.notificationManager; @@ -1401,7 +1401,7 @@ class ServerException { final StackTrace stackTrace; final bool fatal; - ServerException(this.message, this.exception, this.stackTrace, this.fatal); + new(this.message, this.exception, this.stackTrace, this.fatal); @override String toString() => message; diff --git a/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart b/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart index c5250158025..7d75e4c7fd4 100644 --- a/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart +++ b/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart @@ -33,7 +33,7 @@ class LspByteStreamServerChannel implements LspServerCommunicationChannel { /// True if [close] has been called. bool _closeRequested = false; - LspByteStreamServerChannel( + new( this._input, this._output, this._instrumentationService, { diff --git a/pkg/analysis_server/lib/src/lsp/client_capabilities.dart b/pkg/analysis_server/lib/src/lsp/client_capabilities.dart index 93b825704c0..0e119046531 100644 --- a/pkg/analysis_server/lib/src/lsp/client_capabilities.dart +++ b/pkg/analysis_server/lib/src/lsp/client_capabilities.dart @@ -113,7 +113,7 @@ class LspClientCapabilities { /// User-friendly error messages from parsing the experimental capabilities. final List experimentalCapabilitiesErrors; - factory LspClientCapabilities(ClientCapabilities raw) { + factory(ClientCapabilities raw) { var workspace = raw.workspace; var workspaceEdit = workspace?.workspaceEdit; var resourceOperations = workspaceEdit?.resourceOperations; @@ -231,7 +231,7 @@ class LspClientCapabilities { ); } - LspClientCapabilities._( + new _( this.raw, { required this.documentChanges, required this.changeAnnotations, @@ -294,7 +294,7 @@ class _ExperimentalClientCapabilities { final Set commands; final bool showMessageRequest; - _ExperimentalClientCapabilities({ + new({ required this.snippetTextEdit, required this.commandParameterKinds, required this.commands, @@ -310,7 +310,7 @@ class _ExperimentalClientCapabilities { /// carefully and report a warning to the client if something looks wrong. /// /// Example: https://github.com/dart-lang/sdk/issues/55935 - factory _ExperimentalClientCapabilities.parse(Object? raw) { + factory parse(Object? raw) { var errors = []; /// Helper to ensure [object] is type [T] and otherwise records an error in diff --git a/pkg/analysis_server/lib/src/lsp/client_configuration.dart b/pkg/analysis_server/lib/src/lsp/client_configuration.dart index 2883b3d0bc0..3b7f7c048a5 100644 --- a/pkg/analysis_server/lib/src/lsp/client_configuration.dart +++ b/pkg/analysis_server/lib/src/lsp/client_configuration.dart @@ -37,7 +37,7 @@ class LspClientCodeLensConfiguration { final bool? _boolean; final Map? _map; - LspClientCodeLensConfiguration(Object? userPreference) + new(Object? userPreference) : _boolean = userPreference is bool ? userPreference : null, _map = userPreference is Map ? userPreference : null; @@ -92,7 +92,7 @@ class LspClientConfiguration { /// client (in WorkspaceFolder URIs) for consistent comparisons. final _trailingSlashPattern = RegExp(r'[\/]+$'); - LspClientConfiguration(this.pathContext); + new(this.pathContext); /// Returns the global configuration for the whole workspace. LspGlobalClientConfiguration get global => _globalSettings; @@ -200,7 +200,7 @@ class LspClientInlayHintsConfiguration { late bool _typeArguments; late bool _variableTypes; - LspClientInlayHintsConfiguration(Object? userPreference) { + new(Object? userPreference) { var map = userPreference is Map ? userPreference : null; var boolean = userPreference is bool ? userPreference : null; @@ -275,8 +275,7 @@ class LspGlobalClientConfiguration extends LspResourceClientConfiguration { _settings['inlayHints'], ); - LspGlobalClientConfiguration(Map settings) - : super(settings, null); + new(Map settings) : super(settings, null); List get analysisExcludedFolders { // This setting is documented as a string array, but because editors are @@ -374,7 +373,7 @@ class LspResourceClientConfiguration { final Map _settings; final LspResourceClientConfiguration? _fallback; - LspResourceClientConfiguration(this._settings, this._fallback); + new(this._settings, this._fallback); /// Whether to enable the SDK formatter. /// diff --git a/pkg/analysis_server/lib/src/lsp/completion_utils.dart b/pkg/analysis_server/lib/src/lsp/completion_utils.dart index bf86313cfde..5ce5b5b3433 100644 --- a/pkg/analysis_server/lib/src/lsp/completion_utils.dart +++ b/pkg/analysis_server/lib/src/lsp/completion_utils.dart @@ -797,5 +797,5 @@ class _ElementDocumentation { final String full; final String? summary; - _ElementDocumentation({required this.full, required this.summary}); + new({required this.full, required this.summary}); } diff --git a/pkg/analysis_server/lib/src/lsp/error_or.dart b/pkg/analysis_server/lib/src/lsp/error_or.dart index 0dab6caa1c6..573c5729239 100644 --- a/pkg/analysis_server/lib/src/lsp/error_or.dart +++ b/pkg/analysis_server/lib/src/lsp/error_or.dart @@ -34,9 +34,9 @@ ErrorOr success(R t) => ErrorOr.success(t); /// /// Contains a helpers to assist in chaining operations while propagating errors. class ErrorOr extends Either2 { - ErrorOr.error(super.error) : super.t1(); + new error(super.error) : super.t1(); - ErrorOr.success(super.result) : super.t2(); + new success(super.result) : super.t2(); /// Returns the error or throws if object is not an error. Check [isError] /// before accessing [error]. diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/abstract_code_actions_producer.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/abstract_code_actions_producer.dart index 4c744a59ce2..7295f2c9ada 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/abstract_code_actions_producer.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/abstract_code_actions_producer.dart @@ -78,7 +78,7 @@ abstract class AbstractCodeActionsProducer /// directly. final bool allowCodeActionLiterals; - AbstractCodeActionsProducer( + new( this.server, this.file, this.lineInfo, { diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/analysis_options.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/analysis_options.dart index 4187f17d40c..83dd8aa199f 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/analysis_options.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/analysis_options.dart @@ -19,7 +19,7 @@ import 'package:yaml/yaml.dart'; /// Produces [CodeActionLiteral]s from analysis options fixes. class AnalysisOptionsCodeActionsProducer extends AbstractCodeActionsProducer { - AnalysisOptionsCodeActionsProducer( + new( super.server, super.file, super.lineInfo, { diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/code_action_computer.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/code_action_computer.dart index a76f4db4861..13bfb923f67 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/code_action_computer.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/code_action_computer.dart @@ -89,7 +89,7 @@ class CodeActionComputer with HandlerHelperMixin { /// This set is ignored if the caller provided an explicit filter in [only]. final Set? supportedKinds; - CodeActionComputer( + new( this.server, this.textDocument, this.range, { @@ -360,7 +360,7 @@ class CodeActionComputer with HandlerHelperMixin { class _CodeActionSorter { final Range range; - _CodeActionSorter(this.range); + new(this.range); List sort(List actions) { var dedupedActions = _dedupeActions(actions, range.start); diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/dart.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/dart.dart index 61fa1b3f054..9a9ff03ce8d 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/dart.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/dart.dart @@ -40,7 +40,7 @@ class DartCodeActionsProducer extends AbstractCodeActionsProducer { final CodeActionTriggerKind? triggerKind; final bool willBeDeduplicated; - DartCodeActionsProducer( + new( super.server, super.file, super.lineInfo, diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/plugins.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/plugins.dart index 90d4d38a687..a8c4d0a9055 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/plugins.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/plugins.dart @@ -18,7 +18,7 @@ import 'package:collection/collection.dart'; class PluginCodeActionsProducer extends AbstractCodeActionsProducer { final AnalysisDriver? _driver; - PluginCodeActionsProducer( + new( super.server, super.file, super.lineInfo, { diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/pubspec.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/pubspec.dart index 9e90e241e13..211f1029848 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_actions/pubspec.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_actions/pubspec.dart @@ -16,7 +16,7 @@ import 'package:yaml/yaml.dart'; /// Produces [CodeActionLiteral]s from Pubspec fixes. class PubspecCodeActionsProducer extends AbstractCodeActionsProducer { - PubspecCodeActionsProducer( + new( super.server, super.file, super.lineInfo, { diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_lens/abstract_code_lens_provider.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_lens/abstract_code_lens_provider.dart index 21bc513a242..0bf4927a731 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_lens/abstract_code_lens_provider.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_lens/abstract_code_lens_provider.dart @@ -21,7 +21,7 @@ abstract class AbstractCodeLensProvider @override final AnalysisServer server; - AbstractCodeLensProvider(this.server); + new(this.server); /// Whether the client supports the `dart.goToLocation` command, as produced /// by [getNavigationCommand]. diff --git a/pkg/analysis_server/lib/src/lsp/handlers/code_lens/augmentations.dart b/pkg/analysis_server/lib/src/lsp/handlers/code_lens/augmentations.dart index 5b46bc98169..d52b6c34d47 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/code_lens/augmentations.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/code_lens/augmentations.dart @@ -15,7 +15,7 @@ import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/src/util/performance/operation_performance.dart'; class AugmentationCodeLensProvider extends AbstractCodeLensProvider { - AugmentationCodeLensProvider(super.server); + new(super.server); LspClientCodeLensConfiguration get codeLens => server.lspClientConfiguration.global.codeLens; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart index 63bcc0f1299..b2f872ba50a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart @@ -25,7 +25,7 @@ final _manager = LspRefactorManager._(); abstract class AbstractRefactorCommandHandler extends SimpleEditCommandHandler with PositionalArgCommandHandler { - AbstractRefactorCommandHandler(super.server); + new(super.server); @override String get commandName => 'Perform Refactor'; @@ -253,7 +253,7 @@ class LspRefactorManager { /// The cancellation token for the current in-progress refactor (or null). CancelableToken? _currentRefactoringCancellationToken; - LspRefactorManager._(); + new _(); /// Begins a new refactor, cancelling any other in-progress refactors. void begin(CancelableToken cancelToken) { diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/apply_code_action.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/apply_code_action.dart index 7d02488ac17..242f71369e6 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/apply_code_action.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/apply_code_action.dart @@ -25,7 +25,7 @@ import 'package:language_server_protocol/json_parsing.dart'; /// and can easily change - the server only needs to be consistent with itself. class ApplyCodeActionCommandHandler extends SimpleEditCommandHandler { - ApplyCodeActionCommandHandler(super.server); + new(super.server); @override String get commandName => 'Apply Code Action'; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart index b8a7333b121..98771db9681 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all.dart @@ -18,7 +18,7 @@ import 'package:analysis_server/src/services/correction/bulk_fix_processor.dart' import 'package:analysis_server/src/utilities/source_change_merger.dart'; class FixAllCommandHandler extends SimpleEditCommandHandler { - FixAllCommandHandler(super.server); + new(super.server); @override String get commandName => 'Fix All'; @@ -96,7 +96,7 @@ class _FixAllOperation extends TemporaryOverlayOperation final String path; final bool autoTriggered; - _FixAllOperation({ + new({ required AnalysisServer server, required this.message, required this.path, diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all_in_workspace.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all_in_workspace.dart index 96e43f6b96a..7d4d272d35b 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all_in_workspace.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/fix_all_in_workspace.dart @@ -16,7 +16,7 @@ import 'package:analysis_server_plugin/src/correction/dart_change_workspace.dart abstract class AbstractFixAllInWorkspaceCommandHandler extends SimpleEditCommandHandler { - AbstractFixAllInWorkspaceCommandHandler(super.server); + new(super.server); /// Whether to require confirmation from the user to apply these changes. /// @@ -92,7 +92,7 @@ abstract class AbstractFixAllInWorkspaceCommandHandler class FixAllInWorkspaceCommandHandler extends AbstractFixAllInWorkspaceCommandHandler { - FixAllInWorkspaceCommandHandler(super.server); + new(super.server); @override String get commandName => 'Apply All Fixes in Workspace'; @@ -103,7 +103,7 @@ class FixAllInWorkspaceCommandHandler class PreviewFixAllInWorkspaceCommandHandler extends AbstractFixAllInWorkspaceCommandHandler { - PreviewFixAllInWorkspaceCommandHandler(super.server); + new(super.server); @override String get commandName => 'Preview All Fixes in Workspace'; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/log_action.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/log_action.dart index be82642a0cf..530392db07b 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/log_action.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/log_action.dart @@ -10,7 +10,7 @@ import 'package:analysis_server/src/lsp/progress.dart'; class LogActionCommandHandler extends CommandHandler { - LogActionCommandHandler(super.server); + new(super.server); @override bool get recordsOwnAnalytics => true; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart index b47d8e970fa..daa2e00810a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart @@ -11,7 +11,7 @@ import 'package:analysis_server/src/lsp/progress.dart'; import 'package:analysis_server/src/services/correction/organize_imports.dart'; class OrganizeImportsCommandHandler extends SimpleEditCommandHandler { - OrganizeImportsCommandHandler(super.server); + new(super.server); @override String get commandName => 'Organize Imports'; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart index 94af0680624..4d073b72072 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart @@ -23,7 +23,7 @@ class PerformRefactorCommandHandler extends AbstractRefactorCommandHandler { @visibleForTesting static Future? delayAfterResolveForTests; - PerformRefactorCommandHandler(super.server); + new(super.server); @override String get commandName => 'Perform Refactor'; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/refactor_command_executor.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/refactor_command_executor.dart index eb6e22ef68b..1cdf2c95fa6 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/refactor_command_executor.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/refactor_command_executor.dart @@ -28,7 +28,7 @@ class RefactorCommandExecutor extends SimpleEditCommandHandler final RefactoringProducerGenerator generator; - RefactorCommandExecutor(super.server, this.commandName, this.generator); + new(super.server, this.commandName, this.generator); @override bool get requiresTrustedCaller => false; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart index 2c1c750db45..66721cec8a0 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/send_workspace_edit.dart @@ -17,7 +17,7 @@ import 'package:analysis_server/src/lsp/progress.dart'; /// args and when the client calls the server to execute that command, the server /// will call the client to execute workspace/applyEdit. class SendWorkspaceEditCommandHandler extends SimpleEditCommandHandler { - SendWorkspaceEditCommandHandler(super.server); + new(super.server); @override String get commandName => 'Send Workspace Edit'; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart index 809a888d93f..effd72408e4 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/simple_edit_handler.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart'; abstract class SimpleEditCommandHandler extends CommandHandler { - SimpleEditCommandHandler(super.server); + new(super.server); String get commandName; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart index 310fa9a5961..48683f80c4d 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart @@ -12,7 +12,7 @@ import 'package:analysis_server/src/services/correction/sort_members.dart'; import 'package:analyzer/dart/analysis/results.dart'; class SortMembersCommandHandler extends SimpleEditCommandHandler { - SortMembersCommandHandler(super.server); + new(super.server); @override String get commandName => 'Sort Members'; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/commands/validate_refactor.dart b/pkg/analysis_server/lib/src/lsp/handlers/commands/validate_refactor.dart index 2f8da420ee1..687d32f72e2 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/commands/validate_refactor.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/commands/validate_refactor.dart @@ -16,7 +16,7 @@ import 'package:analyzer/dart/analysis/session.dart'; /// A handler that validates arguments for legacy refactors such as /// EXTRACT_WIDGET. class ValidateRefactorCommandHandler extends AbstractRefactorCommandHandler { - ValidateRefactorCommandHandler(super.server); + new(super.server); @override String get commandName => 'Validate Refactor'; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart index 9e1a40b89e4..cbda314fde4 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart @@ -27,7 +27,7 @@ import 'package:collection/collection.dart'; class EditArgumentHandler extends SharedMessageHandler with EditableArgumentsMixin { - EditArgumentHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.dartTextDocumentEditArgument; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_editable_arguments.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_editable_arguments.dart index db5c427adc7..5ce44ccf850 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_editable_arguments.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_editable_arguments.dart @@ -23,7 +23,7 @@ typedef _Values = ({DartObject? parameterValue, DartObject? argumentValue}); class EditableArgumentsHandler extends SharedMessageHandler with EditableArgumentsMixin { - EditableArgumentsHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.dartTextDocumentEditableArguments; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart index 694222b520c..826b8c4629e 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart @@ -11,7 +11,7 @@ import 'package:analyzer/src/dart/ast/ast.dart' as ast; class AugmentationHandler extends SharedMessageHandler { - AugmentationHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.augmentation; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmented.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmented.dart index 830c3109d9b..fe401fd6f49 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmented.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmented.dart @@ -11,7 +11,7 @@ import 'package:analyzer/src/dart/ast/ast.dart' as ast; class AugmentedHandler extends SharedMessageHandler { - AugmentedHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.augmented; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_connect_to_dtd.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_connect_to_dtd.dart index 0b96356e4b0..a312edce3e8 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_connect_to_dtd.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_connect_to_dtd.dart @@ -19,7 +19,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; /// to the protocol over stdin/stdout). class ConnectToDtdHandler extends SharedMessageHandler { - ConnectToDtdHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.connectToDtd; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart index a1d2e2ec082..4507ad6ae38 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_diagnostic_server.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; class DiagnosticServerHandler extends SharedMessageHandler { - DiagnosticServerHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.diagnosticServer; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_experimental_echo.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_experimental_echo.dart index df3e3a747fe..1f8eea1981a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_experimental_echo.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_experimental_echo.dart @@ -11,7 +11,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; /// This handler is used by the servers automated tests but can also be used for /// client testing (if they opt-in to experimental handlers). class ExperimentalEchoHandler extends SharedMessageHandler { - ExperimentalEchoHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.experimentalEcho; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_get_widget_previews.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_get_widget_previews.dart index ec706ef27ad..e21addcf475 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_get_widget_previews.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_get_widget_previews.dart @@ -12,7 +12,7 @@ import 'package:analyzer/dart/analysis/results.dart'; class FlutterWidgetPreviewsHandler extends SharedMessageHandler { - FlutterWidgetPreviewsHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.getFlutterWidgetPreviews; @@ -95,7 +95,7 @@ class FlutterWidgetPreviewsHandler class WorkspaceFlutterWidgetPreviewsHandler extends SharedMessageHandler { - WorkspaceFlutterWidgetPreviewsHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.getWorkspaceFlutterWidgetPreviews; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_imports.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_imports.dart index 8dd973b9b00..feec159e4f2 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_imports.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_imports.dart @@ -16,7 +16,7 @@ import 'package:analyzer/src/utilities/extensions/results.dart'; class ImportsHandler extends SharedMessageHandler?> { - ImportsHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.imports; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_migrate.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_migrate.dart index 6f3ac7cf98e..998c2476bad 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_migrate.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_migrate.dart @@ -17,7 +17,7 @@ import 'package:yaml/yaml.dart'; class MigrateHandler extends SharedMessageHandler { - MigrateHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.migrate; @@ -198,6 +198,6 @@ class _PubspecTarget { /// name in `pubspec.yaml`, or the parent directory name as a fallback. final String displayName; - _PubspecTarget({required this.file, required YamlMap pubspec}) + new({required this.file, required YamlMap pubspec}) : displayName = (pubspec['name'] as String?) ?? file.parent.shortName; } diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart index 960baf8f9fc..198a3630024 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_reanalyze.dart @@ -10,7 +10,7 @@ import 'package:analysis_server/src/lsp/error_or.dart'; import 'package:analysis_server/src/lsp/handlers/handlers.dart'; class ReanalyzeHandler extends LspMessageHandler { - ReanalyzeHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.reanalyze; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart index c4db639e5a3..fba67ce65a3 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart @@ -14,7 +14,7 @@ import 'package:analyzer/dart/element/type.dart'; class SummaryHandler extends SharedMessageHandler { - SummaryHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.summary; @@ -66,7 +66,7 @@ class SummaryWriter { final StringBuffer buffer = StringBuffer(); - SummaryWriter(this.result); + new(this.result); String summarize() { var libraryElement = result.element; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_super.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_super.dart index 4c83424dc38..26506f996b8 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_super.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_super.dart @@ -14,7 +14,7 @@ import 'package:analyzer/src/dart/ast/element_locator.dart'; class SuperHandler extends SharedMessageHandler { - SuperHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.super_; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_update_diagnostic_information.dart b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_update_diagnostic_information.dart index 100d800cd01..567487f0075 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_update_diagnostic_information.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/custom/handler_update_diagnostic_information.dart @@ -15,7 +15,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; /// report. class UpdateDiagnosticInformationHandler extends SharedMessageHandler?, void> { - UpdateDiagnosticInformationHandler(super.server); + new(super.server); @override Method get handlesMessage => CustomMethods.updateDiagnosticInformation; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart index e0866798c29..d61f3072a2d 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart @@ -23,7 +23,7 @@ typedef StaticOptions = class CallHierarchyRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - CallHierarchyRegistrations(super.info); + new(super.info); @override ToJsonable? get options => @@ -49,7 +49,7 @@ class IncomingCallHierarchyHandler CallHierarchyIncomingCall > with _CallHierarchyUtils { - IncomingCallHierarchyHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.callHierarchy_incomingCalls; @@ -121,7 +121,7 @@ class OutgoingCallHierarchyHandler CallHierarchyOutgoingCall > with _CallHierarchyUtils { - OutgoingCallHierarchyHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.callHierarchy_outgoingCalls; @@ -200,7 +200,7 @@ class PrepareCallHierarchyHandler TextDocumentPrepareCallHierarchyResult > with _CallHierarchyUtils { - PrepareCallHierarchyHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_prepareCallHierarchy; @@ -277,7 +277,7 @@ class PrepareCallHierarchyHandler abstract class _AbstractCallHierarchyCallsHandler extends SharedMessageHandler with _CallHierarchyUtils { - _AbstractCallHierarchyCallsHandler(super.server); + new(super.server); /// Gets the appropriate types of calls for this handler. Future> getCalls( diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart index 8d32ccca645..da3527f0d13 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_cancel_request.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; class CancelRequestHandler extends SharedMessageHandler { final Map _tokens = {}; - CancelRequestHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.cancelRequest; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart index d97fa72693d..20d4dd48636 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_change_workspace_folders.dart @@ -14,7 +14,7 @@ class ChangeWorkspaceFoldersHandler // Whether to update analysis roots based on the open workspace folders. bool updateAnalysisRoots; - ChangeWorkspaceFoldersHandler(super.server) + new(super.server) : updateAnalysisRoots = !server.onlyAnalyzeProjectsWithOpenFiles; @override @@ -60,7 +60,7 @@ class ChangeWorkspaceFoldersHandler class ChangeWorkspaceFoldersRegistrations extends FeatureRegistration with StaticRegistration { - ChangeWorkspaceFoldersRegistrations(super.info); + new(super.info); @override List get dynamicRegistrations => []; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart index f2f1d24091d..5e5acf3775a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_actions.dart @@ -16,7 +16,7 @@ typedef StaticOptions = Either2; class CodeActionHandler extends SharedMessageHandler { - CodeActionHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_codeAction; @@ -68,7 +68,7 @@ class CodeActionHandler class CodeActionRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - CodeActionRegistrations(super.info); + new(super.info); bool get codeActionLiteralSupport => clientCapabilities.literalCodeActions; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_lens.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_lens.dart index 56c17051cb0..d2341d7ff80 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_code_lens.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_code_lens.dart @@ -13,7 +13,7 @@ class CodeLensHandler extends SharedMessageHandler> { final List codeLensProviders; - CodeLensHandler(super.server) + new(super.server) : codeLensProviders = [AugmentationCodeLensProvider(server)]; @override @@ -68,7 +68,7 @@ class CodeLensRegistrations extends FeatureRegistration @override final staticOptions = CodeLensOptions(); - CodeLensRegistrations(super.info); + new(super.info); @override Method get registrationMethod => Method.textDocument_codeLens; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart index 14fad82e197..e697a36da38 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart @@ -67,7 +67,7 @@ class CompletionHandler /// already completed, cancelling this token will not do anything. CancelableToken? previousRequestCancellationToken; - CompletionHandler(super.server) + new(super.server) : suggestFromUnimportedLibraries = server.initializationOptions?.suggestFromUnimportedLibraries ?? true { var budgetMs = server.initializationOptions?.completionBudgetMilliseconds; @@ -860,7 +860,7 @@ class CompletionHandler class CompletionRegistrations extends FeatureRegistration with StaticRegistration { - CompletionRegistrations(super.info); + new(super.info); @override List get dynamicRegistrations { @@ -944,7 +944,7 @@ class _CompletionResults { /// Defaults are only supported on Dart server items (not plugins). final CompletionItemDefaults? defaults; - _CompletionResults({ + new({ this.rankedItems = const [], this.unrankedItems = const [], required this.fuzzy, @@ -952,21 +952,18 @@ class _CompletionResults { this.defaults, }); - _CompletionResults.empty() - : this(fuzzy: _FuzzyScoreHelper.empty, isIncomplete: false); + new empty() : this(fuzzy: _FuzzyScoreHelper.empty, isIncomplete: false); /// An empty result set marked as incomplete because an error occurred. - _CompletionResults.emptyIncomplete() + new emptyIncomplete() : this(fuzzy: _FuzzyScoreHelper.empty, isIncomplete: true); - _CompletionResults.unranked( - List unrankedItems, { - required bool isIncomplete, - }) : this( - unrankedItems: unrankedItems, - fuzzy: _FuzzyScoreHelper.empty, - isIncomplete: isIncomplete, - ); + new unranked(List unrankedItems, {required bool isIncomplete}) + : this( + unrankedItems: unrankedItems, + fuzzy: _FuzzyScoreHelper.empty, + isIncomplete: isIncomplete, + ); /// Any prefix used to filter the results. String get targetPrefix => fuzzy.prefix; @@ -984,7 +981,7 @@ class _FuzzyScoreHelper { final FuzzyMatcher _matcher; - _FuzzyScoreHelper(this.prefix) : _matcher = FuzzyMatcher(prefix); + new(this.prefix) : _matcher = FuzzyMatcher(prefix); bool completionItemMatches(CompletionItem item) => stringMatches(item.filterText ?? item.label); diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart index d8e32957eed..3e5135c45ce 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart @@ -24,7 +24,7 @@ class CompletionResolveHandler /// cancel events). CompletionItem? _latestCompletionItem; - CompletionResolveHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.completionItem_resolve; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_definition.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_definition.dart index aed57c1745f..a93b3e31c77 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_definition.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_definition.dart @@ -30,7 +30,7 @@ class DefinitionHandler TextDocumentDefinitionResult > with LspPluginRequestHandlerMixin { - DefinitionHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_definition; @@ -350,7 +350,7 @@ class DefinitionHandler class DefinitionRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - DefinitionRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color.dart index 518fb1020d5..24b54ac97ad 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color.dart @@ -26,7 +26,7 @@ typedef StaticOptions = /// [DocumentColorPresentationHandler]). class DocumentColorHandler extends SharedMessageHandler> { - DocumentColorHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_documentColor; @@ -75,7 +75,7 @@ class DocumentColorHandler class DocumentColorRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - DocumentColorRegistrations(super.info); + new(super.info); @override DocumentColorRegistrationOptions get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color_presentation.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color_presentation.dart index 63165ffc9e8..3a2a7922a70 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color_presentation.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_color_presentation.dart @@ -26,7 +26,7 @@ class DocumentColorPresentationHandler /// from numbers formatted for code. final _trailingZerosAndPeriodPattern = RegExp(r'\.?0+$'); - DocumentColorPresentationHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_colorPresentation; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_highlights.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_highlights.dart index bce41beb337..d09a5547b66 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_highlights.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_highlights.dart @@ -17,7 +17,7 @@ class DocumentHighlightsHandler TextDocumentPositionParams, List > { - DocumentHighlightsHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_documentHighlight; @@ -69,7 +69,7 @@ class DocumentHighlightsHandler class DocumentHighlightsRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - DocumentHighlightsRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_link.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_link.dart index 38286065669..7b2005abe56 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_link.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_link.dart @@ -20,7 +20,7 @@ import 'package:analyzer_plugin/src/utilities/navigation/document_links.dart'; class DocumentLinkHandler extends LspMessageHandler?> with LspPluginRequestHandlerMixin { - DocumentLinkHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_documentLink; @@ -135,7 +135,7 @@ class DocumentLinkHandler class DocumentLinkRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - DocumentLinkRegistrations(super.info); + new(super.info); @override ToJsonable? get options => DocumentLinkRegistrationOptions( diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_symbols.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_symbols.dart index dbfba8b6b3f..34497f7f63c 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_document_symbols.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_document_symbols.dart @@ -21,7 +21,7 @@ class DocumentSymbolHandler DocumentSymbolParams, TextDocumentDocumentSymbolResult > { - DocumentSymbolHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_documentSymbol; @@ -157,7 +157,7 @@ class DocumentSymbolHandler class DocumentSymbolsRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - DocumentSymbolsRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart index 7e91840fc39..987f51dd794 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_execute_command.dart @@ -31,7 +31,7 @@ class ExecuteCommandHandler final Map> commandHandlers; - ExecuteCommandHandler(super.server) + new(super.server) : commandHandlers = { // Commands that can run for any underlying server type. Commands.sortMembers: SortMembersCommandHandler(server), @@ -132,7 +132,7 @@ class ExecuteCommandHandler class ExecuteCommandRegistrations extends FeatureRegistration with StaticRegistration { - ExecuteCommandRegistrations(super.info); + new(super.info); @override List get dynamicRegistrations => []; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart index 935ae009462..fa85f96827a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_exit.dart @@ -12,7 +12,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; class ExitMessageHandler extends LspMessageHandler { final bool clientDidCallShutdown; - ExitMessageHandler(super.server, {this.clientDidCallShutdown = false}); + new(super.server, {this.clientDidCallShutdown = false}); @override Method get handlesMessage => Method.exit; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_folding.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_folding.dart index 65f254c4da3..5393f26f09a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_folding.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_folding.dart @@ -16,7 +16,7 @@ typedef StaticOptions = class FoldingHandler extends LspMessageHandler> { - FoldingHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_foldingRange; @@ -145,7 +145,7 @@ class FoldingHandler class FoldingRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - FoldingRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart index b2d6c6262a0..c0413aef043 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart @@ -18,7 +18,7 @@ typedef StaticOptions = DocumentOnTypeFormattingOptions?; class FormatOnTypeHandler extends SharedMessageHandler?> { - FormatOnTypeHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_onTypeFormatting; @@ -160,7 +160,7 @@ class FormatOnTypeHandler class FormatOnTypeRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - FormatOnTypeRegistrations(super.info); + new(super.info); bool get enableFormatter => clientConfiguration.global.enableSdkFormatter; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart index a8211420993..fb571aa476d 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart @@ -15,7 +15,7 @@ typedef StaticOptions = Either2; class FormatRangeHandler extends SharedMessageHandler?> { - FormatRangeHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_rangeFormatting; @@ -74,7 +74,7 @@ class FormatRangeHandler class FormatRangeRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - FormatRangeRegistrations(super.info); + new(super.info); bool get enableFormatter => clientConfiguration.global.enableSdkFormatter; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart index 90dfd814975..cf68911b392 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart @@ -14,7 +14,7 @@ typedef StaticOptions = Either2; class FormattingHandler extends SharedMessageHandler?> { - FormattingHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_formatting; @@ -69,7 +69,7 @@ class FormattingHandler class FormattingRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - FormattingRegistrations(super.info); + new(super.info); bool get enableFormatter => clientConfiguration.global.enableSdkFormatter; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_hover.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_hover.dart index e1f8dfa9832..5b71b981cdb 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_hover.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_hover.dart @@ -18,7 +18,7 @@ typedef StaticOptions = Either2; class HoverHandler extends SharedMessageHandler { - HoverHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_hover; @@ -146,7 +146,7 @@ class HoverHandler class HoverRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - HoverRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_implementation.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_implementation.dart index fea3637ab15..97725f0ff9b 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_implementation.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_implementation.dart @@ -19,7 +19,7 @@ typedef StaticOptions = class ImplementationHandler extends SharedMessageHandler> { - ImplementationHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_implementation; @@ -126,7 +126,7 @@ class ImplementationHandler class ImplementationRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - ImplementationRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart index 103b505a720..9d196bbd234 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart @@ -10,7 +10,7 @@ import 'package:analyzer/src/util/platform_info.dart'; class InitializeMessageHandler extends LspMessageHandler { - InitializeMessageHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.initialize; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart index 201c5a0957f..0f19108954e 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialized.dart @@ -10,7 +10,7 @@ import 'package:analysis_server/src/lsp/handlers/handlers.dart'; class InitializedMessageHandler extends LspMessageHandler { final List openWorkspacePaths; - InitializedMessageHandler(super.server, this.openWorkspacePaths); + new(super.server, this.openWorkspacePaths); @override Method get handlesMessage => Method.initialized; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_inlay_hint.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_inlay_hint.dart index 3b1fb4b50f9..de3a31c8e21 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_inlay_hint.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_inlay_hint.dart @@ -14,7 +14,7 @@ typedef StaticOptions = class InlayHintHandler extends LspMessageHandler> { - InlayHintHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_inlayHint; @@ -67,7 +67,7 @@ class InlayHintHandler class InlayHintRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - InlayHintRegistrations(super.info); + new(super.info); @override ToJsonable? get options => InlayHintRegistrationOptions( diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart index 48016de66f2..c875217d464 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart @@ -24,7 +24,7 @@ typedef StaticOptions = class InlineValueHandler extends SharedMessageHandler { - InlineValueHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_inlineValue; @@ -104,7 +104,7 @@ class InlineValueHandler class InlineValueRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - InlineValueRegistrations(super.info); + new(super.info); @override ToJsonable? get options => @@ -143,7 +143,7 @@ class _InlineValueCollector { /// locations provided by the client. final LineInfo lineInfo; - _InlineValueCollector( + new( this.lineInfo, { required this.rangeAlreadyExecuted, required this.rangeIncludingCurrentLine, @@ -270,7 +270,7 @@ class _InlineValueVisitor extends GeneralizingAstVisitor { /// avoid showing inline values in other branches. final int currentExecutionOffset; - _InlineValueVisitor( + new( this.clientConfiguration, this.collector, this.rootNode, diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart index 91f593cc00e..54a6135dd34 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_references.dart @@ -20,7 +20,7 @@ typedef StaticOptions = Either2; class ReferencesHandler extends LspMessageHandler?> { - ReferencesHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_references; @@ -139,7 +139,7 @@ class ReferencesHandler class ReferencesRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - ReferencesRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart index 2dd92b49e3f..2a59494d9b7 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_reject.dart @@ -14,12 +14,7 @@ class RejectMessageHandler extends SharedMessageHandler { final ErrorCodes errorCode; final String errorMessage; - RejectMessageHandler( - super.server, - this.handlesMessage, - this.errorCode, - this.errorMessage, - ); + new(super.server, this.handlesMessage, this.errorCode, this.errorMessage); @override LspJsonHandler get jsonHandler => nullJsonHandler; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart index c9e2fbd137e..d3f092d8db8 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart @@ -25,7 +25,7 @@ class PrepareRenameHandler TextDocumentPositionParams, TextDocumentPrepareRenameResult > { - PrepareRenameHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_prepareRename; @@ -100,7 +100,7 @@ class PrepareRenameHandler } class RenameHandler extends LspMessageHandler { - RenameHandler(super.server); + new(super.server); LspGlobalClientConfiguration get config => server.lspClientConfiguration.global; @@ -341,7 +341,7 @@ class RenameHandler extends LspMessageHandler { class RenameRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - RenameRegistrations(super.info); + new(super.info); @override ToJsonable? get options => RenameRegistrationOptions( diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_selection_range.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_selection_range.dart index 97d4b73c05e..1461c97a1ac 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_selection_range.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_selection_range.dart @@ -17,7 +17,7 @@ typedef StaticOptions = class SelectionRangeHandler extends LspMessageHandler?> { - SelectionRangeHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_selectionRange; @@ -91,7 +91,7 @@ class SelectionRangeHandler class SelectionRangeRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - SelectionRangeRegistrations(super.info); + new(super.info); @override ToJsonable? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart index 8c518ea5fd3..3c41af8feee 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_semantic_tokens.dart @@ -24,7 +24,7 @@ typedef StaticOptions = abstract class AbstractSemanticTokensHandler extends LspMessageHandler with LspPluginRequestHandlerMixin { - AbstractSemanticTokensHandler(super.server); + new(super.server); List> getPluginResults(String path) { var notificationManager = server.notificationManager; @@ -128,7 +128,7 @@ abstract class AbstractSemanticTokensHandler class SemanticTokensFullHandler extends AbstractSemanticTokensHandler { - SemanticTokensFullHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_semanticTokens_full; @@ -147,7 +147,7 @@ class SemanticTokensFullHandler class SemanticTokensRangeHandler extends AbstractSemanticTokensHandler { - SemanticTokensRangeHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_semanticTokens_range; @@ -166,7 +166,7 @@ class SemanticTokensRangeHandler class SemanticTokensRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - SemanticTokensRegistrations(super.info); + new(super.info); @override ToJsonable? get options => SemanticTokensRegistrationOptions( diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart index d92e49822a3..3419a4035b1 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_shutdown.dart @@ -8,7 +8,7 @@ import 'package:analysis_server/src/lsp/handlers/handler_states.dart'; import 'package:analysis_server/src/lsp/handlers/handlers.dart'; class ShutdownMessageHandler extends LspMessageHandler { - ShutdownMessageHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.shutdown; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart index 399188c201f..5a91c685fd0 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart @@ -15,7 +15,7 @@ import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart'; class SignatureHelpHandler extends SharedMessageHandler { - SignatureHelpHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_signatureHelp; @@ -138,7 +138,7 @@ class SignatureHelpHandler class SignatureHelpRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - SignatureHelpRegistrations(super.info); + new(super.info); @override ToJsonable? get options => SignatureHelpRegistrationOptions( diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart index 11611f78424..452c622364d 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart @@ -68,7 +68,7 @@ typedef _RequestHandlerGenerator = /// example, inconsistent document state between server/client) occurs and will /// reject all messages. class FailureStateMessageHandler extends ServerStateMessageHandler { - FailureStateMessageHandler(super.server); + new(super.server); @override FutureOr> handleUnknownMessage(IncomingMessage message) { @@ -105,7 +105,7 @@ class InitializedLspStateMessageHandler extends InitializedStateMessageHandler { InlayHintHandler.new, ]; - InitializedLspStateMessageHandler(LspAnalysisServer server) : super(server) { + new(LspAnalysisServer server) : super(server) { for (var generator in lspHandlerGenerators) { registerHandler(generator(server)); } @@ -160,7 +160,7 @@ class InitializedStateMessageHandler extends ServerStateMessageHandler { WorkspaceSymbolHandler.new, ]; - InitializedStateMessageHandler(AnalysisServer server) : super(server) { + new(AnalysisServer server) : super(server) { reject( Method.initialize, ServerErrorCodes.serverAlreadyInitialized, @@ -179,10 +179,8 @@ class InitializedStateMessageHandler extends ServerStateMessageHandler { } class InitializingStateMessageHandler extends ServerStateMessageHandler { - InitializingStateMessageHandler( - LspAnalysisServer server, - List openWorkspacePaths, - ) : super(server) { + new(LspAnalysisServer server, List openWorkspacePaths) + : super(server) { reject( Method.initialize, ServerErrorCodes.serverAlreadyInitialized, @@ -211,7 +209,7 @@ class InitializingStateMessageHandler extends ServerStateMessageHandler { } class ShuttingDownStateMessageHandler extends ServerStateMessageHandler { - ShuttingDownStateMessageHandler(LspAnalysisServer server) : super(server) { + new(LspAnalysisServer server) : super(server) { registerHandler(ExitMessageHandler(server, clientDidCallShutdown: true)); } @@ -232,7 +230,7 @@ class ShuttingDownStateMessageHandler extends ServerStateMessageHandler { } class UninitializedStateMessageHandler extends ServerStateMessageHandler { - UninitializedStateMessageHandler(LspAnalysisServer server) : super(server) { + new(LspAnalysisServer server) : super(server) { registerHandler(ShutdownMessageHandler(server)); registerHandler(ExitMessageHandler(server)); registerHandler(InitializeMessageHandler(server)); diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart index d67edfde98e..cabaf6b1b8a 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_text_document_changes.dart @@ -18,7 +18,7 @@ typedef StaticOptions = Either2; class TextDocumentChangeHandler extends LspMessageHandler { - TextDocumentChangeHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_didChange; @@ -76,7 +76,7 @@ class TextDocumentChangeHandler class TextDocumentCloseHandler extends LspMessageHandler { - TextDocumentCloseHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_didClose; @@ -113,7 +113,7 @@ class TextDocumentCloseHandler class TextDocumentOpenHandler extends LspMessageHandler { - TextDocumentOpenHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_didOpen; @@ -150,7 +150,7 @@ class TextDocumentOpenHandler class TextDocumentRegistrations extends FeatureRegistration with StaticRegistration { - TextDocumentRegistrations(super.info); + new(super.info); @override List get dynamicRegistrations { diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart index 2b559ee3383..1e3043a89cb 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart @@ -27,7 +27,7 @@ class TypeDefinitionHandler with LspPluginRequestHandlerMixin { static const _emptyResult = TextDocumentTypeDefinitionResult.t2([]); - TypeDefinitionHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_typeDefinition; @@ -234,7 +234,7 @@ class TypeDefinitionHandler class TypeDefinitionRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - TypeDefinitionRegistrations(super.info); + new(super.info); @override ToJsonable? get options => TextDocumentRegistrationOptions( diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart index e21514db616..fd9abe84481 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart @@ -36,7 +36,7 @@ class PrepareTypeHierarchyHandler TextDocumentPrepareTypeHierarchyResult > with _TypeHierarchyUtils { - PrepareTypeHierarchyHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.textDocument_prepareTypeHierarchy; @@ -83,7 +83,7 @@ class PrepareTypeHierarchyHandler class TypeHierarchyRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - TypeHierarchyRegistrations(super.info); + new(super.info); @override ToJsonable? get options => @@ -106,7 +106,7 @@ class TypeHierarchySubtypesHandler TypeHierarchySubtypesResult > with _TypeHierarchyUtils { - TypeHierarchySubtypesHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.typeHierarchy_subtypes; @@ -154,7 +154,7 @@ class TypeHierarchySupertypesHandler TypeHierarchySupertypesResult > with _TypeHierarchyUtils { - TypeHierarchySupertypesHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.typeHierarchy_supertypes; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_will_rename_files.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_will_rename_files.dart index ff0c3cc9e80..328cef232b5 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_will_rename_files.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_will_rename_files.dart @@ -21,7 +21,7 @@ class WillRenameFilesHandler @visibleForTesting static Future? delayDuringComputeForTests; - WillRenameFilesHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.workspace_willRenameFiles; @@ -112,7 +112,7 @@ class WillRenameFilesHandler class WillRenameFilesRegistrations extends FeatureRegistration with SingleDynamicRegistration, StaticRegistration { - WillRenameFilesRegistrations(super.info); + new(super.info); @override FileOperationRegistrationOptions? get options => diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart index 076d4eaae67..901e5179747 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_configuration.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/lsp/registration/feature_registration.dart'; class WorkspaceDidChangeConfigurationMessageHandler extends LspMessageHandler { - WorkspaceDidChangeConfigurationMessageHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.workspace_didChangeConfiguration; @@ -36,7 +36,7 @@ class WorkspaceDidChangeConfigurationMessageHandler class WorkspaceDidChangeConfigurationRegistrations extends FeatureRegistration with SingleDynamicRegistration { - WorkspaceDidChangeConfigurationRegistrations(super.info); + new(super.info); @override ToJsonable? get options => null; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_symbols.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_symbols.dart index c0f984c16a0..d56215f59c5 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_symbols.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_symbols.dart @@ -14,7 +14,7 @@ typedef StaticOptions = Either2; class WorkspaceSymbolHandler extends SharedMessageHandler> { - WorkspaceSymbolHandler(super.server); + new(super.server); @override Method get handlesMessage => Method.workspace_symbol; @@ -136,7 +136,7 @@ class WorkspaceSymbolHandler class WorkspaceSymbolRegistrations extends FeatureRegistration with StaticRegistration { - WorkspaceSymbolRegistrations(super.info); + new(super.info); @override List get dynamicRegistrations => []; diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart index 2698923ca1d..6ca36cbac30 100644 --- a/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart +++ b/pkg/analysis_server/lib/src/lsp/handlers/handlers.dart @@ -41,7 +41,7 @@ abstract class CommandHandler @override final S server; - CommandHandler(this.server); + new(this.server); /// Whether this command records its own analytics and should be excluded from /// logging by the main command handler. @@ -342,7 +342,7 @@ mixin HandlerHelperMixin { /// not supported over the legacy protocol. abstract class LspMessageHandler extends MessageHandler { - LspMessageHandler(super.server); + new(super.server); /// All strict LSP handlers implicitly require a trusted handler because they /// either modify state (eg. `textDocument/didOpen`) or otherwise require an @@ -376,7 +376,7 @@ abstract class MessageHandler @override final S server; - MessageHandler(this.server); + new(this.server); /// The method that this handler can handle. Method get handlesMessage; @@ -463,7 +463,7 @@ class MessageInfo { /// process (for example the editor). final bool isTrustedCaller; - MessageInfo({ + new({ required this.performance, // TODO(dantup): Consider a version of this that has a non-nullable // `LspClientCapabilities` since the majority of handlers first check this @@ -493,8 +493,7 @@ abstract class ServerStateMessageHandler { final CancelRequestHandler cancelHandler; final NotCancelableToken _notCancelableToken = NotCancelableToken(); - ServerStateMessageHandler(this.server) - : cancelHandler = CancelRequestHandler(server) { + new(this.server) : cancelHandler = CancelRequestHandler(server) { registerHandler(cancelHandler); } @@ -577,5 +576,5 @@ abstract class ServerStateMessageHandler { /// A base class for LSP handlers that work with any [AnalysisServer]. abstract class SharedMessageHandler extends MessageHandler { - SharedMessageHandler(super.server); + new(super.server); } diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart index c438e644bc1..72fa74fd6c5 100644 --- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart +++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart @@ -132,7 +132,7 @@ class LspAnalysisServer extends AnalysisServer { /// Initialize a newly created server to send and receive messages to the /// given [channel]. - LspAnalysisServer( + new( this.channel, ResourceProvider baseResourceProvider, AnalysisServerOptions options, @@ -1249,12 +1249,11 @@ class LspInitializationOptions { /// Dart-Code, this flag can also be removed here for future SDKs. final bool useInEditorDartFixPrompt; - factory LspInitializationOptions(Object? options) => - LspInitializationOptions._( - options is Map ? options : const {}, - ); + factory(Object? options) => LspInitializationOptions._( + options is Map ? options : const {}, + ); - LspInitializationOptions._(Map options) + new _(Map options) : raw = options, appHost = options['appHost'] as String?, remoteName = options['remoteName'] as String?, @@ -1279,7 +1278,7 @@ class LspServerContextManagerCallbacks @override final LspAnalysisServer analysisServer; - LspServerContextManagerCallbacks(this.analysisServer, super.resourceProvider); + new(this.analysisServer, super.resourceProvider); @override void afterContextsCreated() { diff --git a/pkg/analysis_server/lib/src/lsp/lsp_packet_transformer.dart b/pkg/analysis_server/lib/src/lsp/lsp_packet_transformer.dart index 599c3be1e49..475d09303f1 100644 --- a/pkg/analysis_server/lib/src/lsp/lsp_packet_transformer.dart +++ b/pkg/analysis_server/lib/src/lsp/lsp_packet_transformer.dart @@ -10,7 +10,7 @@ import 'package:collection/collection.dart'; class InvalidEncodingError { final String headers; - InvalidEncodingError(this.headers); + new(this.headers); @override String toString() => @@ -21,7 +21,7 @@ class LspHeaders { final String rawHeaders; final int contentLength; final String? encoding; - LspHeaders(this.rawHeaders, this.contentLength, this.encoding); + new(this.rawHeaders, this.contentLength, this.encoding); } /// Transforms a stream of LSP data in the form: @@ -129,7 +129,7 @@ class LspPacketTransformer extends StreamTransformerBase, String> { class _LspPacketTransformerListenData { final StreamSubscription input; - _LspPacketTransformerListenData(this.input); + new(this.input); } /// The marker class for [StreamController.onPause]. diff --git a/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart index c3fdd1a6cb2..81bd91416e1 100644 --- a/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart +++ b/pkg/analysis_server/lib/src/lsp/lsp_socket_server.dart @@ -54,7 +54,7 @@ class LspSocketServer implements AbstractSocketServer { final Map? environment; - LspSocketServer( + new( this.analysisServerOptions, this.diagnosticServer, this.analyticsManager, diff --git a/pkg/analysis_server/lib/src/lsp/notification_manager.dart b/pkg/analysis_server/lib/src/lsp/notification_manager.dart index a0dc5d2bcab..64fb86d0fd8 100644 --- a/pkg/analysis_server/lib/src/lsp/notification_manager.dart +++ b/pkg/analysis_server/lib/src/lsp/notification_manager.dart @@ -14,7 +14,7 @@ class LspNotificationManager extends AbstractNotificationManager { // Set externally immediately after construction. late final LspAnalysisServer server; - LspNotificationManager(super.pathContext); + new(super.pathContext); /// Sends errors for a file to the client. @override diff --git a/pkg/analysis_server/lib/src/lsp/progress.dart b/pkg/analysis_server/lib/src/lsp/progress.dart index 43c53df6fe4..36d2669f92b 100644 --- a/pkg/analysis_server/lib/src/lsp/progress.dart +++ b/pkg/analysis_server/lib/src/lsp/progress.dart @@ -15,21 +15,17 @@ abstract class ProgressReporter { /// Creates a reporter for a token that was supplied by the client and does /// not need creating prior to use. - factory ProgressReporter.clientProvided( - LspAnalysisServer server, - ProgressToken token, - ) => _TokenProgressReporter(server, token); + factory clientProvided(LspAnalysisServer server, ProgressToken token) => + _TokenProgressReporter(server, token); /// Creates a reporter for a new token that must be created prior to being /// used. /// /// If [token] is not supplied, a random identifier will be used. - factory ProgressReporter.serverCreated( - LspAnalysisServer server, [ - ProgressToken? token, - ]) => _ServerCreatedProgressReporter(server, token); + factory serverCreated(LspAnalysisServer server, [ProgressToken? token]) => + _ServerCreatedProgressReporter(server, token); - ProgressReporter._(); + new _(); // TODO(dantup): Add support for cancellable progress notifications. FutureOr begin(String title, {String? message}); @@ -38,7 +34,7 @@ abstract class ProgressReporter { } class _NoopProgressReporter extends ProgressReporter { - _NoopProgressReporter() : super._(); + new() : super._(); @override void begin(String title, {String? message}) {} @override @@ -49,7 +45,7 @@ class _ServerCreatedProgressReporter extends _TokenProgressReporter { static final _random = Random(); Future? _tokenBeginRequest; - _ServerCreatedProgressReporter(LspAnalysisServer server, ProgressToken? token) + new(LspAnalysisServer server, ProgressToken? token) : super(server, token ?? ProgressToken.t2(_randomTokenIdentifier())); @override @@ -105,7 +101,7 @@ class _TokenProgressReporter extends ProgressReporter { final ProgressToken _token; bool _needsEnd = false; - _TokenProgressReporter(this._server, this._token) : super._(); + new(this._server, this._token) : super._(); @override void begin(String? title, {String? message}) { diff --git a/pkg/analysis_server/lib/src/lsp/registration/feature_registration.dart b/pkg/analysis_server/lib/src/lsp/registration/feature_registration.dart index dd3f03b448f..bd8422545e2 100644 --- a/pkg/analysis_server/lib/src/lsp/registration/feature_registration.dart +++ b/pkg/analysis_server/lib/src/lsp/registration/feature_registration.dart @@ -43,7 +43,7 @@ typedef LspDynamicRegistration = (Method, ToJsonable?); abstract class FeatureRegistration { final RegistrationContext _context; - FeatureRegistration(this._context); + new(this._context); /// The capabilities of the client. LspClientCapabilities get clientCapabilities => _context.clientCapabilities; @@ -114,7 +114,7 @@ class LspFeatures { workspaceDidChangeConfiguration; final WorkspaceSymbolRegistrations workspaceSymbol; - LspFeatures(RegistrationContext context) + new(RegistrationContext context) : callHierarchy = CallHierarchyRegistrations(context), changeNotifications = ChangeWorkspaceFoldersRegistrations(context), codeActions = CodeActionRegistrations(context), @@ -203,7 +203,7 @@ class RegistrationContext { /// 'file' is implied and not included. final Set customDartSchemes; - RegistrationContext({ + new({ required this.clientCapabilities, required this.clientConfiguration, required this.customDartSchemes, diff --git a/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart b/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart index a8fcb08eb3e..68344d0a601 100644 --- a/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart +++ b/pkg/analysis_server/lib/src/lsp/semantic_tokens/encoder.dart @@ -195,7 +195,7 @@ class SemanticTokenInfo { final SemanticTokenTypes type; final Set? modifiers; - SemanticTokenInfo(this.offset, this.length, this.type, this.modifiers); + new(this.offset, this.length, this.type, this.modifiers); /// Sorter for semantic tokens that ensures tokens are sorted in offset order /// then longest first, then by priority, and finally by name. This ensures diff --git a/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart b/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart index 7a2d92b385e..e0e439a8147 100644 --- a/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart +++ b/pkg/analysis_server/lib/src/lsp/semantic_tokens/legend.dart @@ -28,7 +28,7 @@ class SemanticTokenLegendLookup { /// server and client. late List _usedTokenTypes; - SemanticTokenLegendLookup() { + new() { // Build lists of all tokens and modifiers that exist in our mappings or that // we have added as custom types. These will be used to determine the indexes used for communication. _usedTokenTypes = Set.of( diff --git a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart index db7f31c1580..41ccebaadc2 100644 --- a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart +++ b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart @@ -52,7 +52,7 @@ class ClientDynamicRegistrations { ]; final ClientCapabilities _capabilities; - ClientDynamicRegistrations(this._capabilities); + new(this._capabilities); bool get callHierarchy => _capabilities.textDocument?.callHierarchy?.dynamicRegistration ?? false; @@ -147,7 +147,7 @@ class ServerCapabilitiesComputer { var _lastRegistrationId = 0; - ServerCapabilitiesComputer(this._server); + new(this._server); List get pluginTypes => _server .pluginManager diff --git a/pkg/analysis_server/lib/src/lsp/snippets.dart b/pkg/analysis_server/lib/src/lsp/snippets.dart index 7f9981bce31..09d60eca66d 100644 --- a/pkg/analysis_server/lib/src/lsp/snippets.dart +++ b/pkg/analysis_server/lib/src/lsp/snippets.dart @@ -297,7 +297,7 @@ class SnippetPlaceholder { final int? linkedGroupId; final bool isFinal; - SnippetPlaceholder( + new( this.offset, this.length, { this.suggestions, diff --git a/pkg/analysis_server/lib/src/lsp/source_edits.dart b/pkg/analysis_server/lib/src/lsp/source_edits.dart index 2fbb3b2b814..19abaea2149 100644 --- a/pkg/analysis_server/lib/src/lsp/source_edits.dart +++ b/pkg/analysis_server/lib/src/lsp/source_edits.dart @@ -221,7 +221,7 @@ class FileEditInformation { final int? selectionOffsetRelative; final int? selectionLength; - FileEditInformation( + new( this.doc, this.lineInfo, this.edits, { @@ -282,7 +282,7 @@ class _MinimalEditComputer { /// The edits being built. final _edits = []; - _MinimalEditComputer({ + new({ required ParsedUnitResult result, required this._lineInfo, required String unformatted, diff --git a/pkg/analysis_server/lib/src/lsp/temporary_overlay_operation.dart b/pkg/analysis_server/lib/src/lsp/temporary_overlay_operation.dart index 2e00f4a1788..a7303bb3013 100644 --- a/pkg/analysis_server/lib/src/lsp/temporary_overlay_operation.dart +++ b/pkg/analysis_server/lib/src/lsp/temporary_overlay_operation.dart @@ -26,7 +26,7 @@ abstract class TemporaryOverlayOperation { final Set _affectedContexts = {}; final Map> _originalAddedFiles = {}; - TemporaryOverlayOperation(this.server) + new(this.server) : contextManager = server.contextManager, resourceProvider = server.resourceProvider; diff --git a/pkg/analysis_server/lib/src/plugin/notification_manager.dart b/pkg/analysis_server/lib/src/plugin/notification_manager.dart index c2ce49b9fe7..de13837690f 100644 --- a/pkg/analysis_server/lib/src/plugin/notification_manager.dart +++ b/pkg/analysis_server/lib/src/plugin/notification_manager.dart @@ -84,7 +84,7 @@ abstract class AbstractNotificationManager { StreamController.broadcast(); /// Initialize a newly created notification manager. - AbstractNotificationManager(this._pathContext) + new(this._pathContext) : folding = ResultCollector>(serverId), highlights = ResultCollector>(serverId), _navigation = ResultCollector(serverId), @@ -406,7 +406,7 @@ class NotificationManager extends AbstractNotificationManager { final ServerCommunicationChannel _channel; /// Initialize a newly created notification manager. - NotificationManager(this._channel, super.pathContext); + new(this._channel, super.pathContext); /// Sends errors for a file to the client. @override diff --git a/pkg/analysis_server/lib/src/plugin/plugin_isolate.dart b/pkg/analysis_server/lib/src/plugin/plugin_isolate.dart index 49119e8bdc6..c53a9b0ce86 100644 --- a/pkg/analysis_server/lib/src/plugin/plugin_isolate.dart +++ b/pkg/analysis_server/lib/src/plugin/plugin_isolate.dart @@ -78,7 +78,7 @@ class PluginIsolate { /// subdirectories of the context roots. AnalysisSetAnalysisRootsParams? _analysisRoots; - PluginIsolate( + new( this._path, this.executionPath, this.packageConfigPath, @@ -330,7 +330,7 @@ class PluginSession { /// plugin. String? _version; - PluginSession(this._isolate); + new(this._isolate); /// The next request ID, encoded as a string. /// @@ -553,5 +553,5 @@ class _PendingRequest { final Completer completer; /// Initialize a pending request. - _PendingRequest(this.method, this.requestTime, this.completer); + new(this.method, this.requestTime, this.completer); } diff --git a/pkg/analysis_server/lib/src/plugin/plugin_locator.dart b/pkg/analysis_server/lib/src/plugin/plugin_locator.dart index 3b52f9c75f1..5de8137603e 100644 --- a/pkg/analysis_server/lib/src/plugin/plugin_locator.dart +++ b/pkg/analysis_server/lib/src/plugin/plugin_locator.dart @@ -25,7 +25,7 @@ class PluginLocator { /// Initialize a newly created plugin locator to use the given /// [resourceProvider] to access the file system. - PluginLocator(this.resourceProvider); + new(this.resourceProvider); /// Given the root directory of a package (the [packageRoot]), returns the /// path to the plugin associated with the package, or `null` if there is no diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart index 790d0cdcc7b..4d8d876d150 100644 --- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart +++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart @@ -45,7 +45,7 @@ class PluginException implements Exception { final String message; /// Initialize a newly created exception to have the given [message]. - PluginException(this.message); + new(this.message); @override String toString() => message; @@ -59,7 +59,7 @@ class PluginFiles { /// The plugin package config file. final File packageConfig; - PluginFiles(this.execution, this.packageConfig); + new(this.execution, this.packageConfig); } /// An object used to manage the currently running plugins. @@ -141,7 +141,7 @@ class PluginManager { /// /// The notifications from the running plugins will be handled by the given /// [_notificationManager]. - PluginManager( + new( this._resourceProvider, this._byteStorePath, this._sdkPath, @@ -1000,5 +1000,5 @@ class _Package { final String name; final Folder root; - _Package(this.name, this.root); + new(this.name, this.root); } diff --git a/pkg/analysis_server/lib/src/plugin/plugin_watcher.dart b/pkg/analysis_server/lib/src/plugin/plugin_watcher.dart index 99f0d6aefa9..2427b89155a 100644 --- a/pkg/analysis_server/lib/src/plugin/plugin_watcher.dart +++ b/pkg/analysis_server/lib/src/plugin/plugin_watcher.dart @@ -34,11 +34,8 @@ class PluginWatcher implements DriverWatcher { final bool _pluginsAreEnabled; /// Initialize a newly created plugin watcher. - PluginWatcher( - this.resourceProvider, - this.manager, { - required this._pluginsAreEnabled, - }) : _locator = PluginLocator(resourceProvider); + new(this.resourceProvider, this.manager, {required this._pluginsAreEnabled}) + : _locator = PluginLocator(resourceProvider); @override void addedDriver(AnalysisDriver driver) { @@ -205,5 +202,5 @@ class _DriverInfo { final List packageRoots; /// Initialize a newly created information holder. - _DriverInfo(this.contextRoot, this.packageRoots); + new(this.contextRoot, this.packageRoots); } diff --git a/pkg/analysis_server/lib/src/plugin/result_collector.dart b/pkg/analysis_server/lib/src/plugin/result_collector.dart index e291d488d45..7d5aa0a63f8 100644 --- a/pkg/analysis_server/lib/src/plugin/result_collector.dart +++ b/pkg/analysis_server/lib/src/plugin/result_collector.dart @@ -23,7 +23,7 @@ class ResultCollector { final Map> resultMap = >{}; /// Initialize a newly created result manager. - ResultCollector(this.serverId, {ShouldCollectPredicate? predicate}) + new(this.serverId, {ShouldCollectPredicate? predicate}) : _shouldCollect = predicate; /// Clear any results that have been contributed for the file with the given diff --git a/pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart b/pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart index a5c50ce85c3..fe7a657fd90 100644 --- a/pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart +++ b/pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart @@ -50,7 +50,7 @@ final class ServerIsolateChannel implements ServerCommunicationChannel { /// The port used to receive notification when the plugin isolate has exited. ReceivePort? _exitPort; - ServerIsolateChannel( + new( this._pluginUri, this._packageConfigUri, this.instrumentationService, diff --git a/pkg/analysis_server/lib/src/plugin2/generator.dart b/pkg/analysis_server/lib/src/plugin2/generator.dart index 0700ea38b55..35266b3238e 100644 --- a/pkg/analysis_server/lib/src/plugin2/generator.dart +++ b/pkg/analysis_server/lib/src/plugin2/generator.dart @@ -15,10 +15,7 @@ class PluginPackageGenerator { final Map? _dependencyOverrides; - PluginPackageGenerator({ - required this._configurations, - this._dependencyOverrides, - }); + new({required this._configurations, this._dependencyOverrides}); /// Generates the Dart entrpoint file which is to be spawned in a Dart /// isolate by the analysis server. diff --git a/pkg/analysis_server/lib/src/protocol/protocol_internal.dart b/pkg/analysis_server/lib/src/protocol/protocol_internal.dart index c38f844996d..68beb468e3d 100644 --- a/pkg/analysis_server/lib/src/protocol/protocol_internal.dart +++ b/pkg/analysis_server/lib/src/protocol/protocol_internal.dart @@ -229,7 +229,7 @@ class RequestDecoder extends JsonDecoder { /// The request being deserialized. final Request _request; - RequestDecoder(this._request); + new(this._request); @override RefactoringKind? get refactoringKind { @@ -279,7 +279,7 @@ class ResponseDecoder extends JsonDecoder { @override final RefactoringKind? refactoringKind; - ResponseDecoder(this.refactoringKind); + new(this.refactoringKind); @override Object mismatch(String jsonPath, String expected, [Object? actual]) { diff --git a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart index 5ff9658a865..2d775312bef 100644 --- a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart +++ b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart @@ -14,7 +14,7 @@ abstract class DartCompletionContributor { final DartCompletionRequest request; final SuggestionBuilder builder; - DartCompletionContributor(this.request, this.builder); + new(this.request, this.builder); /// Return a [Future] that completes when the suggestions appropriate for the /// given completion [request] have been added to the [builder]. diff --git a/pkg/analysis_server/lib/src/scheduler/message_scheduler.dart b/pkg/analysis_server/lib/src/scheduler/message_scheduler.dart index cbef333fd4d..e6cbb79ad7b 100644 --- a/pkg/analysis_server/lib/src/scheduler/message_scheduler.dart +++ b/pkg/analysis_server/lib/src/scheduler/message_scheduler.dart @@ -61,7 +61,7 @@ final class MessageScheduler { /// atomically and it was decided that it was cleaner for the scheduler to /// have the nullable reference to the server rather than the other way /// around. - MessageScheduler({required this.listener}); + new({required this.listener}); /// Whether the queue is currently paused. bool get isPaused => _pauseCount > 0; diff --git a/pkg/analysis_server/lib/src/scheduler/scheduled_message.dart b/pkg/analysis_server/lib/src/scheduler/scheduled_message.dart index 0d027861c73..1100049ce3b 100644 --- a/pkg/analysis_server/lib/src/scheduler/scheduled_message.dart +++ b/pkg/analysis_server/lib/src/scheduler/scheduled_message.dart @@ -23,7 +23,7 @@ final class DtdMessage extends ScheduledMessage { /// The object used to gather performance data. final OperationPerformanceImpl performance; - DtdMessage({ + new({ required this.message, required this.responseCompleter, required this.performance, @@ -42,7 +42,7 @@ final class LegacyMessage extends ScheduledMessage { /// request. CancelableToken? cancellationToken; - LegacyMessage({required this.request, this.cancellationToken}); + new({required this.request, this.cancellationToken}); @override String get id => 'legacy:${request.method}'; @@ -57,7 +57,7 @@ final class LspMessage extends ScheduledMessage { /// request. CancelableToken? cancellationToken; - LspMessage({required this.message, this.cancellationToken}); + new({required this.message, this.cancellationToken}); @override String get id { @@ -93,7 +93,7 @@ final class WatcherMessage extends ScheduledMessage { /// The event that was received. final WatchEvent event; - WatcherMessage(this.event); + new(this.event); @override String get id => 'watch:${event.type} ${event.path}'; diff --git a/pkg/analysis_server/lib/src/scheduler/scheduler_tracking_listener.dart b/pkg/analysis_server/lib/src/scheduler/scheduler_tracking_listener.dart index c2ea1795f2d..10a053497b9 100644 --- a/pkg/analysis_server/lib/src/scheduler/scheduler_tracking_listener.dart +++ b/pkg/analysis_server/lib/src/scheduler/scheduler_tracking_listener.dart @@ -67,7 +67,7 @@ class MessageData { /// The id of the message that was completed, if any. lsp.Either2? cancelledMessageId; - MessageData({ + new({ required this.message, required this.pendingOnPendingMessageCount, required this.pendingOnPendingMessages, @@ -115,7 +115,7 @@ class SchedulerTrackingListener extends MessageSchedulerListener { /// Returns a newly created listener that will report to the /// [analyticsManager]. - SchedulerTrackingListener(this.analyticsManager, this.performanceLogger); + new(this.analyticsManager, this.performanceLogger); @override void addActiveMessage(ScheduledMessage message) { diff --git a/pkg/analysis_server/lib/src/search/element_references.dart b/pkg/analysis_server/lib/src/search/element_references.dart index 087a56d4081..81bef98285c 100644 --- a/pkg/analysis_server/lib/src/search/element_references.dart +++ b/pkg/analysis_server/lib/src/search/element_references.dart @@ -13,7 +13,7 @@ import 'package:analyzer/src/util/performance/operation_performance.dart'; class ElementReferencesComputer { final SearchEngine searchEngine; - ElementReferencesComputer(this.searchEngine); + new(this.searchEngine); /// Computes [SearchMatch]es for [element] references. Future> compute( diff --git a/pkg/analysis_server/lib/src/search/type_hierarchy.dart b/pkg/analysis_server/lib/src/search/type_hierarchy.dart index b382dabcf07..d2b46e087c9 100644 --- a/pkg/analysis_server/lib/src/search/type_hierarchy.dart +++ b/pkg/analysis_server/lib/src/search/type_hierarchy.dart @@ -21,7 +21,7 @@ class TypeHierarchyComputer { final Map _elementItemMap = HashMap(); - TypeHierarchyComputer(this._searchEngine, Element pivotElement) + new(this._searchEngine, Element pivotElement) : helper = TypeHierarchyComputerHelper.fromElement(pivotElement); /// Returns the computed type hierarchy, maybe `null`. @@ -154,7 +154,7 @@ class TypeHierarchyComputerHelper { final bool pivotFieldFinal; final InterfaceElement? pivotClass; - TypeHierarchyComputerHelper( + new( this.pivotElement, this.pivotLibrary, this.pivotKind, @@ -163,7 +163,7 @@ class TypeHierarchyComputerHelper { this.pivotClass, ); - factory TypeHierarchyComputerHelper.fromElement(Element pivotElement) { + factory fromElement(Element pivotElement) { // try to find enclosing ClassElement Element? element = pivotElement; bool pivotFieldFinal = false; diff --git a/pkg/analysis_server/lib/src/server/crash_reporting.dart b/pkg/analysis_server/lib/src/server/crash_reporting.dart index dccae64c8cd..ca7de1b5e90 100644 --- a/pkg/analysis_server/lib/src/server/crash_reporting.dart +++ b/pkg/analysis_server/lib/src/server/crash_reporting.dart @@ -12,7 +12,7 @@ class CrashReportingInstrumentation extends NoopInstrumentationService { // A prod reporter, for analysis server crashes. final CrashReportSender serverReporter; - CrashReportingInstrumentation(this.serverReporter); + new(this.serverReporter); @override void logException( diff --git a/pkg/analysis_server/lib/src/server/debounce_requests.dart b/pkg/analysis_server/lib/src/server/debounce_requests.dart index 7af04c1ed10..6cc4b047678 100644 --- a/pkg/analysis_server/lib/src/server/debounce_requests.dart +++ b/pkg/analysis_server/lib/src/server/debounce_requests.dart @@ -37,7 +37,7 @@ class _DebounceRequests { final StreamController discardedRequests; late final Stream requests; - _DebounceRequests(this.channel, this.discardedRequests) { + new(this.channel, this.discardedRequests) { var buffer = []; Timer? timer; diff --git a/pkg/analysis_server/lib/src/server/dev_server.dart b/pkg/analysis_server/lib/src/server/dev_server.dart index 35286b67e62..9ad05802639 100644 --- a/pkg/analysis_server/lib/src/server/dev_server.dart +++ b/pkg/analysis_server/lib/src/server/dev_server.dart @@ -27,7 +27,7 @@ class DevAnalysisServer { late DevChannel _channel; /// Initialize a newly created stdio server. - DevAnalysisServer(this.socketServer); + new(this.socketServer); void initServer() { _channel = DevChannel(); diff --git a/pkg/analysis_server/lib/src/server/error_notifier.dart b/pkg/analysis_server/lib/src/server/error_notifier.dart index ecc9442abfc..2d80b0a42a8 100644 --- a/pkg/analysis_server/lib/src/server/error_notifier.dart +++ b/pkg/analysis_server/lib/src/server/error_notifier.dart @@ -54,6 +54,6 @@ class ErrorNotifier extends NoopInstrumentationService { /// Server may throw a [FatalException] to send a fatal error response to the /// IDEs. class FatalException extends CaughtException { - FatalException(String super.message, super.exception, super.stackTrace) + new(String super.message, super.exception, super.stackTrace) : super.withMessage(); } diff --git a/pkg/analysis_server/lib/src/server/features.dart b/pkg/analysis_server/lib/src/server/features.dart index 1a2a3633e62..1a930113f94 100644 --- a/pkg/analysis_server/lib/src/server/features.dart +++ b/pkg/analysis_server/lib/src/server/features.dart @@ -10,5 +10,5 @@ class FeatureSet { final bool completion; final bool search; - FeatureSet({this.completion = true, this.search = true}); + new({this.completion = true, this.search = true}); } diff --git a/pkg/analysis_server/lib/src/server/http_server.dart b/pkg/analysis_server/lib/src/server/http_server.dart index 7d0bd8cadcc..ef49c3ee734 100644 --- a/pkg/analysis_server/lib/src/server/http_server.dart +++ b/pkg/analysis_server/lib/src/server/http_server.dart @@ -46,7 +46,7 @@ class HttpAnalysisServer { final List _printBuffer = []; /// Initialize a newly created HTTP server. - HttpAnalysisServer(this._socketServer); + new(this._socketServer); /// Return the port this server is bound to. Future get boundPort async { diff --git a/pkg/analysis_server/lib/src/server/isolate_analysis_server.dart b/pkg/analysis_server/lib/src/server/isolate_analysis_server.dart index 47078027d21..023982ed68b 100644 --- a/pkg/analysis_server/lib/src/server/isolate_analysis_server.dart +++ b/pkg/analysis_server/lib/src/server/isolate_analysis_server.dart @@ -17,7 +17,7 @@ class IsolateAnalysisServer { SocketServer socketServer; /// Initialize a newly created isolate server. - IsolateAnalysisServer(this.socketServer); + new(this.socketServer); /// Initializes an [IsolateChannel] with [clientSendPort] and starts a server /// with it. diff --git a/pkg/analysis_server/lib/src/server/lsp_stdio_server.dart b/pkg/analysis_server/lib/src/server/lsp_stdio_server.dart index e998be084d5..5c144c1a53a 100644 --- a/pkg/analysis_server/lib/src/server/lsp_stdio_server.dart +++ b/pkg/analysis_server/lib/src/server/lsp_stdio_server.dart @@ -17,7 +17,7 @@ class LspStdioAnalysisServer { LspSocketServer socketServer; /// Initialize a newly created stdio server. - LspStdioAnalysisServer(this.socketServer); + new(this.socketServer); /// Begin serving requests over stdio. /// diff --git a/pkg/analysis_server/lib/src/server/sdk_configuration.dart b/pkg/analysis_server/lib/src/server/sdk_configuration.dart index 8262f4ac1ec..87085747605 100644 --- a/pkg/analysis_server/lib/src/server/sdk_configuration.dart +++ b/pkg/analysis_server/lib/src/server/sdk_configuration.dart @@ -16,7 +16,7 @@ import 'package:path/path.dart' as path; class SdkConfiguration { final Map _values = {}; - SdkConfiguration.readFromFile(File file) { + new readFromFile(File file) { if (!file.existsSync()) { throw '$file not found'; } @@ -29,7 +29,7 @@ class SdkConfiguration { /// /// This constructor will still create an object even if a configuration file /// is not found. - SdkConfiguration.readFromSdk() { + new readFromSdk() { // /config/settings.json: var sdkDir = Directory( path.dirname(path.dirname(platform.resolvedExecutable)), diff --git a/pkg/analysis_server/lib/src/server/stdio_server.dart b/pkg/analysis_server/lib/src/server/stdio_server.dart index c721a1aba2b..f30b51a0601 100644 --- a/pkg/analysis_server/lib/src/server/stdio_server.dart +++ b/pkg/analysis_server/lib/src/server/stdio_server.dart @@ -15,7 +15,7 @@ class StdioAnalysisServer { SocketServer socketServer; /// Initialize a newly created stdio server. - StdioAnalysisServer(this.socketServer); + new(this.socketServer); /// Begin serving requests over stdio. /// diff --git a/pkg/analysis_server/lib/src/services/completion/completion_performance.dart b/pkg/analysis_server/lib/src/services/completion/completion_performance.dart index 7f82261c699..ced9ca6b0ac 100644 --- a/pkg/analysis_server/lib/src/services/completion/completion_performance.dart +++ b/pkg/analysis_server/lib/src/services/completion/completion_performance.dart @@ -12,7 +12,7 @@ class CompletionPerformance extends RequestPerformance { int? computedSuggestionCount; int? transmittedSuggestionCount; - CompletionPerformance({ + new({ required super.performance, required this.path, super.requestLatency, diff --git a/pkg/analysis_server/lib/src/services/completion/dart/candidate_suggestion.dart b/pkg/analysis_server/lib/src/services/completion/dart/candidate_suggestion.dart index 8f6db382dab..d232b9c140f 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/candidate_suggestion.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/candidate_suggestion.dart @@ -37,7 +37,7 @@ sealed class CandidateSuggestion { /// suggestions has been completed. int relevanceScore = -1; - CandidateSuggestion({required this.matcherScore}) : assert(matcherScore >= 0); + new({required this.matcherScore}) : assert(matcherScore >= 0); /// The text to be inserted by the completion suggestion. String get completion; @@ -55,7 +55,7 @@ final class ClassSuggestion extends ImportableSuggestion final ClassElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - ClassSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -90,7 +90,7 @@ final class ClosureSuggestion extends CandidateSuggestion with SuggestionData { /// /// If [includeTrailingComma] is `true`, then the replacement will include a /// trailing comma. - ClosureSuggestion({ + new({ required this.functionType, required this.includeTrailingComma, required super.matcherScore, @@ -177,7 +177,7 @@ final class ConstructorSuggestion extends TypedExecutableSuggestion final bool isRedirect; /// Initialize a newly created candidate suggestion to suggest the [element]. - ConstructorSuggestion({ + new({ required super.importData, required this.element, required this.alias, @@ -244,7 +244,7 @@ final class EnumConstantSuggestion extends ImportableSuggestion final bool includeEnumName; /// Initialize a newly created candidate suggestion to suggest the [element]. - EnumConstantSuggestion({ + new({ required super.importData, required this.element, this.includeEnumName = true, @@ -269,7 +269,7 @@ final class EnumSuggestion extends ImportableSuggestion final EnumElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - EnumSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -289,7 +289,7 @@ sealed class ExecutableSuggestion extends ImportableSuggestion { /// Initialize a newly created suggestion to use the given [kind] of /// suggestion. - ExecutableSuggestion({ + new({ required super.importData, required this.kind, required super.matcherScore, @@ -306,7 +306,7 @@ final class ExtensionSuggestion extends ExecutableSuggestion final ExtensionElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - ExtensionSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -324,7 +324,7 @@ final class ExtensionTypeSuggestion extends ImportableSuggestion final ExtensionTypeElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - ExtensionTypeSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -349,7 +349,7 @@ final class FieldSuggestion extends TypedSuggestion with MemberSuggestion { final bool isInDeclaration; /// Initialize a newly created candidate suggestion to suggest the [element]. - FieldSuggestion({ + new({ required this.element, required this.referencingInterface, required this.isInDeclaration, @@ -392,7 +392,7 @@ final class FormalParameterSuggestion extends CandidateSuggestion final int distance; /// Initialize a newly created candidate suggestion to suggest the [element]. - FormalParameterSuggestion({ + new({ required this.element, required this.distance, required super.matcherScore, @@ -412,7 +412,7 @@ final class FunctionCall extends TypedExecutableSuggestion { /// Initialize a newly created candidate suggestion to suggest the method /// `call` defined on the class `Function`. - FunctionCall({ + new({ required super.matcherScore, required this.type, required super.replacementRange, @@ -448,7 +448,7 @@ final class GetterSuggestion extends TypedImportableSuggestion final bool addTypeName; /// Initialize a newly created candidate suggestion to suggest the [element]. - GetterSuggestion({ + new({ required this.element, required this.referencingInterface, required super.importData, @@ -522,7 +522,7 @@ final class IdentifierSuggestion extends CandidateSuggestion { /// /// If [includeBody] is `true`, then empty curly braces will be included in /// the suggestion. - IdentifierSuggestion({ + new({ required this.identifier, required this.includeBody, required super.matcherScore, @@ -542,7 +542,7 @@ sealed class ImportableSuggestion extends CandidateSuggestion { /// Information about the import used to make this suggestion visible. final ImportData? importData; - ImportableSuggestion({required this.importData, required super.matcherScore}); + new({required this.importData, required super.matcherScore}); /// The text to add before the name of the element when it is being imported /// using an import prefix. @@ -578,7 +578,7 @@ final class ImportData { /// Initialize data representing an import of a library, using the /// [libraryUri], with the [prefix]. - ImportData({ + new({ required this.libraryUri, required this.prefix, required this.isNotImported, @@ -592,7 +592,7 @@ final class ImportPrefixSuggestion extends CandidateSuggestion final PrefixElement prefixElement; - ImportPrefixSuggestion({ + new({ required this.libraryElement, required this.prefixElement, required super.matcherScore, @@ -626,7 +626,7 @@ final class KeywordSuggestion extends CandidateSuggestion { /// be used as the selection offset. If the text doesn't contain a caret, then /// the insert text will be the annotated text and the selection offset will /// be at the end of the text. - factory KeywordSuggestion.fromKeyword({ + factory fromKeyword({ required Keyword keyword, required String? annotatedText, required double matcherScore, @@ -652,10 +652,7 @@ final class KeywordSuggestion extends CandidateSuggestion { /// be used as the selection offset. If the text doesn't contain a caret, then /// the insert text will be the annotated text and the selection offset will /// be at the end of the text. - factory KeywordSuggestion.fromText( - String annotatedText, { - required double matcherScore, - }) { + factory fromText(String annotatedText, {required double matcherScore}) { var (rawText, caretIndex) = annotatedText.withoutCaret; return KeywordSuggestion._( completion: rawText, @@ -665,7 +662,7 @@ final class KeywordSuggestion extends CandidateSuggestion { } /// Initialize a newly created candidate suggestion to suggest a keyword. - KeywordSuggestion._({ + new _({ required this.completion, required this.selectionOffset, required super.matcherScore, @@ -678,7 +675,7 @@ final class LabelSuggestion extends CandidateSuggestion { final Label label; /// Initialize a newly created candidate suggestion to suggest the [label]. - LabelSuggestion({required this.label, required super.matcherScore}); + new({required this.label, required super.matcherScore}); @override String get completion => label.name.lexeme; @@ -690,11 +687,8 @@ final class LoadLibraryFunctionSuggestion extends ExecutableSuggestion @override final TopLevelFunctionElement element; - LoadLibraryFunctionSuggestion({ - required super.kind, - required this.element, - required super.matcherScore, - }) : super(importData: null); + new({required super.kind, required this.element, required super.matcherScore}) + : super(importData: null); @override String get completion => element.displayName; @@ -707,11 +701,8 @@ final class LocalFunctionSuggestion extends ExecutableSuggestion final LocalFunctionElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - LocalFunctionSuggestion({ - required super.kind, - required this.element, - required super.matcherScore, - }) : super(importData: null); + new({required super.kind, required this.element, required super.matcherScore}) + : super(importData: null); @override String get completion => element.displayName; @@ -728,7 +719,7 @@ final class LocalVariableSuggestion extends CandidateSuggestion final int distance; /// Initialize a newly created candidate suggestion to suggest the [element]. - LocalVariableSuggestion({ + new({ required this.element, required this.distance, required super.matcherScore, @@ -778,7 +769,7 @@ final class MethodSuggestion extends TypedExecutableSuggestion final InterfaceElement? referencingInterface; /// Initialize a newly created candidate suggestion to suggest the [element]. - MethodSuggestion({ + new({ required super.kind, required this.element, required this.referencingInterface, @@ -808,7 +799,7 @@ final class MixinSuggestion extends ImportableSuggestion final MixinElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - MixinSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -838,7 +829,7 @@ final class NamedArgumentSuggestion extends CandidateSuggestion String preferredQuoteForStrings; - NamedArgumentSuggestion({ + new({ required this.parameter, required this.appendColon, required this.appendComma, @@ -899,7 +890,7 @@ final class NameSuggestion extends CandidateSuggestion { final String name; /// Initialize a newly created candidate suggestion to suggest the [name]. - NameSuggestion({required this.name, required super.matcherScore}); + new({required this.name, required super.matcherScore}); @override String get completion => name; @@ -928,7 +919,7 @@ final class OverrideSuggestion extends CandidateSuggestion /// Initialize a newly created candidate suggestion to suggest the [element] /// by inserting the [shouldInvokeSuper]. - OverrideSuggestion({ + new({ required this.element, required this.shouldInvokeSuper, required this.skipAt, @@ -952,7 +943,7 @@ final class RecordFieldSuggestion extends TypedSuggestion { /// Initialize a newly created candidate suggestion to suggest the [field] by /// inserting the [name]. - RecordFieldSuggestion({ + new({ required this.field, required this.name, required super.replacementRange, @@ -979,17 +970,15 @@ final class RecordLiteralNamedFieldSuggestion extends CandidateSuggestion final bool appendColon; final bool appendComma; - RecordLiteralNamedFieldSuggestion.newField({ + new newField({ required this.field, required this.appendComma, required super.matcherScore, }) : appendColon = true; - RecordLiteralNamedFieldSuggestion.onlyName({ - required this.field, - required super.matcherScore, - }) : appendColon = false, - appendComma = false; + new onlyName({required this.field, required super.matcherScore}) + : appendColon = false, + appendComma = false; @override String get completion { @@ -1022,10 +1011,7 @@ sealed class ReplacementSuggestion extends CandidateSuggestion { /// The source range that should be replaced by the suggestion. final SourceRange replacementRange; - ReplacementSuggestion({ - required super.matcherScore, - required this.replacementRange, - }); + new({required super.matcherScore, required this.replacementRange}); } /// The information about a candidate suggestion for Flutter's `setState` method. @@ -1047,7 +1033,7 @@ final class SetStateMethodSuggestion extends TypedExecutableSuggestion final String endOfLine; /// Initialize a newly created candidate suggestion to suggest the [element]. - SetStateMethodSuggestion({ + new({ required this.element, required this.referencingInterface, required this.indent, @@ -1106,7 +1092,7 @@ final class SetterSuggestion extends ImportableSuggestion final bool withEnclosingName; /// Initialize a newly created candidate suggestion to suggest the [element]. - SetterSuggestion({ + new({ required this.element, required super.importData, required this.referencingInterface, @@ -1157,7 +1143,7 @@ final class StaticFieldSuggestion extends ImportableSuggestion final FieldElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - StaticFieldSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -1199,10 +1185,7 @@ final class SuperParameterSuggestion extends CandidateSuggestion final FormalParameterElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - SuperParameterSuggestion({ - required this.element, - required super.matcherScore, - }); + new({required this.element, required super.matcherScore}); @override String get completion => element.displayName; @@ -1216,7 +1199,7 @@ final class TopLevelFunctionSuggestion extends ExecutableSuggestion final TopLevelFunctionElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - TopLevelFunctionSuggestion({ + new({ required super.importData, required this.element, required super.kind, @@ -1234,7 +1217,7 @@ final class TopLevelGetterSuggestion extends ImportableSuggestion final GetterElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - TopLevelGetterSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -1251,7 +1234,7 @@ final class TopLevelSetterSuggestion extends ImportableSuggestion final SetterElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - TopLevelSetterSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -1268,7 +1251,7 @@ final class TopLevelVariableSuggestion extends ImportableSuggestion final TopLevelVariableElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - TopLevelVariableSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -1285,7 +1268,7 @@ final class TypeAliasSuggestion extends ImportableSuggestion final TypeAliasElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - TypeAliasSuggestion({ + new({ required super.importData, required this.element, required super.matcherScore, @@ -1312,7 +1295,7 @@ sealed class TypedExecutableSuggestion extends ExecutableSuggestion @override final bool addTypeName; - TypedExecutableSuggestion({ + new({ required this.replacementRange, required super.importData, required super.kind, @@ -1344,7 +1327,7 @@ sealed class TypedImportableSuggestion extends ImportableSuggestion @override TypeImportData? data; - TypedImportableSuggestion({ + new({ required super.importData, required super.matcherScore, required this.replacementRange, @@ -1377,7 +1360,7 @@ sealed class TypedSuggestion extends ReplacementSuggestion { /// not enabled, the completion for `a` would replace `.` and insert `E.a`. final bool addTypeName; - TypedSuggestion({ + new({ required super.matcherScore, required super.replacementRange, required this.addTypeName, @@ -1422,7 +1405,7 @@ class TypeImportData { final int? selectionLength; - TypeImportData( + new( this.completion, this.displayText, this.imports, @@ -1438,7 +1421,7 @@ final class TypeParameterSuggestion extends CandidateSuggestion final TypeParameterElement element; /// Initialize a newly created candidate suggestion to suggest the [element]. - TypeParameterSuggestion({required this.element, required super.matcherScore}); + new({required this.element, required super.matcherScore}); @override String get completion => element.displayName; @@ -1448,7 +1431,7 @@ final class TypeParameterSuggestion extends CandidateSuggestion final class UriSuggestion extends CandidateSuggestion { final String uriStr; - UriSuggestion({required this.uriStr, required super.matcherScore}); + new({required this.uriStr, required super.matcherScore}); @override String get completion => uriStr; @@ -1462,7 +1445,7 @@ class _Data { String completion; - _Data(this.completion, this.selectionOffset, {this.displayText = ''}); + new(this.completion, this.selectionOffset, {this.displayText = ''}); } extension on String { diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart index 2ebc676c8e5..2f192ab1e38 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart @@ -47,7 +47,7 @@ class CompletionBudget { final Duration _budget; final Stopwatch _timer = Stopwatch()..start(); - CompletionBudget(this._budget); + new(this._budget); bool get isEmpty { return _timer.elapsed > _budget; @@ -84,7 +84,7 @@ class DartCompletionManager { /// `maxSuggestions` for a given request, and they were truncated to fit. bool isTruncated = false; - DartCompletionManager({ + new({ required this.budget, this.listener, this.skipImports = false, @@ -299,7 +299,7 @@ class DartCompletionRequest { return entity is Expression && entity.inConstantContext; }(); - factory DartCompletionRequest({ + factory({ required AnalysisSession analysisSession, required FileState fileState, required String filePath, @@ -355,7 +355,7 @@ class DartCompletionRequest { ); } - factory DartCompletionRequest.forResolvedUnit({ + factory forResolvedUnit({ required ResolvedUnitResult resolvedUnit, required int offset, DartdocDirectiveInfo? dartdocDirectiveInfo, @@ -375,7 +375,7 @@ class DartCompletionRequest { ); } - DartCompletionRequest._({ + new _({ required this.analysisSession, required this.completionPreference, required this.content, @@ -543,7 +543,7 @@ class TokenData { /// keyword, or if the selection offset is at the beginning of the token. final String prefix; - TokenData._(this.token, this.prefix); + new _(this.token, this.prefix); /// Returns token data representing the token containing the offset of the /// [selection], or `null` if the offset isn't within any token. diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_state.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_state.dart index 2b02803381a..52b36cba059 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/completion_state.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_state.dart @@ -32,7 +32,7 @@ class CompletionState { final CompletionMatcher matcher; /// Initialize a newly created completion state. - CompletionState(this.request, this.selection, this.budget, this.matcher) + new(this.request, this.selection, this.budget, this.matcher) : assert(selection.length == 0); /// The [CodeStyleOptions] used to format the completion text. diff --git a/pkg/analysis_server/lib/src/services/completion/dart/dart_completion_suggestion.dart b/pkg/analysis_server/lib/src/services/completion/dart/dart_completion_suggestion.dart index 3493493512f..6997923f578 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/dart_completion_suggestion.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/dart_completion_suggestion.dart @@ -11,7 +11,7 @@ class DartCompletionSuggestion extends CompletionSuggestion { final List requiredImports; final String? colorHex; - DartCompletionSuggestion( + new( super.kind, super.relevance, super.completion, diff --git a/pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart b/pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart index e9a869e57cf..6a4221c44b7 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart @@ -121,7 +121,7 @@ class DeclarationHelper { /// /// The flag [skipImports] is a temporary measure that will be removed after /// all of the suggestions are being produced by the various passes. - DeclarationHelper({ + new({ required this.request, required this.collector, required this.state, diff --git a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart index a42cb183aab..7413a2880f6 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart @@ -169,7 +169,7 @@ class FeatureComputer { final TypeProvider typeProvider; /// Initialize a newly created feature computer. - FeatureComputer(this.typeSystem, this.typeProvider); + new(this.typeSystem, this.typeProvider); /// Return the type imposed when completing at the given [offset], where the /// offset is within the given [node], or `null` if the context does not @@ -506,7 +506,7 @@ class _ContextTypeVisitor extends SimpleAstVisitor { int offset; - _ContextTypeVisitor(this.typeProvider, this.offset); + new(this.typeProvider, this.offset); @override DartType? visitAdjacentStrings(AdjacentStrings node) { diff --git a/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart b/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart index 194883467d9..6a7c5d26eeb 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/fuzzy_filter_sort.dart @@ -65,5 +65,5 @@ class _FuzzyScoredSuggestion { final CompletionSuggestionBuilder suggestion; final double score; - _FuzzyScoredSuggestion(this.suggestion, this.score); + new(this.suggestion, this.score); } diff --git a/pkg/analysis_server/lib/src/services/completion/dart/identifier_helper.dart b/pkg/analysis_server/lib/src/services/completion/dart/identifier_helper.dart index 41ac79b4387..90a8992fe80 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/identifier_helper.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/identifier_helper.dart @@ -22,7 +22,7 @@ class IdentifierHelper { final bool includePrivateIdentifiers; /// Initialize a newly created helper to add suggestions to the [collector]. - IdentifierHelper({ + new({ required this.state, required this.collector, required this.includePrivateIdentifiers, diff --git a/pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart b/pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart index 15620ed5220..ec6b5376bb6 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart @@ -87,7 +87,7 @@ class InScopeCompletionPass extends SimpleAstVisitor { /// /// The flag [skipImports] is a temporary measure that will be removed after /// all of the suggestions are being produced by the various passes. - InScopeCompletionPass({ + new({ required this.state, required this.collector, required this.skipImports, diff --git a/pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart b/pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart index 2182ace2342..4a3f79b81df 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart @@ -26,7 +26,7 @@ class KeywordHelper { final CompletionState state; /// Initialize a newly created helper to add suggestions to the [collector]. - KeywordHelper({ + new({ required this.collector, required this.featureSet, required this.offset, diff --git a/pkg/analysis_server/lib/src/services/completion/dart/label_helper.dart b/pkg/analysis_server/lib/src/services/completion/dart/label_helper.dart index 2f0b10dc673..5c3edf6932f 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/label_helper.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/label_helper.dart @@ -17,7 +17,7 @@ class LabelHelper { final CompletionState state; /// Initialize a newly created helper to add suggestions to the [collector]. - LabelHelper({required this.collector, required this.state}); + new({required this.collector, required this.state}); /// Add the labels that are visible at the `break` or `continue` [statement]. void addLabels(Statement statement) { diff --git a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_completion_pass.dart b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_completion_pass.dart index ccf033fd82d..2e48ce0334b 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_completion_pass.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_completion_pass.dart @@ -22,7 +22,7 @@ class ConstructorsOperation extends NotImportedOperation { /// Initialize a newly created operation to use the [_declarationHelper] to add /// the static members from a library. - ConstructorsOperation({required this._declarationHelper}); + new({required this._declarationHelper}); /// Compute any candidate suggestions for elements in the [library]. void computeSuggestionsIn(LibraryElement library) { @@ -48,7 +48,7 @@ class InstanceExtensionMembersOperation extends NotImportedOperation { /// Whether to include suggestions for setters. final bool _includeSetters; - InstanceExtensionMembersOperation({ + new({ required this._declarationHelper, required this._type, required this._excludedGetters, @@ -82,7 +82,7 @@ class NotImportedCompletionPass { final List _operations; /// Initialize a newly created completion pass. - NotImportedCompletionPass({ + new({ required this._state, required this._collector, required this._operations, @@ -186,7 +186,7 @@ class StaticMembersOperation extends NotImportedOperation { /// Initialize a newly created operation to use the [_declarationHelper] to add /// the static members from a library. - StaticMembersOperation({required this._declarationHelper}); + new({required this._declarationHelper}); /// Compute any candidate suggestions for elements in the [library]. void computeSuggestionsIn( @@ -208,7 +208,7 @@ class _ImportSummary { /// The libraries that are imported in their entirety. Set importedLibraries = Set.identity(); - _ImportSummary(LibraryElement library) { + new(LibraryElement library) { for (var fragment in library.fragments) { for (var import in fragment.libraryImports) { var importedLibrary = import.importedLibrary; diff --git a/pkg/analysis_server/lib/src/services/completion/dart/override_helper.dart b/pkg/analysis_server/lib/src/services/completion/dart/override_helper.dart index 4ddeffec801..60b4454bf92 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/override_helper.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/override_helper.dart @@ -20,7 +20,7 @@ class OverrideHelper { final SuggestionCollector collector; /// Initialize a newly created helper to add suggestions to the [collector]. - OverrideHelper({required this.state, required this.collector}); + new({required this.state, required this.collector}); void computeOverridesFor({ required InterfaceElement interfaceElement, diff --git a/pkg/analysis_server/lib/src/services/completion/dart/probability_range.dart b/pkg/analysis_server/lib/src/services/completion/dart/probability_range.dart index 5b6d32e117a..c365b5d68cd 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/probability_range.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/probability_range.dart @@ -12,7 +12,7 @@ class ProbabilityRange { /// Initialize a newly created probability range to have the given [lower] and /// [upper] bounds. - const ProbabilityRange({required this.lower, required this.upper}); + const new({required this.lower, required this.upper}); /// The middle of the range. double get middle => (upper + lower) / 2; diff --git a/pkg/analysis_server/lib/src/services/completion/dart/relevance_computer.dart b/pkg/analysis_server/lib/src/services/completion/dart/relevance_computer.dart index b4bba74db7e..de175a131bc 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/relevance_computer.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/relevance_computer.dart @@ -50,7 +50,7 @@ class RelevanceComputer { /// requested. String? completionLocation; - RelevanceComputer(this.request, this.listener, {required this.targetPrefix}) + new(this.request, this.listener, {required this.targetPrefix}) : featureComputer = request.featureComputer; /// Return the name of the member containing the completion location, or diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart index 150bc6ec5e7..725808e3090 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart @@ -106,7 +106,7 @@ class SuggestionBuilder { /// Initialize a newly created suggestion builder to build suggestions for the /// given [request]. - SuggestionBuilder(this.request, {this.listener, required this.useFilter}) + new(this.request, {this.listener, required this.useFilter}) : relevanceComputer = RelevanceComputer( request, listener, @@ -1621,10 +1621,7 @@ class ValueCompletionSuggestionBuilder implements CompletionSuggestionBuilder { final String? _textToMatchOverride; - ValueCompletionSuggestionBuilder( - this._suggestion, { - this._textToMatchOverride, - }); + new(this._suggestion, {this._textToMatchOverride}); @override String get completion => _suggestion.completion; @@ -1669,7 +1666,7 @@ class _CompletionSuggestionBuilderImpl implements CompletionSuggestionBuilder { final List requiredImports; final bool isNotImported; - _CompletionSuggestionBuilderImpl({ + new({ required this.orgElement, required this.suggestionBuilder, required this.kind, @@ -1744,7 +1741,7 @@ class _ElementCompletionData { final protocol.Element element; final String? colorHex; - _ElementCompletionData({ + new({ required this.isDeprecated, required this.declaringType, required this.returnType, @@ -1763,5 +1760,5 @@ class _ElementDocumentation { final String full; final String? summary; - _ElementDocumentation({required this.full, required this.summary}); + new({required this.full, required this.summary}); } diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_collector.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_collector.dart index ef21938b2c3..4c8cf927aa4 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_collector.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_collector.dart @@ -37,7 +37,7 @@ class SuggestionCollector { /// - reduces the amount of memory used during completion /// - reduces the number of suggestions that need to have relevance scores and /// that need to be converted to the form used by the protocol - SuggestionCollector({required this.maxSuggestions}); + new({required this.maxSuggestions}); /// Adds the candidate [suggestion] to the list of suggestions. /// diff --git a/pkg/analysis_server/lib/src/services/completion/dart/uri_helper.dart b/pkg/analysis_server/lib/src/services/completion/dart/uri_helper.dart index 2935713e695..b573b2b8b6a 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/uri_helper.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/uri_helper.dart @@ -24,11 +24,7 @@ class UriHelper { /// The state used to compute the candidate suggestions. final CompletionState state; - UriHelper({ - required this.request, - required this.collector, - required this.state, - }); + new({required this.request, required this.collector, required this.state}); void addSuggestions(StringLiteral uri) { if (uri is! SimpleStringLiteral) { diff --git a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart index 9ccb03f363a..27bd406d584 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart @@ -283,7 +283,7 @@ class CompletionDefaultArgumentList { final String? text; final List? ranges; - CompletionDefaultArgumentList({required this.text, required this.ranges}); + new({required this.text, required this.ranges}); } /// A tuple of text to insert and an (optional) location for the cursor. @@ -295,5 +295,5 @@ class DefaultArgument { /// field can be null. final int? cursorPosition; - DefaultArgument(this.text, {this.cursorPosition}); + new(this.text, {this.cursorPosition}); } diff --git a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart index 3ee76e6b261..09600acbde2 100644 --- a/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart +++ b/pkg/analysis_server/lib/src/services/completion/postfix/postfix_completion.dart @@ -325,7 +325,7 @@ class PostfixCompletion { /// Initialize a newly created completion to have the given [kind] and /// [change]. - PostfixCompletion(this.kind, this.change); + new(this.kind, this.change); } /// The context for computing a postfix completion. @@ -334,7 +334,7 @@ class PostfixCompletionContext { final int selectionOffset; final String key; - PostfixCompletionContext(this.resolveResult, this.selectionOffset, this.key); + new(this.resolveResult, this.selectionOffset, this.key); } /// A description of a template for postfix completion. Instances are intended @@ -352,12 +352,7 @@ class PostfixCompletionKind { ) computer; - const PostfixCompletionKind( - this.name, - this.example, - this.selector, - this.computer, - ); + const new(this.name, this.example, this.selector, this.computer); String get key => name == '!' ? name : '.$name'; @@ -379,7 +374,7 @@ final class PostfixCompletionProcessor { AstNode? _node; PostfixCompletion? _completion; - PostfixCompletionProcessor(this._completionContext) + new(this._completionContext) : utils = CorrectionUtils(_completionContext.resolveResult); String get _eol => utils.endOfLine; diff --git a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart index d19f8da164a..23186bac31a 100644 --- a/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart +++ b/pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart @@ -97,7 +97,7 @@ class StatementCompletion { /// Initialize a newly created completion to have the given [kind] and /// [change]. - StatementCompletion(this.kind, this.change); + new(this.kind, this.change); } /// The context for computing a statement completion. @@ -105,7 +105,7 @@ class StatementCompletionContext { final ResolvedUnitResult resolveResult; final int selectionOffset; - StatementCompletionContext(this.resolveResult, this.selectionOffset); + new(this.resolveResult, this.selectionOffset); } /// A description of a class of statement completions. Instances are intended to @@ -123,7 +123,7 @@ class StatementCompletionKind { /// Initialize a newly created kind of statement completion to have the given /// [name] and [message]. - const StatementCompletionKind(this.name, this.message); + const new(this.name, this.message); @override String toString() => name; @@ -149,7 +149,7 @@ class StatementCompletionProcessor { {}; Position? exitPosition; - StatementCompletionProcessor(this.statementContext) + new(this.statementContext) : utils = CorrectionUtils(statementContext.resolveResult); String get eol => utils.endOfLine; @@ -1323,7 +1323,7 @@ class _KeywordConditionBlockStructure { final AstNode condition; final Statement? block; - _KeywordConditionBlockStructure( + new( this.keyword, this.leftParenthesis, this.condition, diff --git a/pkg/analysis_server/lib/src/services/completion/yaml/analysis_options_generator.dart b/pkg/analysis_server/lib/src/services/completion/yaml/analysis_options_generator.dart index 6076cfe6fe7..9a56d62192a 100644 --- a/pkg/analysis_server/lib/src/services/completion/yaml/analysis_options_generator.dart +++ b/pkg/analysis_server/lib/src/services/completion/yaml/analysis_options_generator.dart @@ -56,8 +56,7 @@ class AnalysisOptionsGenerator extends YamlCompletionGenerator { /// Initialize a newly created suggestion generator for analysis options /// files. - AnalysisOptionsGenerator(ResourceProvider resourceProvider) - : super(resourceProvider, null); + new(ResourceProvider resourceProvider) : super(resourceProvider, null); @override Producer get topLevelProducer => analysisOptionsProducer; @@ -88,7 +87,7 @@ class _ErrorProducer extends KeyValueProducer { class _ExperimentProducer extends Producer { /// Initialize a location whose valid values are the names of the known /// experimental features. - const _ExperimentProducer(); + const new(); @override Iterable suggestions(YamlCompletionRequest request) { @@ -102,7 +101,7 @@ class _ExperimentProducer extends Producer { class _LintRuleProducer extends Producer { /// Initialize a location whose valid values are the names of the registered /// lint rules. - const _LintRuleProducer(); + const new(); @override Iterable suggestions(YamlCompletionRequest request) { diff --git a/pkg/analysis_server/lib/src/services/completion/yaml/fix_data_generator.dart b/pkg/analysis_server/lib/src/services/completion/yaml/fix_data_generator.dart index c59cbf8f707..96c98cfd38d 100644 --- a/pkg/analysis_server/lib/src/services/completion/yaml/fix_data_generator.dart +++ b/pkg/analysis_server/lib/src/services/completion/yaml/fix_data_generator.dart @@ -82,8 +82,7 @@ class FixDataGenerator extends YamlCompletionGenerator { }); /// Initialize a newly created suggestion generator for fix data files. - FixDataGenerator(ResourceProvider resourceProvider) - : super(resourceProvider, null); + new(ResourceProvider resourceProvider) : super(resourceProvider, null); @override Producer get topLevelProducer => fixDataProducer; diff --git a/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart b/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart index 8a88a7d0ffa..cd35c273af3 100644 --- a/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart +++ b/pkg/analysis_server/lib/src/services/completion/yaml/producer.dart @@ -10,7 +10,7 @@ import 'package:path/path.dart' as path; /// An object that represents the location of a Boolean value. class BooleanProducer extends Producer { /// Initialize a location whose valid values are Booleans. - const BooleanProducer(); + const new(); @override Iterable suggestions( @@ -25,7 +25,7 @@ class BooleanProducer extends Producer { /// placeholders when there are no reasonable suggestions for a given location. class EmptyProducer extends Producer { /// Initialize a location whose valid values are arbitrary. - const EmptyProducer(); + const new(); @override Iterable suggestions( @@ -42,7 +42,7 @@ class EnumProducer extends Producer { final List values; /// Initialize a location whose valid values are in the list of [values]. - const EnumProducer(this.values); + const new(this.values); @override Iterable suggestions( @@ -57,7 +57,7 @@ class EnumProducer extends Producer { /// An object that represents the location of a possibly relative file path. class FilePathProducer extends Producer { /// Initialize a producer whose valid values are file paths. - const FilePathProducer(); + const new(); @override Iterable suggestions( @@ -120,7 +120,7 @@ class FilePathProducer extends Producer { /// An object that represents the location of the keys/values in a map. abstract class KeyValueProducer extends Producer { /// Initialize a producer representing a key/value pair in a map. - const KeyValueProducer(); + const new(); /// Returns a producer for values of the given [key], or `null` if there is /// no registered producer for the [key]. @@ -134,7 +134,7 @@ class ListProducer extends Producer { /// Initialize a location whose valid values are determined by the [element] /// producer. - const ListProducer(this.element); + const new(this.element); @override Iterable suggestions( @@ -159,7 +159,7 @@ class MapProducer extends KeyValueProducer { /// Initialize a location whose valid values are the keys of a map as encoded /// by the map of [_children]. - const MapProducer(this._children); + const new(this._children); @override Producer? producerForKey(String key) => _children[key]; @@ -183,7 +183,7 @@ class MapProducer extends KeyValueProducer { /// that location. abstract class Producer { /// Initialize a newly created instance of this class. - const Producer(); + const new(); /// A utility method used to create a suggestion for the [identifier]. CompletionSuggestion identifier( @@ -234,7 +234,7 @@ class YamlCompletionRequest { final String precedingText; /// Initialize a newly created completion request. - YamlCompletionRequest({ + new({ required this.filePath, required this.precedingText, required this.resourceProvider, diff --git a/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart b/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart index 3ac2cbb8353..0192e431470 100644 --- a/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart +++ b/pkg/analysis_server/lib/src/services/completion/yaml/pubspec_generator.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/services/pub/pub_package_service.dart'; /// An object that represents the location of a package name. class PubPackageNameProducer extends KeyValueProducer { - const PubPackageNameProducer(); + const new(); @override Producer producerForKey(String key) => PubPackageVersionProducer(key); @@ -34,7 +34,7 @@ class PubPackageNameProducer extends KeyValueProducer { class PubPackageVersionProducer extends Producer { final String package; - const PubPackageVersionProducer(this.package); + const new(this.package); @override Iterable suggestions( @@ -154,10 +154,7 @@ class PubspecGenerator extends YamlCompletionGenerator { }); /// Initialize a newly created suggestion generator for pubspec files. - PubspecGenerator( - super.resourceProvider, - PubPackageService super.pubPackageService, - ); + new(super.resourceProvider, PubPackageService super.pubPackageService); @override Producer get topLevelProducer => pubspecProducer; diff --git a/pkg/analysis_server/lib/src/services/completion/yaml/yaml_completion_generator.dart b/pkg/analysis_server/lib/src/services/completion/yaml/yaml_completion_generator.dart index 3b704e6e9eb..eb625c6169a 100644 --- a/pkg/analysis_server/lib/src/services/completion/yaml/yaml_completion_generator.dart +++ b/pkg/analysis_server/lib/src/services/completion/yaml/yaml_completion_generator.dart @@ -23,7 +23,7 @@ abstract class YamlCompletionGenerator { /// Initialize a newly created generator to use the [resourceProvider] to /// access the content of the file in which completion was requested. - YamlCompletionGenerator(this.resourceProvider, this.pubPackageService); + new(this.resourceProvider, this.pubPackageService); /// Return the producer used to produce suggestions at the top-level of the /// file. @@ -220,14 +220,14 @@ class YamlCompletionResults { final int replacementOffset; final int replacementLength; - const YamlCompletionResults( + const new( this.suggestions, this.targetPrefix, this.replacementOffset, this.replacementLength, ); - const YamlCompletionResults.empty() + const new empty() : suggestions = const [], targetPrefix = '', replacementOffset = 0, diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart index 8755a96eb75..32ef61dd36c 100644 --- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart +++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart @@ -174,7 +174,7 @@ class BulkFixProcessor { /// Initialize a newly created processor to create fixes for diagnostics in /// libraries in the [_workspace]. - BulkFixProcessor( + new( this._instrumentationService, this._workspace, { List? codes, @@ -1008,9 +1008,9 @@ class BulkFixRequestResult { final ChangeBuilder? builder; final String? errorMessage; - BulkFixRequestResult(this.builder) : errorMessage = null; + new(this.builder) : errorMessage = null; - BulkFixRequestResult.error(this.errorMessage) : builder = null; + new error(this.errorMessage) : builder = null; } /// Maps changes to library paths. @@ -1052,7 +1052,7 @@ class IterativeBulkFixProcessor { /// invalid). final CancellationToken? _cancellationToken; - IterativeBulkFixProcessor({ + new({ required this._instrumentationService, required this._context, required this._applyTemporaryOverlayEdits, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_async.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_async.dart index 47625176d76..1735a492778 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_async.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_async.dart @@ -15,16 +15,14 @@ class AddAsync extends ResolvedCorrectionProducer { final _Type _type; /// Initialize a newly created producer. - AddAsync({required super.context}) : _type = _Type.others; + new({required super.context}) : _type = _Type.others; - AddAsync.discardedFutures({required super.context}) + new discardedFutures({required super.context}) : _type = _Type.discardedFutures; - AddAsync.missingReturn({required super.context}) - : _type = _Type.missingReturn; + new missingReturn({required super.context}) : _type = _Type.missingReturn; - AddAsync.wrongReturnType({required super.context}) - : _type = _Type.wrongReturnType; + new wrongReturnType({required super.context}) : _type = _Type.wrongReturnType; @override CorrectionApplicability get applicability => @@ -191,7 +189,7 @@ class _ReturnFinder extends RecursiveAstVisitor { bool foundReturn = false; /// Initialize a newly created visitor. - _ReturnFinder(); + new(); @override void visitFunctionExpression(FunctionExpression node) { @@ -221,7 +219,7 @@ class _ReturnTypeTester extends RecursiveAstVisitor { final DartType futureOf; /// Initialize a newly created visitor. - _ReturnTypeTester(this.typeSystem, this.futureOf); + new(this.typeSystem, this.futureOf); /// Tests whether a type is assignable to the [futureOf] type. bool isAssignable(DartType type) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_await.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_await.dart index 5d5c49823f8..66f22cb571a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_await.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_await.dart @@ -13,19 +13,18 @@ class AddAwait extends ResolvedCorrectionProducer { /// The kind of correction to be made. final _CorrectionKind _correctionKind; - AddAwait.argumentType({required super.context}) - : _correctionKind = .argumentType; + new argumentType({required super.context}) : _correctionKind = .argumentType; - AddAwait.assignment({required super.context}) + new assignment({required super.context}) : _correctionKind = .invalidAssignment; - AddAwait.forIn({required super.context}) : _correctionKind = .forIn; + new forIn({required super.context}) : _correctionKind = .forIn; - AddAwait.nonBool({required super.context}) : _correctionKind = .nonBool; + new nonBool({required super.context}) : _correctionKind = .nonBool; - AddAwait.return_({required super.context}) : _correctionKind = .return_; + new return_({required super.context}) : _correctionKind = .return_; - AddAwait.unawaited({required super.context}) : _correctionKind = .unawaited; + new unawaited({required super.context}) : _correctionKind = .unawaited; @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart index fff719043ce..aee553a0a49 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class AddCallSuper extends ResolvedCorrectionProducer { var _addition = ''; - AddCallSuper({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_class_modifier.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_class_modifier.dart index 0d65827d4ca..0f3ad145840 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_class_modifier.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_class_modifier.dart @@ -18,21 +18,21 @@ class AddClassModifier extends ResolvedCorrectionProducer { @override final FixKind multiFixKind; - AddClassModifier.baseModifier({required CorrectionProducerContext context}) + new baseModifier({required CorrectionProducerContext context}) : this._( context: context, modifier: 'base', fixKind: DartFixKind.addClassModifierBase, multiFixKind: DartFixKind.addClassModifierBaseMulti, ); - AddClassModifier.finalModifier({required CorrectionProducerContext context}) + new finalModifier({required CorrectionProducerContext context}) : this._( context: context, modifier: 'final', fixKind: DartFixKind.addClassModifierFinal, multiFixKind: DartFixKind.addClassModifierFinalMulti, ); - AddClassModifier.sealedModifier({required CorrectionProducerContext context}) + new sealedModifier({required CorrectionProducerContext context}) : this._( context: context, modifier: 'sealed', @@ -40,7 +40,7 @@ class AddClassModifier extends ResolvedCorrectionProducer { multiFixKind: DartFixKind.addClassModifierSealedMulti, ); - AddClassModifier._({ + new _({ required super.context, required this.modifier, required this.fixKind, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_const.dart index 7efcb42ca21..6a3a2c59e7d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_const.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_const.dart @@ -17,7 +17,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:linter/src/diagnostic.dart' as diag; class AddConst extends ResolvedCorrectionProducer { - AddConst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart index 425111d1a32..afe8c2f2b35 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart @@ -19,7 +19,7 @@ import 'package:linter/src/diagnostic.dart' as diag; import 'package:linter/src/lint_names.dart'; class AddDiagnosticPropertyReference extends ResolvedCorrectionProducer { - AddDiagnosticPropertyReference({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -454,7 +454,7 @@ class _PropertyInfo { final String constructorName; final TypeAnnotation? declType; - _PropertyInfo( + new( this.name, this.type, this.constructorId, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_digit_separators.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_digit_separators.dart index d9b70efacef..717af947ac4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_digit_separators.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_digit_separators.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class AddDigitSeparatorEveryThreeDigits extends _AddDigitSeparators { - AddDigitSeparatorEveryThreeDigits({required super.context}); + new({required super.context}); @override int get _digitsPerGroup => 3; @@ -30,7 +30,7 @@ class AddDigitSeparatorEveryThreeDigits extends _AddDigitSeparators { } class AddDigitSeparatorEveryTwoDigits extends _AddDigitSeparators { - AddDigitSeparatorEveryTwoDigits({required super.context}); + new({required super.context}); @override int get _digitsPerGroup => 2; @@ -46,7 +46,7 @@ class AddDigitSeparatorEveryTwoDigits extends _AddDigitSeparators { } abstract class _AddDigitSeparators extends ResolvedCorrectionProducer { - _AddDigitSeparators({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_empty_argument_list.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_empty_argument_list.dart index 4721b6144a7..ffc9ac601c9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_empty_argument_list.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_empty_argument_list.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddEmptyArgumentList extends ResolvedCorrectionProducer { - AddEmptyArgumentList({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart index 96a1b113a40..fbf858ae0b0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart @@ -16,7 +16,7 @@ class AddEnumConstant extends ResolvedCorrectionProducer { /// The name of the constant to be created. String _constantName = ''; - AddEnumConstant({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_eol_at_end_of_file.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_eol_at_end_of_file.dart index c000c45be34..c42e951b194 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_eol_at_end_of_file.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_eol_at_end_of_file.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddEolAtEndOfFile extends ResolvedCorrectionProducer { - AddEolAtEndOfFile({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_call.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_call.dart index f16de2bde64..50d2c820d9a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_call.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_call.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class AddExplicitCall extends ResolvedCorrectionProducer { - AddExplicitCall({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart index 9fe1eeef1b3..f75b44e9ddf 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class AddExplicitCast extends ResolvedCorrectionProducer { - AddExplicitCast({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_extension_override.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_extension_override.dart index 6e3824ebb31..4cafbf55bae 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_extension_override.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_extension_override.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddExtensionOverride extends MultiCorrectionProducer { - AddExtensionOverride({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -65,7 +65,7 @@ class _AddOverride extends ResolvedCorrectionProducer { /// The extension name to be inserted. final String _name; - _AddOverride(this._expression, this._name, {required super.context}); + new(this._expression, this._name, {required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart index 439b351f5f9..41f11fff756 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart @@ -21,11 +21,11 @@ class AddFieldFormalParameters extends ResolvedCorrectionProducer { @override final FixKind fixKind; - AddFieldFormalParameters({required super.context}) + new({required super.context}) : _style = _Style.base, fixKind = DartFixKind.addInitializingFormalParameters; - AddFieldFormalParameters.requiredNamed({required super.context}) + new requiredNamed({required super.context}) : _style = _Style.requiredNamed, fixKind = DartFixKind.addInitializingFormalNamedParameters; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart index 64988a9572e..85c3ff45b8e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart @@ -17,7 +17,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; class AddKeyToConstructors extends ResolvedCorrectionProducer { - AddKeyToConstructors({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_late.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_late.dart index 5c629df2d77..69b9db09a38 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_late.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_late.dart @@ -17,9 +17,9 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddLate extends ResolvedCorrectionProducer { final _Type _type; - AddLate({required super.context}) : _type = _Type.base; + new({required super.context}) : _type = _Type.base; - AddLate.this_({required super.context}) : _type = _Type.this_; + new this_({required super.context}) : _type = _Type.this_; @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_leading_newline_to_string.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_leading_newline_to_string.dart index 67021001448..11f5c9fd8ed 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_leading_newline_to_string.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_leading_newline_to_string.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddLeadingNewlineToString extends ResolvedCorrectionProducer { - AddLeadingNewlineToString({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart index 264e1568503..b4ff5a7f0b0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddMissingEnumCaseClauses extends ResolvedCorrectionProducer { - AddMissingEnumCaseClauses({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart index 44a45436341..78ff44bb782 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddMissingEnumLikeCaseClauses extends ResolvedCorrectionProducer { - AddMissingEnumLikeCaseClauses({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart index c6ab12ca04c..1e62af63b28 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddMissingParameter extends MultiCorrectionProducer { - AddMissingParameter({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -66,10 +66,7 @@ class AddMissingParameter extends MultiCorrectionProducer { /// A correction processor that can make one of the possible changes computed by /// the [AddMissingParameter] producer. class _AddMissingOptionalPositionalParameter extends _AddMissingParameter { - _AddMissingOptionalPositionalParameter( - super.executableParameters, { - required super.context, - }); + new(super.executableParameters, {required super.context}); @override FixKind get fixKind => DartFixKind.addMissingParameterPositional; @@ -99,7 +96,7 @@ class _AddMissingOptionalPositionalParameter extends _AddMissingParameter { abstract class _AddMissingParameter extends ResolvedCorrectionProducer { final ExecutableParameters _executableParameters; - _AddMissingParameter(this._executableParameters, {required super.context}); + new(this._executableParameters, {required super.context}); @override CorrectionApplicability get applicability => @@ -175,10 +172,7 @@ abstract class _AddMissingParameter extends ResolvedCorrectionProducer { /// A correction processor that can make one of the possible changes computed by /// the [AddMissingParameter] producer. class _AddMissingRequiredPositionalParameter extends _AddMissingParameter { - _AddMissingRequiredPositionalParameter( - super._executableParameters, { - required super.context, - }); + new(super._executableParameters, {required super.context}); @override FixKind get fixKind => DartFixKind.addMissingParameterRequired; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter_named.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter_named.dart index 55967abb68e..1005efe7f41 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter_named.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter_named.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddMissingParameterNamed extends ResolvedCorrectionProducer { String _parameterName = ''; - AddMissingParameterNamed({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_required_argument.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_required_argument.dart index c64327388b5..3778d031610 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_required_argument.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_required_argument.dart @@ -20,7 +20,7 @@ class AddMissingRequiredArgument extends ResolvedCorrectionProducer { /// The number of the parameters missing. late int _missingParameters; - AddMissingRequiredArgument({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart index 6881f32b3ee..367dab1b33e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddMissingSwitchCases extends ResolvedCorrectionProducer { - AddMissingSwitchCases({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_ne_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_ne_null.dart index 7ed7abcf374..145b1aa2b25 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_ne_null.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_ne_null.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddNeNull extends CorrectionProducerWithDiagnostic { - AddNeNull({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart index 8a5d4e9ff5c..725372a78a9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart @@ -34,7 +34,7 @@ class AddNullCheck extends ResolvedCorrectionProducer { /// operator token. final Token? _nullAwareToken; - factory AddNullCheck({required CorrectionProducerContext context}) { + factory({required CorrectionProducerContext context}) { var (:target, :nullAwareToken) = context is StubCorrectionProducerContext ? (target: null, nullAwareToken: null) : _computeTargetAndNullAwareToken(context.node); @@ -48,7 +48,7 @@ class AddNullCheck extends ResolvedCorrectionProducer { ); } - factory AddNullCheck.withoutAssignabilityCheck({ + factory withoutAssignabilityCheck({ required CorrectionProducerContext context, }) { var (:target, :nullAwareToken) = context is StubCorrectionProducerContext @@ -64,7 +64,7 @@ class AddNullCheck extends ResolvedCorrectionProducer { ); } - AddNullCheck._({ + new _({ required super.context, required this.skipAssignabilityCheck, required this.applicability, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_override.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_override.dart index 2e6af82fb9c..762e9d8377e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_override.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_override.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class AddOverride extends ResolvedCorrectionProducer { - AddOverride({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_redeclare.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_redeclare.dart index ab3c5ee37b5..b0322debb3a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_redeclare.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_redeclare.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddRedeclare extends ResolvedCorrectionProducer { - AddRedeclare({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_reopen.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_reopen.dart index 861ef25ae1c..a97eeaa7d4e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_reopen.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_reopen.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class AddReopen extends ResolvedCorrectionProducer { - AddReopen({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_required_keyword.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_required_keyword.dart index 8fe9b7412be..606ca2048fa 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_required_keyword.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_required_keyword.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddRequiredKeyword extends ResolvedCorrectionProducer { - AddRequiredKeyword({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_return_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_return_null.dart index 399ac7e7d21..b981f1c2c38 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_return_null.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_return_null.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddReturnNull extends ResolvedCorrectionProducer { - AddReturnNull({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart index 36768a32a55..e553d401906 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddReturnType extends ResolvedCorrectionProducer { - AddReturnType({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => .automatically; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_static.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_static.dart index 18d6d97b8d1..d72594c4709 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_static.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_static.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddStatic extends ResolvedCorrectionProducer { - AddStatic({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart index b630db537b0..0bbe5b4e04e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class AddSuperConstructorInvocation extends MultiCorrectionProducer { - AddSuperConstructorInvocation({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -181,7 +181,7 @@ class _AddInvocation extends ResolvedCorrectionProducer { /// The suffix to be added after the actual invocation. final List _suffixParts; - _AddInvocation({ + new({ required super.context, required this._constructor, required this._editRange, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_super_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_super_parameter.dart index 0fe1a0d12f9..650c2262593 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_super_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_super_parameter.dart @@ -17,7 +17,7 @@ import 'package:collection/collection.dart'; class AddSuperParameter extends ResolvedCorrectionProducer { int _missingCount = 0; - AddSuperParameter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_switch_case_break.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_switch_case_break.dart index 3be835be895..f91d57cf436 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_switch_case_break.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_switch_case_break.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:collection/collection.dart'; class AddSwitchCaseBreak extends ResolvedCorrectionProducer { - AddSwitchCaseBreak({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_trailing_comma.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_trailing_comma.dart index a02c10ce482..5ad8b7a506b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_trailing_comma.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_trailing_comma.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddTrailingComma extends ResolvedCorrectionProducer { - AddTrailingComma({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart index 71e40463138..4faf04dcf39 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart @@ -23,11 +23,11 @@ class AddTypeAnnotation extends ResolvedCorrectionProducer { /// Initializes a newly created instance that can't apply bulk and in-file /// fixes. - AddTypeAnnotation({required super.context}) + new({required super.context}) : applicability = CorrectionApplicability.singleLocation; /// Initializes a newly created instance that can apply bulk and in-file fixes. - AddTypeAnnotation.bulkFixable({required super.context}) + new bulkFixable({required super.context}) : applicability = CorrectionApplicability.automatically; @override @@ -245,7 +245,7 @@ class _AssignedTypeCollector extends RecursiveAstVisitor { /// The types that are assigned to the variable. final Set assignedTypes = {}; - _AssignedTypeCollector(this.typeSystem, this.variable); + new(this.typeSystem, this.variable); DartType? get bestType { if (assignedTypes.isEmpty) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_type_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_type_name.dart index de9225b9003..bba5c87fc34 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_type_name.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_type_name.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddTypeName extends ResolvedCorrectionProducer { - AddTypeName({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => .automatically; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/ambiguous_import_fix.dart b/pkg/analysis_server/lib/src/services/correction/dart/ambiguous_import_fix.dart index 23b55776dd3..43aaf056f9d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/ambiguous_import_fix.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/ambiguous_import_fix.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; class AmbiguousImportFix extends MultiCorrectionProducer { - AmbiguousImportFix({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -157,7 +157,7 @@ class _ImportAddHide extends ResolvedCorrectionProducer { final String? prefix; final String _elementName; - _ImportAddHide( + new( this._elementName, this.uri, this.prefix, @@ -230,7 +230,7 @@ class _ImportRemoveShow extends ResolvedCorrectionProducer { final String uri; final String? prefix; - _ImportRemoveShow( + new( this._elementName, this.uri, this.prefix, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/assign_to_local_variable.dart b/pkg/analysis_server/lib/src/services/correction/dart/assign_to_local_variable.dart index c1b3afdd5e6..f8e2e3cb8df 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/assign_to_local_variable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/assign_to_local_variable.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; class AssignToLocalVariable extends ResolvedCorrectionProducer { - AssignToLocalVariable({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/bind_all_to_fields.dart b/pkg/analysis_server/lib/src/services/correction/dart/bind_all_to_fields.dart index 5262fb857fd..4ad18d533bd 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/bind_all_to_fields.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/bind_all_to_fields.dart @@ -20,7 +20,7 @@ import 'create_constructor.dart'; /// parameter and declaring the corresponding field. This matches a workflow /// with the [CreateConstructor] assist. class BindAllToFields extends ResolvedCorrectionProducer { - BindAllToFields({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/bind_to_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/bind_to_field.dart index e9b903ce02e..e95ac2790ef 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/bind_to_field.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/bind_to_field.dart @@ -24,7 +24,7 @@ import 'create_constructor.dart'; /// parameter and declaring the corresponding field. This matches a workflow /// with the [CreateConstructor] assist. class BindToField extends ResolvedCorrectionProducer { - BindToField({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/change_argument_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/change_argument_name.dart index 62ca105216f..0c3f3a77335 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/change_argument_name.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/change_argument_name.dart @@ -17,7 +17,7 @@ class ChangeArgumentName extends MultiCorrectionProducer { /// replacement before the replacement is deemed to not be worth offering. static const _maxDistance = 4; - ChangeArgumentName({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -95,7 +95,7 @@ class _ChangeName extends ResolvedCorrectionProducer { /// The name to which the argument name will be changed. final String _proposedName; - _ChangeName(this._argumentName, this._proposedName, {required super.context}); + new(this._argumentName, this._proposedName, {required super.context}); @override CorrectionApplicability get applicability => @@ -120,5 +120,5 @@ class _NamedArgumentContext { final Token nameToken; final List names; - _NamedArgumentContext(this.nameToken, this.names); + new(this.nameToken, this.names); } diff --git a/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart b/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart index d27d5357b89..286de7c6a4a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart @@ -26,31 +26,30 @@ class ChangeTo extends ResolvedCorrectionProducer { String _proposedName = ''; /// Initializes a newly created instance that will propose classes and mixins. - ChangeTo.annotation({required super.context}) + new annotation({required super.context}) : _kind = _ReplacementKind.annotation; /// Initializes a newly created instance that will propose classes and mixins. - ChangeTo.classOrMixin({required super.context}) + new classOrMixin({required super.context}) : _kind = _ReplacementKind.classOrMixin; /// Initializes a newly created instance that will propose fields. - ChangeTo.field({required super.context}) : _kind = _ReplacementKind.field; + new field({required super.context}) : _kind = _ReplacementKind.field; /// Initializes a newly created instance that will propose functions. - ChangeTo.function({required super.context}) - : _kind = _ReplacementKind.function; + new function({required super.context}) : _kind = _ReplacementKind.function; /// Initializes a newly created instance that will propose getters and /// setters. - ChangeTo.getterOrSetter({required super.context}) + new getterOrSetter({required super.context}) : _kind = _ReplacementKind.getterOrSetter; /// Initializes a newly created instance that will propose methods. - ChangeTo.method({required super.context}) : _kind = _ReplacementKind.method; + new method({required super.context}) : _kind = _ReplacementKind.method; /// Initializes a newly created instance that will propose super formal /// parameters. - ChangeTo.superFormalParameter({required super.context}) + new superFormalParameter({required super.context}) : _kind = _ReplacementKind.superFormalParameter; @override @@ -426,7 +425,7 @@ class _ClosestElementFinder { Element? _element; - _ClosestElementFinder(this._targetName, this._predicate); + new(this._targetName, this._predicate); void _update(Element element) { if (_predicate(element)) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/change_to_nearest_precise_value.dart b/pkg/analysis_server/lib/src/services/correction/dart/change_to_nearest_precise_value.dart index 3ac3d2e9914..878e8399ffc 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/change_to_nearest_precise_value.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/change_to_nearest_precise_value.dart @@ -13,7 +13,7 @@ class ChangeToNearestPreciseValue extends ResolvedCorrectionProducer { /// The value to which the code will be changed. String _correction = ''; - ChangeToNearestPreciseValue({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/change_to_static_access.dart b/pkg/analysis_server/lib/src/services/correction/dart/change_to_static_access.dart index ef2702a24b3..0a280c8cd9a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/change_to_static_access.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/change_to_static_access.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class ChangeToStaticAccess extends ResolvedCorrectionProducer { String _className = ''; - ChangeToStaticAccess({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/change_type_annotation.dart b/pkg/analysis_server/lib/src/services/correction/dart/change_type_annotation.dart index 4e34682f638..58f3a99f244 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/change_type_annotation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/change_type_annotation.dart @@ -16,7 +16,7 @@ class ChangeTypeAnnotation extends ResolvedCorrectionProducer { String _newAnnotation = ''; - ChangeTypeAnnotation({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_add_all_to_spread.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_add_all_to_spread.dart index b03e409f26a..4cdf537cb1c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_add_all_to_spread.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_add_all_to_spread.dart @@ -22,7 +22,7 @@ class ConvertAddAllToSpread extends ResolvedCorrectionProducer { final MethodInvocation? _invocation; - factory ConvertAddAllToSpread({required CorrectionProducerContext context}) { + factory({required CorrectionProducerContext context}) { if (context is StubCorrectionProducerContext) { return ConvertAddAllToSpread._( context: context, @@ -61,7 +61,7 @@ class ConvertAddAllToSpread extends ResolvedCorrectionProducer { ); } - ConvertAddAllToSpread._({ + new _({ required super.context, required this._invocation, required this._isInlineInvocation, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart index 8f8867de47b..9500f4e9bfa 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart @@ -38,7 +38,7 @@ typedef _Constructors = Map; /// one, and it no longer accepts any arguments (after removing a possible /// index parameter), and it has no doc comment nor annotations. class ConvertClassToEnum extends ResolvedCorrectionProducer { - ConvertClassToEnum({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -90,7 +90,7 @@ class _BaseVisitor extends RecursiveAstVisitor { /// The element representing the enum declaration that's being visited. final ClassElement classElement; - _BaseVisitor(this.classElement); + new(this.classElement); /// Return `true` if the given [node] is an invocation of a generative /// constructor from the class being converted. @@ -107,7 +107,7 @@ class _BaseVisitor extends RecursiveAstVisitor { class _CannotConvertException implements Exception { final String message; - _CannotConvertException(this.message); + new(this.message); } /// A representation of a static field in the class being converted that will be @@ -122,7 +122,7 @@ class _ConstantField extends _FieldDeclaredInVariableDeclaration { /// The value of the index field. final int indexValue; - _ConstantField( + new( super.element, super.declaration, super.declarationList, @@ -145,7 +145,7 @@ class _Constructor { /// The element representing the constructor. final ConstructorElement element; - _Constructor(this.declaration, this.parameters, this.element) + new(this.declaration, this.parameters, this.element) : assert( declaration is ConstructorDeclaration || declaration is PrimaryConstructorDeclaration, @@ -177,7 +177,7 @@ class _EnumDescription { /// The indexes of primary constructor parameters that need to be deleted. final List parametersToDelete = []; - _EnumDescription({ + new({ required this.classDeclaration, required this._constructorMap, required this.fieldsToConvert, @@ -788,7 +788,7 @@ class _EnumVisitor extends _BaseVisitor { /// Initialize a newly created visitor to visit the class declaration /// corresponding to the given [classElement]. - _EnumVisitor(super.classElement, List<_ConstantField> fieldsToConvert) + new(super.classElement, List<_ConstantField> fieldsToConvert) : fieldsToConvert = fieldsToConvert .map((field) => field.declaration) .toList(); @@ -833,11 +833,7 @@ class _FieldDeclaredInPrimaryConstructor implements _Field { /// The parameter that corresponds to [element]. final FormalParameter parameter; - _FieldDeclaredInPrimaryConstructor( - this.element, - this.parameterList, - this.parameter, - ); + new(this.element, this.parameterList, this.parameter); } /// Data pertaining to a field, declared in a variable declaration. @@ -851,11 +847,7 @@ class _FieldDeclaredInVariableDeclaration implements _Field { /// The field declaration containing the [declaration]. final FieldDeclaration fieldDeclaration; - _FieldDeclaredInVariableDeclaration( - this.element, - this.declaration, - this.fieldDeclaration, - ); + new(this.element, this.declaration, this.fieldDeclaration); } /// A visitor that visits everything in the library other than the class being @@ -866,7 +858,7 @@ class _FieldDeclaredInVariableDeclaration implements _Field { class _NonEnumVisitor extends _BaseVisitor { /// Initialize a newly created visitor to visit everything except the class /// declaration corresponding to the given [classElement]. - _NonEnumVisitor(super.classElement); + new(super.classElement); @override void visitClassDeclaration(ClassDeclaration node) { @@ -912,7 +904,7 @@ class _Parameter { /// The element associated with the parameter. final FormalParameterElement element; - _Parameter(this.index, this.element); + new(this.index, this.element); /// Return the expression representing the argument associated with this /// parameter, or `null` if there is no such argument. diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart index 48124f5404f..d8fb23deddd 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertClassToMixin extends ResolvedCorrectionProducer { - ConvertClassToMixin({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -98,7 +98,7 @@ class ConvertClassToMixin extends ResolvedCorrectionProducer { class _SuperclassReferenceFinder extends RecursiveAstVisitor { final List referencedClasses = []; - _SuperclassReferenceFinder(); + new(); @override void visitSuperExpression(SuperExpression node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_conditional_expression_to_if_element.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_conditional_expression_to_if_element.dart index 314c6decfe9..a3d28e2aa8a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_conditional_expression_to_if_element.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_conditional_expression_to_if_element.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertConditionalExpressionToIfElement extends ResolvedCorrectionProducer { - ConvertConditionalExpressionToIfElement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_default_to_primary_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_default_to_primary_constructor.dart index a013a389461..5bfd23baed3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_default_to_primary_constructor.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_default_to_primary_constructor.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertDefaultToPrimaryConstructor extends ResolvedCorrectionProducer { - ConvertDefaultToPrimaryConstructor({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_block.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_block.dart index 6fddbb94c65..43a432e0222 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_block.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_block.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertDocumentationIntoBlock extends ResolvedCorrectionProducer { - ConvertDocumentationIntoBlock({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_line.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_line.dart index 637d4d6e210..f064e85fca4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_line.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_line.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertDocumentationIntoLine extends ParsedCorrectionProducer { - ConvertDocumentationIntoLine({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_field_formal_to_normal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_field_formal_to_normal.dart index f98b48bc831..152ec30323b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_field_formal_to_normal.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_field_formal_to_normal.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertFieldFormalToNormal extends ResolvedCorrectionProducer { - ConvertFieldFormalToNormal({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_child.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_child.dart index e17464510b7..b5d2395b113 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_child.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_child.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertFlutterChild extends ResolvedCorrectionProducer { - ConvertFlutterChild({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_children.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_children.dart index d0bd0470493..ca8a6bbe85a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_children.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_children.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertFlutterChildren extends ResolvedCorrectionProducer { - ConvertFlutterChildren({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart index 68ae0aa7494..1609b6682e4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertForEachToForLoop extends ResolvedCorrectionProducer { - ConvertForEachToForLoop({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -125,7 +125,7 @@ class ConvertForEachToForLoop extends ResolvedCorrectionProducer { class _ReturnVisitor extends RecursiveAstVisitor { final DartFileEditBuilder builder; - _ReturnVisitor(this.builder); + new(this.builder); @override void visitFunctionExpression(FunctionExpression node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_async_body.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_async_body.dart index 8092ca028c5..d3497ca2be4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_async_body.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_async_body.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; class ConvertIntoAsyncBody extends ResolvedCorrectionProducer { - ConvertIntoAsyncBody({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_block_body.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_block_body.dart index 3eeac53dc96..fa46209f1c5 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_block_body.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_block_body.dart @@ -24,13 +24,13 @@ class ConvertIntoBlockBody extends ResolvedCorrectionProducer { CorrectionApplicability applicability; /// Initialize a newly created instance that adds a function body. - ConvertIntoBlockBody.missingBody({required super.context}) + new missingBody({required super.context}) : _correctionKind = _CorrectionKind.missingBody, applicability = CorrectionApplicability.singleLocation; /// Initialize a newly created instance that converts the set literal to /// a function body. - ConvertIntoBlockBody.setLiteral({required super.context}) + new setLiteral({required super.context}) : _correctionKind = _CorrectionKind.setLiteral, applicability = CorrectionApplicability.automatically; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart index e54d0036f79..9a855523f1e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertIntoFinalField extends ResolvedCorrectionProducer { - ConvertIntoFinalField({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_for_index.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_for_index.dart index 2b0a7eb8081..92a0f2890b0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_for_index.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_for_index.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertIntoForIndex extends ResolvedCorrectionProducer { - ConvertIntoForIndex({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart index 2f2c6e1f849..828218977bb 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart @@ -17,9 +17,9 @@ class ConvertIntoGetter extends ResolvedCorrectionProducer { String _memberName = ''; final _Type _type; - ConvertIntoGetter({required super.context}) : _type = _Type.base; + new({required super.context}) : _type = _Type.base; - ConvertIntoGetter.this_({required super.context}) : _type = _Type.this_; + new this_({required super.context}) : _type = _Type.this_; @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not.dart index 42a17b681f7..8b8de0da8f9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertIntoIsNot extends ResolvedCorrectionProducer { - ConvertIntoIsNot({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not_empty.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not_empty.dart index 0c6fbeca87d..04b76281a88 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not_empty.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_is_not_empty.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertIntoIsNotEmpty extends ResolvedCorrectionProducer { - ConvertIntoIsNotEmpty({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart index 7f8fe54b0e0..43e67824e7f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertMapFromIterableToForLiteral extends ResolvedCorrectionProducer { - ConvertMapFromIterableToForLiteral({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -208,7 +208,7 @@ class _Closure { final Token parameterIdentifier; final Expression body; - _Closure(this.parameter, this.parameterIdentifier, this.body); + new(this.parameter, this.parameterIdentifier, this.body); } /// A visitor that can be used to find references to a parameter. @@ -226,7 +226,7 @@ class _ParameterReferenceFinder extends RecursiveAstVisitor { final Set otherNames = {}; /// Initialize a newly created finder to find references to the [parameter]. - _ParameterReferenceFinder(this.parameter); + new(this.parameter); /// Return `true` if the parameter is unreferenced in the nodes that have been /// visited. diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_null_check_to_null_aware_element_or_entry.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_null_check_to_null_aware_element_or_entry.dart index 7d52c7e66ec..47dc2e92030 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_null_check_to_null_aware_element_or_entry.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_null_check_to_null_aware_element_or_entry.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertNullCheckToNullAwareElementOrEntry extends ResolvedCorrectionProducer { - ConvertNullCheckToNullAwareElementOrEntry({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart index 5bfbce1cc28..2075e82c46e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_part_of_to_uri.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertPartOfToUri extends ResolvedCorrectionProducer { - ConvertPartOfToUri({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_quotes.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_quotes.dart index 4b5c61b3e41..d9194181c7f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_quotes.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_quotes.dart @@ -15,7 +15,7 @@ class ConvertQuotes extends _ConvertQuotes { @override late bool _fromSingle; - ConvertQuotes({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -42,7 +42,7 @@ class ConvertQuotes extends _ConvertQuotes { } class ConvertToDoubleQuotes extends _ConvertQuotes { - ConvertToDoubleQuotes({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -62,7 +62,7 @@ class ConvertToDoubleQuotes extends _ConvertQuotes { } class ConvertToSingleQuotes extends _ConvertQuotes { - ConvertToSingleQuotes({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -85,7 +85,7 @@ abstract class _ConvertQuotes extends ResolvedCorrectionProducer { static const _backslash = 0x5C; static const _dollar = 0x24; - _ConvertQuotes({required super.context}); + new({required super.context}); /// Return `true` if this producer is converting from single quotes to double /// quotes, or `false` if it's converting from double quotes to single quotes. @@ -350,7 +350,7 @@ enum _QuotePair { final String newQuoteMultilineString; final int oppositeQuote; - const _QuotePair( + new( this.newQuote, this.newQuoteString, this.newQuoteMultilineString, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart index b313135bf35..f5786a65052 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToBooleanExpression extends ResolvedCorrectionProducer { - ConvertToBooleanExpression({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_cascade.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_cascade.dart index 0a0d386fca8..4b6cd8eec25 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_cascade.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_cascade.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToCascade extends ResolvedCorrectionProducer { - ConvertToCascade({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -121,5 +121,5 @@ class ConvertToCascade extends ResolvedCorrectionProducer { class _TargetAndOperator { final AstNode? target; final Token? operator; - _TargetAndOperator(this.target, this.operator); + new(this.target, this.operator); } diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_constant_pattern.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_constant_pattern.dart index 6ad486c1642..53f2dc07731 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_constant_pattern.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_constant_pattern.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToConstantPattern extends ResolvedCorrectionProducer { - ConvertToConstantPattern({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_contains.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_contains.dart index 631e7242d75..f5ad40a852c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_contains.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_contains.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToContains extends ResolvedCorrectionProducer { - ConvertToContains({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart index f6645ca0c95..fc829af32be 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart @@ -21,7 +21,7 @@ typedef _RefactorData = ({ }); class ConvertToDeclaringParameter extends ResolvedCorrectionProducer { - ConvertToDeclaringParameter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -447,7 +447,7 @@ class _UsageFinder extends RecursiveAstVisitor { final ConstructorFieldInitializer initializer; bool hasUsage = false; - _UsageFinder(this.element, this.initializer); + new(this.element, this.initializer); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_dot_shorthand.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_dot_shorthand.dart index c9a9a7ff3d0..7753ffb205e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_dot_shorthand.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_dot_shorthand.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToDotShorthand extends ResolvedCorrectionProducer { - ConvertToDotShorthand({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart index 35495bf5f8b..309f0e1af2d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToExpressionFunctionBody extends ResolvedCorrectionProducer { - ConvertToExpressionFunctionBody({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_flutter_style_todo.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_flutter_style_todo.dart index 101724675cf..50d8a456ba9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_flutter_style_todo.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_flutter_style_todo.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:linter/src/rules/flutter_style_todos.dart'; class ConvertToFlutterStyleTodo extends ResolvedCorrectionProducer { - ConvertToFlutterStyleTodo({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_for_each.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_for_each.dart index 9c7706b15ed..11b8954bf4e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_for_each.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_for_each.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToForEach extends ResolvedCorrectionProducer { - ConvertToForEach({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_function_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_function_declaration.dart index f7027b46623..6a246bc5350 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_function_declaration.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_function_declaration.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToFunctionDeclaration extends ResolvedCorrectionProducer { - ConvertToFunctionDeclaration({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart index 3afee5ebb65..d83a9a07971 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToGenericFunctionSyntax extends ParsedCorrectionProducer { - ConvertToGenericFunctionSyntax({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement.dart index 0e687a6a5e1..1e64fff569d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToIfCaseStatement extends ResolvedCorrectionProducer { - ConvertToIfCaseStatement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -182,7 +182,7 @@ class _DeclaredVariable { final LocalVariableElement element; final Expression initializer; - _DeclaredVariable({ + new({ required this.statement, required this.declaration, required this.element, @@ -198,7 +198,7 @@ class _ReferenceVisitor extends RecursiveAstVisitor { final LocalVariableElement element; bool hasReference = false; - _ReferenceVisitor(this.element); + new(this.element); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -212,7 +212,7 @@ class _StatementLocation { final Statement? previous; final Iterable following; - _StatementLocation({required this.previous, required this.following}); + new({required this.previous, required this.following}); } extension on Statement { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement_chain.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement_chain.dart index 8929660af51..b79d0c1cc94 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement_chain.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_case_statement_chain.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToIfCaseStatementChain extends ResolvedCorrectionProducer { - ConvertToIfCaseStatementChain({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -153,27 +153,27 @@ class ConvertToIfCaseStatementChain extends ResolvedCorrectionProducer { } class _DefaultGroup extends _Group { - _DefaultGroup({required super.statements}); + new({required super.statements}); } sealed class _Group { final List statements; - _Group({required this.statements}); + new({required this.statements}); } /// Joined [Pattern]s, without `when`, before statements. class _JoinedCaseGroup extends _Group { final List patterns; - _JoinedCaseGroup({required this.patterns, required super.statements}); + new({required this.patterns, required super.statements}); } /// A single [GuardedPattern] before statements. class _SingleCaseGroup extends _Group { final GuardedPattern guardedPattern; - _SingleCaseGroup({required this.guardedPattern, required super.statements}); + new({required this.guardedPattern, required super.statements}); } extension on List { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart index 1681cceff0b..acd9cadc92b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart @@ -15,10 +15,9 @@ class ConvertToIfNull extends ResolvedCorrectionProducer { /// Identifies the case to be fixed. final _FixCase _fixCase; - ConvertToIfNull.preferIfNull({required super.context}) - : _fixCase = _FixCase.preferIfNull; + new preferIfNull({required super.context}) : _fixCase = _FixCase.preferIfNull; - ConvertToIfNull.useToConvertNullsToBools({required super.context}) + new useToConvertNullsToBools({required super.context}) : _fixCase = _FixCase.useToConvertNullsToBools; @override diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart index 38840f556ae..b70686cd313 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToInitializingFormal extends ResolvedCorrectionProducer { - ConvertToInitializingFormal({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_int_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_int_literal.dart index d6f7631f834..88dc414051a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_int_literal.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_int_literal.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToIntLiteral extends ResolvedCorrectionProducer { - ConvertToIntLiteral({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart index 335374de02f..025c8e6f484 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToMapLiteral extends ResolvedCorrectionProducer { - ConvertToMapLiteral({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_multiline_string.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_multiline_string.dart index 93a4261bb54..0ad73ec7b48 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_multiline_string.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_multiline_string.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; class ConvertToMultilineString extends ResolvedCorrectionProducer { - ConvertToMultilineString({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart index f89b65de698..6a3352844c0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToNamedArguments extends ResolvedCorrectionProducer { - ConvertToNamedArguments({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware.dart index 7e9a4f568e5..3624a7de918 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToNullAware extends ResolvedCorrectionProducer { - ConvertToNullAware({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_list_element.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_list_element.dart index 20f46183bac..7314e88bb34 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_list_element.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_list_element.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToNullAwareListElement extends ResolvedCorrectionProducer { - ConvertToNullAwareListElement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_map_entry.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_map_entry.dart index acaf640e754..a7a1ee867db 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_map_entry.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_map_entry.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToNullAwareMapEntryKey extends ResolvedCorrectionProducer { - ConvertToNullAwareMapEntryKey({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -33,7 +33,7 @@ class ConvertToNullAwareMapEntryKey extends ResolvedCorrectionProducer { } class ConvertToNullAwareMapEntryValue extends ResolvedCorrectionProducer { - ConvertToNullAwareMapEntryValue({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_set_element.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_set_element.dart index eff70be2b64..a569797da7e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_set_element.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_set_element.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToNullAwareSetElement extends ResolvedCorrectionProducer { - ConvertToNullAwareSetElement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_spread.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_spread.dart index 80803a1ea36..c9a3ae77e9f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_spread.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware_spread.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToNullAwareSpread extends ResolvedCorrectionProducer { - ConvertToNullAwareSpread({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_on_type.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_on_type.dart index f4f77d389de..0274baf7f3e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_on_type.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_on_type.dart @@ -13,7 +13,7 @@ class ConvertToOnType extends ResolvedCorrectionProducer { @override final List fixArguments = []; - ConvertToOnType({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_package_import.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_package_import.dart index f620a0fa764..14896348022 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_package_import.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_package_import.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToPackageImport extends ResolvedCorrectionProducer { - ConvertToPackageImport({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_primary_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_primary_constructor.dart index 3a2033962e2..a53418bf747 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_primary_constructor.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_primary_constructor.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToPrimaryConstructor extends ResolvedCorrectionProducer { - ConvertToPrimaryConstructor({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -165,7 +165,7 @@ class _ContainerData { /// Whether the container is an enum. bool isEnum; - _ContainerData({ + new({ required this.name, required this.typeParameters, required this.hasPrimaryConstructor, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_raw_string.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_raw_string.dart index f9278fb0db5..fa9e0e54733 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_raw_string.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_raw_string.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToRawString extends ResolvedCorrectionProducer { - ConvertToRawString({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_relative_import.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_relative_import.dart index 8b055799e0d..054a0cb2553 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_relative_import.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_relative_import.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:path/path.dart' as path; class ConvertToRelativeImport extends ResolvedCorrectionProducer { - ConvertToRelativeImport({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_secondary_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_secondary_constructor.dart index 0b3aeed569f..b4c1a9b8be5 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_secondary_constructor.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_secondary_constructor.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToSecondaryConstructor extends ResolvedCorrectionProducer { - ConvertToSecondaryConstructor({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart index 3fdfd231188..ac4f46547ab 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToSetLiteral extends ResolvedCorrectionProducer { - ConvertToSetLiteral({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart index 043cd7d6e68..6a874bcff74 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart @@ -18,7 +18,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToSuperParameters extends ResolvedCorrectionProducer { - ConvertToSuperParameters({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -488,7 +488,7 @@ class _Parameter { final int index; - _Parameter(this.parameter, this.element, this.index); + new(this.parameter, this.element, this.index); bool get isNamed => element.isNamed; @@ -524,7 +524,7 @@ class _ParameterData { final int argumentIndex; /// Initialize a newly create data object. - _ParameterData({ + new({ required this.finalKeyword, required this.typeToDelete, required this.name, @@ -541,7 +541,7 @@ class _PrimaryConstructorData extends _ConstructorData { final PrimaryConstructorBody? _body; - _PrimaryConstructorData(this.declaration, this._body); + new(this.declaration, this._body); @override FunctionBody? get body => _body?.body; @@ -569,7 +569,7 @@ class _ReferencedParameterCollector extends RecursiveAstVisitor { class _SecondaryConstructorData extends _ConstructorData { final ConstructorDeclaration declaration; - _SecondaryConstructorData(this.declaration); + new(this.declaration); @override FunctionBody? get body => declaration.body; @@ -589,5 +589,5 @@ class _TypeData { SourceRange? parameterRange; - _TypeData({required this.primaryRange, this.parameterRange}); + new({required this.primaryRange, this.parameterRange}); } diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart index b658fc56c87..ff0a346c609 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart @@ -27,7 +27,7 @@ class ConvertToSwitchExpression extends ResolvedCorrectionProducer { /// Function reference used in argument switch expression generation. TopLevelFunctionElement? functionElement; - ConvertToSwitchExpression({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -605,13 +605,13 @@ class ConvertToSwitchExpression extends ResolvedCorrectionProducer { class _DefaultGroup extends _Group { final SwitchDefault node; - _DefaultGroup({required super.statements, required this.node}); + new({required super.statements, required this.node}); } sealed class _Group { final List statements; - _Group({required this.statements}); + new({required this.statements}); } /// Superclass for all indentation strategies. @@ -623,35 +623,35 @@ sealed class _Indentation {} final class _IndentationFullFirstRightAll extends _Indentation { final int level; - _IndentationFullFirstRightAll({required this.level}); + new({required this.level}); } /// Joined [Pattern]s, without `when`, before statements. class _JoinedCaseGroup extends _Group { final List patternCases; - _JoinedCaseGroup({required this.patternCases, required super.statements}); + new({required this.patternCases, required super.statements}); } sealed class _SwitchType { final List<_Group> groups; - _SwitchType({required this.groups}); + new({required this.groups}); } /// Each case statement passes a value to the same function. final class _SwitchTypeArgument extends _SwitchType { - _SwitchTypeArgument({required super.groups}); + new({required super.groups}); } /// Each case statement assigns to a local variable. final class _SwitchTypeAssignment extends _SwitchType { - _SwitchTypeAssignment({required super.groups}); + new({required super.groups}); } /// Each case statement returns a value. final class _SwitchTypeReturn extends _SwitchType { - _SwitchTypeReturn({required super.groups}); + new({required super.groups}); } extension on Statement { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_statement.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_statement.dart index 7d50a9962be..5d2c8a26c5b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_statement.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_statement.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertIfStatementToSwitchStatement extends ResolvedCorrectionProducer { - ConvertIfStatementToSwitchStatement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -208,7 +208,7 @@ class ConvertIfStatementToSwitchStatement extends ResolvedCorrectionProducer { class ConvertSwitchExpressionToSwitchStatement extends ResolvedCorrectionProducer { - ConvertSwitchExpressionToSwitchStatement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -409,18 +409,18 @@ class ConvertSwitchExpressionToSwitchStatement sealed class _IfCase { final Statement statement; - _IfCase({required this.statement}); + new({required this.statement}); } class _IfCaseElse extends _IfCase { - _IfCaseElse({required super.statement}); + new({required super.statement}); } class _IfCaseThen extends _IfCase { final String expressionCode; final String patternCode; - _IfCaseThen({ + new({ required this.expressionCode, required this.patternCode, required super.statement, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_where_type.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_where_type.dart index d171f8cee0e..0277e8f182f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_where_type.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_where_type.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ConvertToWhereType extends ResolvedCorrectionProducer { - ConvertToWhereType({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_pattern.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_pattern.dart index dc912932804..19774f067ae 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_pattern.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_pattern.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ConvertToWildcardPattern extends ResolvedCorrectionProducer { - ConvertToWildcardPattern({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_variable.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_variable.dart index 8ba2c5638cf..42d0f2ef095 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_variable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_variable.dart @@ -20,11 +20,11 @@ class ConvertToWildcardVariable extends ResolvedCorrectionProducer { @override final FixKind? multiFixKind; - ConvertToWildcardVariable({required super.context}) + new({required super.context}) : multiFixKind = null, applicability = .singleLocation; - ConvertToWildcardVariable.automatically({required super.context}) + new automatically({required super.context}) : multiFixKind = DartFixKind.convertToWildcardVariableMulti, applicability = .automatically; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_class.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_class.dart index d6bb8694d8f..2906f415c25 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_class.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_class.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class CreateClass extends MultiCorrectionProducer { - CreateClass({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -136,7 +136,7 @@ class _CreateClass extends ResolvedCorrectionProducer { @override final FixKind fixKind; - _CreateClass.lowercase({ + new lowercase({ required super.context, required this._arguments, required this._requiresConstConstructor, @@ -148,7 +148,7 @@ class _CreateClass extends ResolvedCorrectionProducer { ? DartFixKind.createClassLowercaseWith : DartFixKind.createClassLowercase; - _CreateClass.uppercase({ + new uppercase({ required super.context, required this._arguments, required this._requiresConstConstructor, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart index 0d4bae93ae2..91194f58487 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart @@ -19,7 +19,7 @@ class CreateConstructor extends ResolvedCorrectionProducer { // TODO(migration): We set this node when we have the change. late String _constructorName; - CreateConstructor({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart index d97766b67d2..3da4c4ea318 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart @@ -23,10 +23,9 @@ typedef _FieldRecord = ({bool required, String parameter}); class CreateConstructorForFinalFields extends ResolvedCorrectionProducer { final _Style _style; - CreateConstructorForFinalFields.requiredNamed({required super.context}) - : _style = _Style.requiredNamed; + new requiredNamed({required super.context}) : _style = _Style.requiredNamed; - CreateConstructorForFinalFields.requiredPositional({required super.context}) + new requiredPositional({required super.context}) : _style = _Style.requiredPositional; @override @@ -464,7 +463,7 @@ class _Field { final String namedFormalParameterName; final bool hasNonNullableType; - _Field({ + new({ required this.typeAnnotation, required this.fieldName, required this.namedFormalParameterName, @@ -498,7 +497,7 @@ class _FixContext { final InterfaceType superType; final Iterable variableLists; - _FixContext({ + new({ required this.builder, required this.containerName, required this.superType, @@ -524,7 +523,7 @@ enum _Style { final FixKind fixKind; - const _Style({required this.fixKind}); + new({required this.fixKind}); } extension on List { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart index 602f913163c..eebec355a18 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class CreateConstructorSuper extends MultiCorrectionProducer { - CreateConstructorSuper({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -50,11 +50,7 @@ class _CreateConstructor extends ResolvedCorrectionProducer { /// The class in which the constructor will be added. final ClassDeclaration _targetClass; - _CreateConstructor( - this._constructor, - this._targetClass, { - required super.context, - }); + new(this._constructor, this._targetClass, {required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart index 741ec082cfe..ed66383d5b7 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart @@ -23,7 +23,7 @@ import 'package:collection/collection.dart'; class CreateExtensionGetter extends _CreateExtensionMember { String _getterName = ''; - CreateExtensionGetter({required super.context}); + new({required super.context}); @override List get fixArguments => [_getterName]; @@ -151,7 +151,7 @@ class CreateExtensionGetter extends _CreateExtensionMember { class CreateExtensionMethod extends _CreateExtensionMember { String _methodName = ''; - CreateExtensionMethod({required super.context}); + new({required super.context}); @override List get fixArguments => [_methodName]; @@ -336,7 +336,7 @@ class CreateExtensionMethod extends _CreateExtensionMember { class CreateExtensionOperator extends _CreateExtensionMember { String _operator = ''; - CreateExtensionOperator({required super.context}); + new({required super.context}); @override List? get fixArguments => [_operator]; @@ -496,7 +496,7 @@ class CreateExtensionOperator extends _CreateExtensionMember { class CreateExtensionSetter extends _CreateExtensionMember { String _setterName = ''; - CreateExtensionSetter({required super.context}); + new({required super.context}); @override List get fixArguments => [_setterName]; @@ -615,7 +615,7 @@ class CreateExtensionSetter extends _CreateExtensionMember { } abstract class _CreateExtensionMember extends ResolvedCorrectionProducer { - _CreateExtensionMember({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_field.dart index def2eeb64d6..30f57f0c65b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_field.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_field.dart @@ -19,7 +19,7 @@ class CreateField extends CreateFieldOrGetter { /// The name of the field to be created. String _fieldName = ''; - CreateField({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_file.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_file.dart index e5415a6782a..b810d97c1c4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_file.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_file.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class CreateFile extends ResolvedCorrectionProducer { String _fileName = ''; - CreateFile({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_function.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_function.dart index de8d5e93b07..df75fdf2d37 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_function.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_function.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class CreateFunction extends ResolvedCorrectionProducer { String _functionName = ''; - CreateFunction({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_getter.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_getter.dart index 608716784db..bd1e57912a8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_getter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_getter.dart @@ -20,7 +20,7 @@ import 'package:meta/meta.dart'; /// Shared implementation that identifies what getter should be added, /// but delegates to the subtypes to produce the fix code. abstract class CreateFieldOrGetter extends ResolvedCorrectionProducer { - CreateFieldOrGetter({required super.context}); + new({required super.context}); /// Adds the declaration that makes a [fieldName] available. Future addForObjectPattern({ @@ -94,7 +94,7 @@ abstract class CreateFieldOrGetter extends ResolvedCorrectionProducer { class CreateGetter extends CreateFieldOrGetter { String _getterName = ''; - CreateGetter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_local_variable.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_local_variable.dart index cbcd5fa73c0..5c119b5b8b9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_local_variable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_local_variable.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class CreateLocalVariable extends ResolvedCorrectionProducer { String _variableName = ''; - CreateLocalVariable({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart index 131441f5d68..4d4f9e9f629 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart @@ -24,13 +24,13 @@ class CreateMethod extends ResolvedCorrectionProducer { /// Initializes a newly created instance that will create either an equality /// (`operator ==`) method or `hashCode` getter based on the existing other /// half of the pair. - CreateMethod.equalityOrHashCode({required super.context}) + new equalityOrHashCode({required super.context}) : _kind = _MethodKind.equalityOrHashCode, applicability = CorrectionApplicability.acrossSingleFile; /// Initializes a newly created instance that will create a method based on an /// invocation of an undefined method. - CreateMethod.method({required super.context}) + new method({required super.context}) : _kind = _MethodKind.method, applicability = CorrectionApplicability.singleLocation; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart index 6cbae6381ef..0c7cf04fd96 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart @@ -25,7 +25,7 @@ class CreateMethodOrFunction extends ResolvedCorrectionProducer { /// [PrefixedIdentifier] or [PropertyAccess], and `null` otherwise. final Element? _targetElement; - factory CreateMethodOrFunction({required CorrectionProducerContext context}) { + factory({required CorrectionProducerContext context}) { if (context is StubCorrectionProducerContext) { return CreateMethodOrFunction._( context: context, @@ -67,11 +67,7 @@ class CreateMethodOrFunction extends ResolvedCorrectionProducer { ); } - CreateMethodOrFunction._({ - required super.context, - this._targetElement, - required this.fixKind, - }); + new _({required super.context, this._targetElement, required this.fixKind}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_missing_overrides.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_missing_overrides.dart index b9c58f78c68..5f6ac74aab6 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_missing_overrides.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_missing_overrides.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class CreateMissingOverrides extends ResolvedCorrectionProducer { int _numElements = 0; - CreateMissingOverrides({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart index da6e1eea0bd..9e28db06c96 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class CreateMixin extends MultiCorrectionProducer { - CreateMixin({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -94,7 +94,7 @@ class _CreateMixin extends ResolvedCorrectionProducer { @override final FixKind fixKind; - _CreateMixin.lowercase( + new lowercase( this._mixinName, this._expression, this.prefixElement, { @@ -104,7 +104,7 @@ class _CreateMixin extends ResolvedCorrectionProducer { ? DartFixKind.createMixinLowercaseWith : DartFixKind.createMixinLowercase; - _CreateMixin.uppercase( + new uppercase( this._mixinName, this._expression, this.prefixElement, { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_no_such_method.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_no_such_method.dart index 2007d83da8d..2fa9940b17b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_no_such_method.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_no_such_method.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class CreateNoSuchMethod extends ResolvedCorrectionProducer { - CreateNoSuchMethod({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_operator.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_operator.dart index 3a0edc5b83d..fb9243e1116 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_operator.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_operator.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class CreateOperator extends ResolvedCorrectionProducer { String _operator = ''; - CreateOperator({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_parameter.dart index f8b2116a33f..bb351890f04 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_parameter.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class CreateParameter extends ResolvedCorrectionProducer { String _parameterName = ''; - CreateParameter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_setter.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_setter.dart index 383cb6ececf..83bacf1e83d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_setter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_setter.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class CreateSetter extends ResolvedCorrectionProducer { String _setterName = ''; - CreateSetter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart index cb439cba555..cee59050819 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart @@ -20,7 +20,7 @@ class DataDriven extends MultiCorrectionProducer { @visibleForTesting static List? transformSetsForTests; - DataDriven({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -74,7 +74,7 @@ class DataDrivenFix extends ResolvedCorrectionProducer { /// The transform being applied to implement this fix. final Transform _transform; - DataDrivenFix(this._transform, {required super.context}); + new(this._transform, {required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/destructure_local_variable_assignment.dart b/pkg/analysis_server/lib/src/services/correction/dart/destructure_local_variable_assignment.dart index 6987c7507f8..de162462244 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/destructure_local_variable_assignment.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/destructure_local_variable_assignment.dart @@ -18,7 +18,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class DestructureLocalVariableAssignment extends ResolvedCorrectionProducer { - DestructureLocalVariableAssignment({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -177,7 +177,7 @@ class DestructureLocalVariableAssignment extends ResolvedCorrectionProducer { class NamedField extends RecordField { final String field; final String? variable; - NamedField({required this.field, this.variable}); + new({required this.field, this.variable}); @override void write(EditBuilder builder, String groupName) { @@ -204,7 +204,7 @@ class NamedField extends RecordField { class ObjectFieldName { final String varName; final String fieldName; - ObjectFieldName._(this.varName, this.fieldName); + new _(this.varName, this.fieldName); bool get isDefault => varName == fieldName; @@ -234,7 +234,7 @@ class ObjectFieldName { class PositionalField extends RecordField { final String variable; - PositionalField(this.variable); + new(this.variable); @override void write(EditBuilder builder, String groupName) { @@ -257,7 +257,7 @@ class _ReferenceFinder extends RecursiveAstVisitor { final objectReferences = []; final propertyReferences = >{}; - _ReferenceFinder(this.element); + new(this.element); ({ List objectReferences, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart index 6195fe3d65c..6fec6bb09cf 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart @@ -30,7 +30,7 @@ typedef _DeclarationInfo = ({ }); class EncapsulateField extends ResolvedCorrectionProducer { - EncapsulateField({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -420,11 +420,7 @@ class _InitializerReferenceUpdater extends RecursiveAstVisitor { final FieldFormalParameterElement parameterElement; final String newName; - _InitializerReferenceUpdater( - this.builder, - this.parameterElement, - this.newName, - ); + new(this.builder, this.parameterElement, this.newName); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/exchange_operands.dart b/pkg/analysis_server/lib/src/services/correction/dart/exchange_operands.dart index 47a596e2e4c..f8a15a257e4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/exchange_operands.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/exchange_operands.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ExchangeOperands extends ResolvedCorrectionProducer { - ExchangeOperands({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart b/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart index 7a41f7b162c..01ce360a64e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ExtendClassForMixin extends ResolvedCorrectionProducer { String _typeName = ''; - ExtendClassForMixin({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/extract_local_variable.dart b/pkg/analysis_server/lib/src/services/correction/dart/extract_local_variable.dart index d6d661d2fac..7eb4cf9dc75 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/extract_local_variable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/extract_local_variable.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ExtractLocalVariable extends ResolvedCorrectionProducer { - ExtractLocalVariable({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -179,7 +179,7 @@ class _ExpressionEncoder { class _FunctionAstVisitor extends RecursiveAstVisitor { final void Function(SimpleIdentifier)? simpleIdentifier; - _FunctionAstVisitor({this.simpleIdentifier}); + new({this.simpleIdentifier}); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -195,7 +195,7 @@ class _OccurrencesVisitor extends GeneralizingAstVisitor { final List occurrences; final String searchCode; - _OccurrencesVisitor(this.encoder, this.occurrences, this.searchCode); + new(this.encoder, this.occurrences, this.searchCode); @override void visitExpression(Expression node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_children.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_children.dart index e35a5016cf7..6d23fe162b9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_children.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_children.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterConvertToChildren extends ResolvedCorrectionProducer { - FlutterConvertToChildren({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart index 9e29d250242..cfb1431de6d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart @@ -17,7 +17,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterConvertToStatefulWidget extends ResolvedCorrectionProducer { - FlutterConvertToStatefulWidget({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -322,11 +322,7 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { List edits = []; - _ReplacementEditBuilder( - this.widgetClassElement, - this.elementsToMove, - this.linesRange, - ); + new(this.widgetClassElement, this.elementsToMove, this.linesRange); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart index ae0a2e59294..b52d0341131 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart @@ -18,7 +18,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterConvertToStatelessWidget extends ResolvedCorrectionProducer { - FlutterConvertToStatelessWidget({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -325,11 +325,7 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { List edits = []; - _ReplacementEditBuilder( - this.widgetClassElement, - this.elementsToMove, - this.linesRange, - ); + new(this.widgetClassElement, this.elementsToMove, this.linesRange); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -411,7 +407,7 @@ class _StateUsageVisitor extends RecursiveAstVisitor { ClassElement widgetClassElement; ClassElement stateClassElement; - _StateUsageVisitor(this.widgetClassElement, this.stateClassElement); + new(this.widgetClassElement, this.stateClassElement); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_down.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_down.dart index 9e0b6e87a08..9450a191eca 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_down.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_down.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterMoveDown extends ResolvedCorrectionProducer { - FlutterMoveDown({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_up.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_up.dart index 616babd6894..e18248e4905 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_up.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_move_up.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterMoveUp extends ResolvedCorrectionProducer { - FlutterMoveUp({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_remove_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_remove_widget.dart index cfa2720feec..491ea63dfd3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_remove_widget.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_remove_widget.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterRemoveWidget extends ResolvedCorrectionProducer { - FlutterRemoveWidget({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -171,7 +171,7 @@ class _UsageFinder extends RecursiveAstVisitor { final Element element; bool used = false; - _UsageFinder(this.element); + new(this.element); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_child.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_child.dart index 5e2f1973e4b..1f61258e83f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_child.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_child.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; abstract class FlutterParentAndChild extends ResolvedCorrectionProducer { - FlutterParentAndChild({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -154,7 +154,7 @@ abstract class FlutterParentAndChild extends ResolvedCorrectionProducer { } class FlutterSwapWithChild extends FlutterParentAndChild { - FlutterSwapWithChild({required super.context}); + new({required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterSwapWithChild; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_parent.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_parent.dart index 009732d7b8a..fce6e44f77d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_parent.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_parent.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; class FlutterSwapWithParent extends FlutterParentAndChild { - FlutterSwapWithParent({required super.context}); + new({required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterSwapWithParent; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart index 66710ee4a17..4e14df742e9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterWrap extends MultiCorrectionProducer { - FlutterWrap({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -109,7 +109,7 @@ class FlutterWrap extends MultiCorrectionProducer { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapCenter extends _WrapSingleWidget { - _FlutterWrapCenter(super.widgetExpr, {required super.context}); + new(super.widgetExpr, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapCenter; @@ -124,11 +124,7 @@ class _FlutterWrapCenter extends _WrapSingleWidget { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapColumn extends _WrapMultipleWidgets { - _FlutterWrapColumn( - super.firstWidget, - super.lastWidget, { - required super.context, - }); + new(super.firstWidget, super.lastWidget, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapColumn; @@ -140,7 +136,7 @@ class _FlutterWrapColumn extends _WrapMultipleWidgets { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapContainer extends _WrapSingleWidget { - _FlutterWrapContainer(super.widgetExpr, {required super.context}); + new(super.widgetExpr, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapContainer; @@ -155,7 +151,7 @@ class _FlutterWrapContainer extends _WrapSingleWidget { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapExpanded extends _WrapSingleWidget { - _FlutterWrapExpanded(super.widgetExpr, {required super.context}); + new(super.widgetExpr, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapExpanded; @@ -170,7 +166,7 @@ class _FlutterWrapExpanded extends _WrapSingleWidget { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapFlexible extends _WrapSingleWidget { - _FlutterWrapFlexible(super.widgetExpr, {required super.context}); + new(super.widgetExpr, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapFlexible; @@ -185,7 +181,7 @@ class _FlutterWrapFlexible extends _WrapSingleWidget { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapGeneric extends _WrapSingleWidget { - _FlutterWrapGeneric(super.widgetExpr, {required super.context}); + new(super.widgetExpr, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapGeneric; @@ -194,7 +190,7 @@ class _FlutterWrapGeneric extends _WrapSingleWidget { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapPadding extends _WrapSingleWidget { - _FlutterWrapPadding(super.widgetExpr, {required super.context}); + new(super.widgetExpr, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapPadding; @@ -217,11 +213,7 @@ class _FlutterWrapPadding extends _WrapSingleWidget { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapRow extends _WrapMultipleWidgets { - _FlutterWrapRow( - super.firstWidget, - super.lastWidget, { - required super.context, - }); + new(super.firstWidget, super.lastWidget, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapRow; @@ -233,7 +225,7 @@ class _FlutterWrapRow extends _WrapMultipleWidgets { /// A correction processor that can make one of the possible changes computed by /// the [FlutterWrap] producer. class _FlutterWrapSizedBox extends _WrapSingleWidget { - _FlutterWrapSizedBox(super.widgetExpr, {required super.context}); + new(super.widgetExpr, {required super.context}); @override AssistKind get assistKind => DartAssistKind.flutterWrapSizedBox; @@ -252,11 +244,7 @@ abstract class _WrapMultipleWidgets extends ResolvedCorrectionProducer { final Expression lastWidget; - _WrapMultipleWidgets( - this.firstWidget, - this.lastWidget, { - required super.context, - }); + new(this.firstWidget, this.lastWidget, {required super.context}); @override CorrectionApplicability get applicability => @@ -317,7 +305,7 @@ abstract class _WrapMultipleWidgets extends ResolvedCorrectionProducer { abstract class _WrapSingleWidget extends ResolvedCorrectionProducer { final Expression widgetExpr; - _WrapSingleWidget(this.widgetExpr, {required super.context}); + new(this.widgetExpr, {required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart index c3d3bd4d036..7b0c884e9ec 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_builder.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterWrapBuilders extends MultiCorrectionProducer { - FlutterWrapBuilders({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -33,7 +33,7 @@ abstract class _FlutterBaseWrapBuilder extends ResolvedCorrectionProducer { final List extraNamedParams; final String builderName; - _FlutterBaseWrapBuilder({ + new({ required super.context, required this.builderName, required this.extraNamedParams, @@ -108,7 +108,7 @@ abstract class _FlutterBaseWrapBuilder extends ResolvedCorrectionProducer { } class _FlutterWrapBuilder extends _FlutterBaseWrapBuilder { - _FlutterWrapBuilder({required super.context}) + new({required super.context}) : super( builderName: 'Builder', extraNamedParams: const [], @@ -120,7 +120,7 @@ class _FlutterWrapBuilder extends _FlutterBaseWrapBuilder { } class _FlutterWrapFutureBuilder extends _FlutterBaseWrapBuilder { - _FlutterWrapFutureBuilder({required super.context}) + new({required super.context}) : super( builderName: 'FutureBuilder', extraNamedParams: const ['future'], @@ -132,7 +132,7 @@ class _FlutterWrapFutureBuilder extends _FlutterBaseWrapBuilder { } class _FlutterWrapStreamBuilder extends _FlutterBaseWrapBuilder { - _FlutterWrapStreamBuilder({required super.context}) + new({required super.context}) : super( builderName: 'StreamBuilder', extraNamedParams: const ['stream'], @@ -144,7 +144,7 @@ class _FlutterWrapStreamBuilder extends _FlutterBaseWrapBuilder { } class _FlutterWrapValueListenableBuilder extends _FlutterBaseWrapBuilder { - _FlutterWrapValueListenableBuilder({required super.context}) + new({required super.context}) : super( builderName: 'ValueListenableBuilder', extraNamedParams: const ['valueListenable'], diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_generic.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_generic.dart index 97b81a6dece..e5cbb164503 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_generic.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap_generic.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class FlutterWrapGeneric extends ResolvedCorrectionProducer { - FlutterWrapGeneric({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart b/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart index fbc0d8c990c..e6c34899020 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/import_add_show.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; class ImportAddShow extends ResolvedCorrectionProducer { - ImportAddShow({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -63,7 +63,7 @@ class _ReferenceFinder extends RecursiveAstVisitor { Set referencedNames = SplayTreeSet(); - _ReferenceFinder(this.namespace); + new(this.namespace); @override void visitAssignmentExpression(AssignmentExpression node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart index dec2d4db993..88622b9ff12 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart @@ -39,33 +39,31 @@ class ImportLibrary extends MultiCorrectionProducer { /// Initialize a newly created instance that will add an import for an /// extension. - ImportLibrary.forExtension({required super.context}) - : _importKind = .forExtension; + new forExtension({required super.context}) : _importKind = .forExtension; /// Initialize a newly created instance that will add an import for a member /// of an extension. - ImportLibrary.forExtensionMember({required super.context}) + new forExtensionMember({required super.context}) : _importKind = .forExtensionMember; /// Initialize a newly created instance that will add an import for an /// extension type. - ImportLibrary.forExtensionType({required super.context}) + new forExtensionType({required super.context}) : _importKind = .forExtensionType; /// Initialize a newly created instance that will add an import for a /// top-level function. - ImportLibrary.forFunction({required super.context}) - : _importKind = .forFunction; + new forFunction({required super.context}) : _importKind = .forFunction; /// Initialize a newly created instance that will add an import for a /// top-level variable. - ImportLibrary.forTopLevelVariable({required super.context}) + new forTopLevelVariable({required super.context}) : _importKind = .forTopLevelVariable; /// Initialize a newly created instance that will add an import for a /// type-like declaration (class, enum, mixin, typedef), a constructor, a /// static member of a declaration, or an enum value. - ImportLibrary.forType({required super.context}) : _importKind = .forType; + new forType({required super.context}) : _importKind = .forType; @override Future> get producers async { @@ -773,7 +771,7 @@ class _ImportAbsoluteLibrary extends ResolvedCorrectionProducer { String _uriText = ''; - _ImportAbsoluteLibrary( + new( this._fixKind, this._library, this._prefix, { @@ -820,13 +818,13 @@ enum _ImportKind { final ImportLibrary Function({required CorrectionProducerContext context}) fn; - const _ImportKind(this.fn); + new(this.fn); } /// A correction processor that can add/remove a name to/from the show/hide /// combinator of an existing import. class _ImportLibraryCombinator extends _ImportLibraryCombinatorMultiple { - _ImportLibraryCombinator( + new( String libraryName, List combinators, String updatedName, { @@ -852,7 +850,7 @@ class _ImportLibraryCombinatorMultiple extends ResolvedCorrectionProducer { final bool _removePrefix; - _ImportLibraryCombinatorMultiple( + new( this._libraryName, this._combinators, this._updatedNames, { @@ -941,7 +939,7 @@ class _ImportLibraryPrefix extends ResolvedCorrectionProducer { final String? _nodePrefix; final _ImportLibraryCombinator? _editCombinator; - _ImportLibraryPrefix( + new( this._importedLibrary, this._importPrefix, this._editCombinator, @@ -1012,7 +1010,7 @@ class _ImportRelativeLibrary extends ResolvedCorrectionProducer { String _uriText = ''; - _ImportRelativeLibrary( + new( this._fixKind, this._library, this._prefix, { @@ -1064,7 +1062,7 @@ class _PrefixedName { final String name; final _ProducersGenerators _producerGenerators; - _PrefixedName({ + new({ required this.name, this.prefix, required this._producerGenerators, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/inline_invocation.dart b/pkg/analysis_server/lib/src/services/correction/dart/inline_invocation.dart index d96ef57fb90..10873e8fef9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/inline_invocation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/inline_invocation.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class InlineInvocation extends ResolvedCorrectionProducer { - InlineInvocation({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart b/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart index e9c1d08eaaf..8683444c4bf 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class InlineTypedef extends ResolvedCorrectionProducer { String _name = ''; - InlineTypedef({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -149,7 +149,7 @@ class _ReferenceFinder extends RecursiveAstVisitor { int count = 0; - _ReferenceFinder(this.typeName); + new(this.typeName); @override void visitNamedType(NamedType node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/insert_body.dart b/pkg/analysis_server/lib/src/services/correction/dart/insert_body.dart index 8717b074ed3..44ec15d0347 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/insert_body.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/insert_body.dart @@ -8,7 +8,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class InsertBody extends ResolvedCorrectionProducer { - InsertBody({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/insert_on_keyword.dart b/pkg/analysis_server/lib/src/services/correction/dart/insert_on_keyword.dart index a64da91ee71..c2dcfb21cb8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/insert_on_keyword.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/insert_on_keyword.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class InsertOnKeyword extends ResolvedCorrectionProducer { - InsertOnKeyword({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/insert_semicolon.dart b/pkg/analysis_server/lib/src/services/correction/dart/insert_semicolon.dart index 9fefe60de5c..ee3a257ee7d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/insert_semicolon.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/insert_semicolon.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class InsertSemicolon extends ResolvedCorrectionProducer { - InsertSemicolon({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/invert_conditional_expression.dart b/pkg/analysis_server/lib/src/services/correction/dart/invert_conditional_expression.dart index 4bd971cabe1..0a9961a5f4b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/invert_conditional_expression.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/invert_conditional_expression.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class InvertConditionalExpression extends ResolvedCorrectionProducer { - InvertConditionalExpression({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/invert_if_statement.dart b/pkg/analysis_server/lib/src/services/correction/dart/invert_if_statement.dart index 5e7af6b65f1..011f7b5d822 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/invert_if_statement.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/invert_if_statement.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class InvertIfStatement extends ResolvedCorrectionProducer { - InvertIfStatement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/join_else_with_if.dart b/pkg/analysis_server/lib/src/services/correction/dart/join_else_with_if.dart index 8ecb0abe1d8..63a801a5e1f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/join_else_with_if.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/join_else_with_if.dart @@ -19,8 +19,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; /// The enclosing else block must have only one statement which is the inner /// `if` statement. class JoinElseWithIf extends _JoinIfWithElseBlock { - JoinElseWithIf({required super.context}) - : super(DartAssistKind.joinElseWithIf); + new({required super.context}) : super(DartAssistKind.joinElseWithIf); @override Future compute(ChangeBuilder builder) async { @@ -65,8 +64,7 @@ class JoinElseWithIf extends _JoinIfWithElseBlock { /// The enclosing else block must have only one statement which is the inner /// `if` statement. class JoinIfWithElse extends _JoinIfWithElseBlock { - JoinIfWithElse({required super.context}) - : super(DartAssistKind.joinIfWithElse); + new({required super.context}) : super(DartAssistKind.joinIfWithElse); @override Future compute(ChangeBuilder builder) async { @@ -136,7 +134,7 @@ abstract class _JoinIfWithElseBlock extends ResolvedCorrectionProducer { @override final AssistKind assistKind; - _JoinIfWithElseBlock(this.assistKind, {required super.context}); + new(this.assistKind, {required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_inner.dart b/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_inner.dart index 0e8373c147c..606178169ea 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_inner.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_inner.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class JoinIfWithInner extends ResolvedCorrectionProducer { - JoinIfWithInner({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_outer.dart b/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_outer.dart index 9976fb0bc12..3c5f9f0592f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_outer.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/join_if_with_outer.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class JoinIfWithOuter extends ResolvedCorrectionProducer { - JoinIfWithOuter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart index 0e799e08398..ceb430e15eb 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class JoinVariableDeclaration extends ResolvedCorrectionProducer { - JoinVariableDeclaration({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart index b025f2c4d96..73fe35e53bc 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class MakeClassAbstract extends ResolvedCorrectionProducer { String _className = ''; - MakeClassAbstract({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_conditional_on_debug_mode.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_conditional_on_debug_mode.dart index e69900cdf78..bace22bbdf3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_conditional_on_debug_mode.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_conditional_on_debug_mode.dart @@ -14,7 +14,7 @@ class MakeConditionalOnDebugMode extends ResolvedCorrectionProducer { 'package:flutter/foundation.dart', ); - MakeConditionalOnDebugMode({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart index bdddc4833b8..a7ee71f9c82 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_field_not_final.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class MakeFieldNotFinal extends ResolvedCorrectionProducer { String _fieldName = ''; - MakeFieldNotFinal({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart index c07adbf2942..b6ddbda0a7a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart @@ -17,7 +17,7 @@ import 'package:collection/collection.dart'; class MakeFieldPublic extends ResolvedCorrectionProducer { late String _fieldName; - MakeFieldPublic({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_final.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_final.dart index 0b5c51659cb..9a4f7a41a76 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_final.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_final.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class MakeFinal extends ResolvedCorrectionProducer { - MakeFinal({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_required_named_parameters_first.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_required_named_parameters_first.dart index a597b2b02a9..a069de44f28 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_required_named_parameters_first.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_required_named_parameters_first.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class MakeRequiredNamedParametersFirst extends ResolvedCorrectionProducer { - MakeRequiredNamedParametersFirst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_return_type_nullable.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_return_type_nullable.dart index e41b11b347a..9894b5104e5 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_return_type_nullable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_return_type_nullable.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class MakeReturnTypeNullable extends ResolvedCorrectionProducer { - MakeReturnTypeNullable({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_super_invocation_last.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_super_invocation_last.dart index 0e3bc530f72..40490daa40b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_super_invocation_last.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_super_invocation_last.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class MakeSuperInvocationLast extends ResolvedCorrectionProducer { - MakeSuperInvocationLast({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_variable_not_final.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_variable_not_final.dart index fabbb1b30a7..b67b95fb9af 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_variable_not_final.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_variable_not_final.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class MakeVariableNotFinal extends ResolvedCorrectionProducer { String _variableName = ''; - MakeVariableNotFinal({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart index e9397880b9a..d67d0d5da0b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart @@ -19,7 +19,7 @@ class MakeVariableNullable extends ResolvedCorrectionProducer { /// The name of the variable whose type is to be made nullable. String _variableName = ''; - MakeVariableNullable({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/merge_combinators.dart b/pkg/analysis_server/lib/src/services/correction/dart/merge_combinators.dart index 9ea42ddae17..145ce7cbc01 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/merge_combinators.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/merge_combinators.dart @@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; class MergeCombinators extends MultiCorrectionProducer { - MergeCombinators({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -78,7 +78,7 @@ class _MergeCombinators extends ResolvedCorrectionProducer { final bool mergeWithShow; final NamespaceDirective directive; - _MergeCombinators( + new( this.fixKind, this.directive, { required this.mergeWithShow, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/move_annotation_to_library_directive.dart b/pkg/analysis_server/lib/src/services/correction/dart/move_annotation_to_library_directive.dart index 692946c3a49..f0321473ac7 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/move_annotation_to_library_directive.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/move_annotation_to_library_directive.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class MoveAnnotationToLibraryDirective extends ResolvedCorrectionProducer { - MoveAnnotationToLibraryDirective({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/move_doc_comment_to_library_directive.dart b/pkg/analysis_server/lib/src/services/correction/dart/move_doc_comment_to_library_directive.dart index 2056f83419e..49e57d147df 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/move_doc_comment_to_library_directive.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/move_doc_comment_to_library_directive.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class MoveDocCommentToLibraryDirective extends ResolvedCorrectionProducer { - MoveDocCommentToLibraryDirective({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/move_initialization_to_field_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/move_initialization_to_field_declaration.dart index 1e7826623ae..2d77bc13467 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/move_initialization_to_field_declaration.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/move_initialization_to_field_declaration.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class MoveInitializationToFieldDeclaration extends ResolvedCorrectionProducer { - MoveInitializationToFieldDeclaration({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart b/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart index 742c9d31644..52acfa2eafd 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class MoveTypeArgumentsToClass extends ResolvedCorrectionProducer { - MoveTypeArgumentsToClass({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/organize_imports.dart b/pkg/analysis_server/lib/src/services/correction/dart/organize_imports.dart index dad8935c0f7..63447ea2ed9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/organize_imports.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/organize_imports.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class OrganizeImports extends ResolvedCorrectionProducer { - OrganizeImports({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/qualify_reference.dart b/pkg/analysis_server/lib/src/services/correction/dart/qualify_reference.dart index 5b514f87f5e..fb38b4661bb 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/qualify_reference.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/qualify_reference.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class QualifyReference extends ResolvedCorrectionProducer { String _qualifiedName = ''; - QualifyReference({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_abstract.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_abstract.dart index baf405fe6e5..229aa12d231 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_abstract.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_abstract.dart @@ -18,11 +18,11 @@ class RemoveAbstract extends CorrectionProducerWithDiagnostic { /// Initialize a newly created instance that can't apply bulk and in-file /// fixes. - RemoveAbstract({required super.context}) + new({required super.context}) : applicability = CorrectionApplicability.singleLocation; /// Initialize a newly created instance that can apply bulk and in-file fixes. - RemoveAbstract.bulkFixable({required super.context}) + new bulkFixable({required super.context}) : applicability = CorrectionApplicability.automatically; @override diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_annotation.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_annotation.dart index 659aa2ccd87..c86a9978e08 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_annotation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_annotation.dart @@ -13,7 +13,7 @@ import 'package:collection/collection.dart'; class RemoveAnnotation extends ResolvedCorrectionProducer { String _annotationName = ''; - RemoveAnnotation({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_argument.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_argument.dart index 8102d50985f..57120877975 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_argument.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_argument.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import '../util.dart'; class RemoveArgument extends ResolvedCorrectionProducer { - RemoveArgument({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_assertion.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_assertion.dart index 27e0081c7da..7e499dec2f8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_assertion.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_assertion.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveAssertion extends ResolvedCorrectionProducer { - RemoveAssertion({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_assignment.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_assignment.dart index c40187e7013..cf99b83224b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_assignment.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_assignment.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveAssignment extends ResolvedCorrectionProducer { - RemoveAssignment({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_async.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_async.dart index 1d69e897dcc..d0a148de4b4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_async.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_async.dart @@ -19,9 +19,9 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveAsync extends ResolvedCorrectionProducer { final _Type _type; - RemoveAsync({required super.context}) : _type = _Type.other; + new({required super.context}) : _type = _Type.other; - RemoveAsync.unnecessary({required super.context}) : _type = _Type.unnecessary; + new unnecessary({required super.context}) : _type = _Type.unnecessary; @override CorrectionApplicability get applicability => @@ -155,7 +155,7 @@ class _VisitorTester extends RecursiveAstVisitor { bool _processingFuture = false; /// Initialize a newly created visitor. - _VisitorTester(this.typeSystem, this.typeProvider, this.argumentType); + new(this.typeSystem, this.typeProvider, this.argumentType); /// A flag indicating whether an await expression was found. bool get foundAwait => _foundAwait; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_break.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_break.dart index 07ebd9f843f..87f035c1a61 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_break.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_break.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveBreak extends ResolvedCorrectionProducer { - RemoveBreak({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_character.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_character.dart index f07026d688a..e42c3d7327c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_character.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_character.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveCharacter extends ResolvedCorrectionProducer { String _codePoint = ''; - RemoveCharacter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_comma.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_comma.dart index 2edbdf793cd..8bf0965153c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_comma.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_comma.dart @@ -12,18 +12,18 @@ class RemoveComma extends ResolvedCorrectionProducer { final String commaKind; final String targetDescription; - RemoveComma.emptyRecordLiteral({required CorrectionProducerContext context}) + new emptyRecordLiteral({required CorrectionProducerContext context}) : this._(context: context, targetDescription: 'empty record literals'); - RemoveComma.emptyRecordType({required CorrectionProducerContext context}) + new emptyRecordType({required CorrectionProducerContext context}) : this._(context: context, targetDescription: 'empty record types'); - RemoveComma.representationField({required CorrectionProducerContext context}) + new representationField({required CorrectionProducerContext context}) : this._( context: context, commaKind: 'trailing ', targetDescription: 'representation fields', ); - RemoveComma._({ + new _({ required super.context, this.commaKind = '', required this.targetDescription, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_comment.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_comment.dart index a43322dc805..ecaab449230 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_comment.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_comment.dart @@ -11,9 +11,9 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveComment extends ResolvedCorrectionProducer { - RemoveComment({required super.context}); + new({required super.context}); - factory RemoveComment.ignore({required CorrectionProducerContext context}) => + factory ignore({required CorrectionProducerContext context}) => _RemoveIgnoreComment(context: context); @override @@ -50,7 +50,7 @@ class RemoveComment extends ResolvedCorrectionProducer { } class _RemoveIgnoreComment extends RemoveComment { - _RemoveIgnoreComment({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_comparison.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_comparison.dart index dfa862e059f..c3b0c83dde8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_comparison.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_comparison.dart @@ -22,12 +22,12 @@ class RemoveComparison extends ResolvedCorrectionProducer { final FixKind multiFixKind; /// Initialize a newly created instance with [DartFixKind.removeComparison]. - RemoveComparison({required super.context}) + new({required super.context}) : fixKind = DartFixKind.removeComparison, multiFixKind = DartFixKind.removeComparisonMulti; /// Initialize a newly created instance with [DartFixKind.removeTypeCheck]. - RemoveComparison.typeCheck({required super.context}) + new typeCheck({required super.context}) : fixKind = DartFixKind.removeTypeCheck, multiFixKind = DartFixKind.removeTypeCheckMulti; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart index 35083186708..9184aaf82cb 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart @@ -19,7 +19,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; class RemoveConst extends _RemoveConst { - RemoveConst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -31,7 +31,7 @@ class RemoveConst extends _RemoveConst { } class RemoveUnnecessaryConst extends _RemoveConst { - RemoveUnnecessaryConst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -50,7 +50,7 @@ class _ChildrenVisitor extends GeneralizingAstVisitor { final int offset; final int end; - _ChildrenVisitor(this.offset, this.end); + new(this.offset, this.end); AstNode get selectedNode => _selectedNode!; @@ -73,7 +73,7 @@ class _PushConstVisitor extends GeneralizingAstVisitor { final DartFileEditBuilder builder; final List excluded; - _PushConstVisitor(this.builder, this.excluded); + new(this.builder, this.excluded); @override void visitDotShorthandConstructorInvocation( @@ -148,7 +148,7 @@ class _PushConstVisitor extends GeneralizingAstVisitor { } abstract class _RemoveConst extends ParsedCorrectionProducer { - _RemoveConst({required super.context}); + new({required super.context}); /// A map of all the error codes that this fix can be applied to and the /// generators that can be used to apply the fix. diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor.dart index b85a8759ec0..18a89ed8a21 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; class RemoveConstructor extends ResolvedCorrectionProducer { - RemoveConstructor({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -132,12 +132,12 @@ class _Container { final Token leftBracket; final List members; - _Container({required this.leftBracket, required this.members}); + new({required this.leftBracket, required this.members}); } class _PrimaryConstructor { final Token leftParen; final Token rightParen; - _PrimaryConstructor({required this.leftParen, required this.rightParen}); + new({required this.leftParen, required this.rightParen}); } diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart index 8848956ff79..5e93251dacc 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveConstructorName extends ResolvedCorrectionProducer { - RemoveConstructorName({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart index a39c6eaac1e..19c540cb67e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart @@ -20,7 +20,7 @@ class RemoveDeadCode extends ResolvedCorrectionProducer { late final int _errorOffset; late final int _errorEnd; - RemoveDeadCode({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_if_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_if_null.dart index a453464095d..761c601bb1e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_if_null.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_dead_if_null.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveDeadIfNull extends ResolvedCorrectionProducer { - RemoveDeadIfNull({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_default_value.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_default_value.dart index acab05532c6..9d9de6bb216 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_default_value.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_default_value.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveDefaultValue extends ResolvedCorrectionProducer { - RemoveDefaultValue({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_deprecated_new_in_comment_reference.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_deprecated_new_in_comment_reference.dart index 87420877fc7..ef53f42c550 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_deprecated_new_in_comment_reference.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_deprecated_new_in_comment_reference.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveDeprecatedNewInCommentReference extends ResolvedCorrectionProducer { - RemoveDeprecatedNewInCommentReference({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_digit_separators.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_digit_separators.dart index ef64ab6f2b1..2745a406f91 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_digit_separators.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_digit_separators.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveDigitSeparators extends ResolvedCorrectionProducer { - RemoveDigitSeparators({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_duplicate_case.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_duplicate_case.dart index efa07c95bc2..fd5f6dab2ea 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_duplicate_case.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_duplicate_case.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveDuplicateCase extends ResolvedCorrectionProducer { - RemoveDuplicateCase({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_catch.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_catch.dart index 35c5e45d2f9..a472d24aff9 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_catch.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_catch.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveEmptyCatch extends ResolvedCorrectionProducer { - RemoveEmptyCatch({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_constructor_body.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_constructor_body.dart index 37cc18e8de2..b5fe71460ee 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_constructor_body.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_constructor_body.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveEmptyConstructorBody extends ResolvedCorrectionProducer { - RemoveEmptyConstructorBody({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_container_body.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_container_body.dart index 0f9f5c3445e..216af42a709 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_container_body.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_container_body.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveEmptyContainerBody extends ResolvedCorrectionProducer { late String containerKind; - RemoveEmptyContainerBody({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_else.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_else.dart index ca987b10dfa..1c36ea441fd 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_else.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_else.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveEmptyElse extends ResolvedCorrectionProducer { - RemoveEmptyElse({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_statement.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_statement.dart index d5a813f5cff..13662678557 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_statement.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_empty_statement.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveEmptyStatement extends ResolvedCorrectionProducer { - RemoveEmptyStatement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_extends_clause.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_extends_clause.dart index 05f608e1aa9..56d42c73292 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_extends_clause.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_extends_clause.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveExtendsClause extends ResolvedCorrectionProducer { - RemoveExtendsClause({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_if_null_operator.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_if_null_operator.dart index bf6621b36b8..03b5c4ee8e1 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_if_null_operator.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_if_null_operator.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveIfNullOperator extends ResolvedCorrectionProducer { - RemoveIfNullOperator({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_ignored_diagnostic.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_ignored_diagnostic.dart index 8a1bb98f5a3..88def58e546 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_ignored_diagnostic.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_ignored_diagnostic.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveIgnoredDiagnostic extends ResolvedCorrectionProducer { String _diagnosticName = ''; - RemoveIgnoredDiagnostic({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart index 38902e2c6f4..b096e66da7b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart @@ -18,18 +18,18 @@ class RemoveInitializer extends ResolvedCorrectionProducer { /// Initialize a newly created instance that can't apply bulk and in-file /// fixes. - RemoveInitializer({required super.context}) + new({required super.context}) : applicability = CorrectionApplicability.singleLocation, _removeLate = true; /// Initialize a newly created instance that can apply bulk and in-file fixes. - RemoveInitializer.bulkFixable({required super.context}) + new bulkFixable({required super.context}) : applicability = CorrectionApplicability.automatically, _removeLate = true; /// Initialize a newly created instance that can't apply bulk and in-file /// fixes and will not remove the `late` keyword if present. - RemoveInitializer.notLate({required super.context}) + new notLate({required super.context}) : applicability = CorrectionApplicability.singleLocation, _removeLate = false; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_interpolation_braces.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_interpolation_braces.dart index f875ca70685..1e176fbc6be 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_interpolation_braces.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_interpolation_braces.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveInterpolationBraces extends ResolvedCorrectionProducer { - RemoveInterpolationBraces({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_invocation.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_invocation.dart index bb10f48fbd0..bced2aa1afc 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_invocation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_invocation.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveInvocation extends ResolvedCorrectionProducer { String _methodName = ''; - RemoveInvocation({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_keyword.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_keyword.dart index d9f7fc1c4ef..0be97bedfce 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_keyword.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_keyword.dart @@ -13,13 +13,11 @@ class RemoveKeyword extends ResolvedCorrectionProducer { /// The keyword to remove. final Keyword _keyword; - RemoveKeyword.awaitKeyword({required super.context}) - : _keyword = Keyword.AWAIT; + new awaitKeyword({required super.context}) : _keyword = Keyword.AWAIT; - RemoveKeyword.covariantKeyword({required super.context}) - : _keyword = Keyword.COVARIANT; + new covariantKeyword({required super.context}) : _keyword = Keyword.COVARIANT; - RemoveKeyword.varKeyword({required super.context}) : _keyword = Keyword.VAR; + new varKeyword({required super.context}) : _keyword = Keyword.VAR; @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_late.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_late.dart index 2c738809e72..4cca22b1fdc 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_late.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_late.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveLate extends ResolvedCorrectionProducer { - RemoveLate({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -88,5 +88,5 @@ class _LateKeywordLocation { final Token lateKeyword; final Token nextToken; - _LateKeywordLocation({required this.lateKeyword, required this.nextToken}); + new({required this.lateKeyword, required this.nextToken}); } diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart index f4b40a7eca2..e6d353ccce5 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveLeadingUnderscore extends ResolvedCorrectionProducer { - RemoveLeadingUnderscore({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_lexeme.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_lexeme.dart index 57d4fc5b405..ecbc9ce59ee 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_lexeme.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_lexeme.dart @@ -16,13 +16,13 @@ class RemoveLexeme extends ResolvedCorrectionProducer { // The kind of lexeme (e.g., 'keyword' vs. 'modifier'). final String kind; - RemoveLexeme.keyword({required CorrectionProducerContext context}) + new keyword({required CorrectionProducerContext context}) : this._(context: context, kind: 'keyword'); - RemoveLexeme.modifier({required CorrectionProducerContext context}) + new modifier({required CorrectionProducerContext context}) : this._(context: context, kind: 'modifier'); - RemoveLexeme._({required super.context, required this.kind}); + new _({required super.context, required this.kind}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_library_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_library_name.dart index bd98c992a80..a35fbd973db 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_library_name.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_library_name.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveLibraryName extends ResolvedCorrectionProducer { - RemoveLibraryName({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_method_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_method_declaration.dart index 137d9292941..31008f0bb9c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_method_declaration.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_method_declaration.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveMethodDeclaration extends ResolvedCorrectionProducer { - RemoveMethodDeclaration({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_combinator.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_combinator.dart index bfc76f0afc9..b48fffe526a 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_combinator.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_combinator.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveNameFromCombinator extends ResolvedCorrectionProducer { String _combinatorKind = ''; - RemoveNameFromCombinator({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_declaration_clause.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_declaration_clause.dart index c2ccb44847d..6f9d70e8cc0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_declaration_clause.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_name_from_declaration_clause.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveNameFromDeclarationClause extends ResolvedCorrectionProducer { String _fixMessage = ''; - RemoveNameFromDeclarationClause({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_non_null_assertion.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_non_null_assertion.dart index f09b49edcf2..c0d31faf1cb 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_non_null_assertion.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_non_null_assertion.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveNonNullAssertion extends ResolvedCorrectionProducer { - RemoveNonNullAssertion({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_on_clause.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_on_clause.dart index d6b9d4f579f..8f7e2968042 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_on_clause.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_on_clause.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveOnClause extends ResolvedCorrectionProducer { - RemoveOnClause({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_operator.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_operator.dart index 834a76d97ed..52477647777 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_operator.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_operator.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveOperator extends ResolvedCorrectionProducer { - RemoveOperator({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart index fe9c24db155..9aa23551a76 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveParametersInGetterDeclaration extends ResolvedCorrectionProducer { - RemoveParametersInGetterDeclaration({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_parentheses_in_getter_invocation.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_parentheses_in_getter_invocation.dart index a55013bf696..6cf30571e1f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_parentheses_in_getter_invocation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_parentheses_in_getter_invocation.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveParenthesesInGetterInvocation extends ResolvedCorrectionProducer { - RemoveParenthesesInGetterInvocation({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_print.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_print.dart index 5f300f3f0f3..fe79cfe2f9b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_print.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_print.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; /// Generates corrections that remove print expression statements, but /// not other usages of print. class RemovePrint extends ResolvedCorrectionProducer { - RemovePrint({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_question_mark.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_question_mark.dart index 6543f1e5df7..ed716a70616 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_question_mark.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_question_mark.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveQuestionMark extends ResolvedCorrectionProducer { - RemoveQuestionMark({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_required.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_required.dart index 7b6daadc6dc..4a47233d7f0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_required.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_required.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveRequired extends ResolvedCorrectionProducer { - RemoveRequired({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_returned_value.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_returned_value.dart index b426a3d61ae..b379617b926 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_returned_value.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_returned_value.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveReturnedValue extends ResolvedCorrectionProducer { - RemoveReturnedValue({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_this_expression.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_this_expression.dart index 661efeeb041..c2bcf418a07 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_this_expression.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_this_expression.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveThisExpression extends ResolvedCorrectionProducer { - RemoveThisExpression({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_to_list.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_to_list.dart index 0b0751fe6a0..1dc0e07d3bf 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_to_list.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_to_list.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveToList extends ResolvedCorrectionProducer { - RemoveToList({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart index 016443b4e3d..a7d2668d70d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart @@ -18,10 +18,9 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveTypeAnnotation extends ParsedCorrectionProducer { final _Kind _kind; - RemoveTypeAnnotation.fixVarAndType({required super.context}) - : _kind = _Kind.fixVarAndType; + new fixVarAndType({required super.context}) : _kind = _Kind.fixVarAndType; - RemoveTypeAnnotation.other({required super.context}) : _kind = _Kind.other; + new other({required super.context}) : _kind = _Kind.other; @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_arguments.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_arguments.dart index eafa984cc0b..a8d2e03d6d1 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_arguments.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_arguments.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveTypeArguments extends ResolvedCorrectionProducer { - RemoveTypeArguments({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_name.dart index da93f8dc710..cbd04f632f3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_name.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_name.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveTypeName extends ResolvedCorrectionProducer { - RemoveTypeName({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unawaited.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unawaited.dart index 580a74975a2..1b8b56e44d2 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unawaited.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unawaited.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnawaited extends ResolvedCorrectionProducer { - RemoveUnawaited({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unexpected_underscores.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unexpected_underscores.dart index 18a428c7b43..510874ee816 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unexpected_underscores.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unexpected_underscores.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveUnexpectedUnderscores extends ResolvedCorrectionProducer { - RemoveUnexpectedUnderscores({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_cast.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_cast.dart index a96481d4629..c0b57159fa0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_cast.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_cast.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryCast extends ResolvedCorrectionProducer { - RemoveUnnecessaryCast({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_final.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_final.dart index 7e3d1d1c739..0eb45bfe54e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_final.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_final.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryFinal extends ResolvedCorrectionProducer { - RemoveUnnecessaryFinal({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_late.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_late.dart index 5dd3cac7b25..c2231edd3c3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_late.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_late.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryLate extends ResolvedCorrectionProducer { - RemoveUnnecessaryLate({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_library_directive.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_library_directive.dart index 86b46da8b99..62a4b5814d8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_library_directive.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_library_directive.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryLibraryDirective extends ResolvedCorrectionProducer { - RemoveUnnecessaryLibraryDirective({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_name.dart index fefc97200d8..8ed4f31a3f8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_name.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_name.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryName extends ResolvedCorrectionProducer { - RemoveUnnecessaryName({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_new.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_new.dart index b42a95fa899..f4403a5a4d5 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_new.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_new.dart @@ -10,14 +10,14 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveNew extends _RemoveNew { - RemoveNew({required super.context}); + new({required super.context}); @override FixKind get fixKind => DartFixKind.removeNew; } class RemoveUnnecessaryNew extends _RemoveNew { - RemoveUnnecessaryNew({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -31,7 +31,7 @@ class RemoveUnnecessaryNew extends _RemoveNew { } class _RemoveNew extends ParsedCorrectionProducer { - _RemoveNew({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_parentheses.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_parentheses.dart index 13dd04cc540..969ee7d6c95 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_parentheses.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_parentheses.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryParentheses extends ResolvedCorrectionProducer { - RemoveUnnecessaryParentheses({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_raw_string.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_raw_string.dart index 8b429355cac..1fe44f04653 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_raw_string.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_raw_string.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveUnnecessaryRawString extends ResolvedCorrectionProducer { - RemoveUnnecessaryRawString({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_escape.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_escape.dart index eeee15d65af..3b249db13c5 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_escape.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_escape.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveUnnecessaryStringEscape extends ParsedCorrectionProducer { - RemoveUnnecessaryStringEscape({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_interpolation.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_interpolation.dart index 4ae61c3f702..d2bcf0b6582 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_interpolation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_string_interpolation.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryStringInterpolation extends ResolvedCorrectionProducer { - RemoveUnnecessaryStringInterpolation({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_wildcard_pattern.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_wildcard_pattern.dart index 9b48adf9e7e..11c2c1cf5dd 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_wildcard_pattern.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unnecessary_wildcard_pattern.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnnecessaryWildcardPattern extends ResolvedCorrectionProducer { - RemoveUnnecessaryWildcardPattern({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart index 52603b2f990..be2c8f70caf 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnusedElement extends _RemoveUnused { - RemoveUnusedElement({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -107,7 +107,7 @@ class RemoveUnusedElement extends _RemoveUnused { } class RemoveUnusedField extends _RemoveUnused { - RemoveUnusedField({required super.context}); + new({required super.context}); @override // Not predictably the correct action. @@ -258,7 +258,7 @@ class _ElementReferenceCollector extends RecursiveAstVisitor { final Element element; final List references = []; - _ElementReferenceCollector(this.element); + new(this.element); @override void visitFieldFormalParameter(FieldFormalParameter node) { @@ -298,7 +298,7 @@ class _ElementReferenceCollector extends RecursiveAstVisitor { } abstract class _RemoveUnused extends ResolvedCorrectionProducer { - _RemoveUnused({required super.context}); + new({required super.context}); List _findAllReferences(AstNode root, Element element) { var collector = _ElementReferenceCollector(element); diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_clause.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_clause.dart index 18dfad798f4..85ee22286f3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_clause.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_clause.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnusedCatchClause extends ResolvedCorrectionProducer { - RemoveUnusedCatchClause({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_stack.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_stack.dart index 59499896c2c..24983fc34eb 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_stack.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_stack.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnusedCatchStack extends ResolvedCorrectionProducer { - RemoveUnusedCatchStack({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_import.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_import.dart index 5325bc66d76..6188df77bd6 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_import.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_import.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnusedImport extends ResolvedCorrectionProducer { - RemoveUnusedImport({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_label.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_label.dart index 66f474f027a..202a645fe39 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_label.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_label.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnusedLabel extends ResolvedCorrectionProducer { - RemoveUnusedLabel({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart index 74b7ca980db..c0039e6403f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart @@ -20,7 +20,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnusedLocalVariable extends ResolvedCorrectionProducer { final List<_Command> _commands = []; - RemoveUnusedLocalVariable({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -389,10 +389,7 @@ class _AddExplicitFieldNameCommand extends _Command { final DeclaredVariablePattern declaredVariable; final PatternFieldName nameNode; - _AddExplicitFieldNameCommand({ - required this.declaredVariable, - required this.nameNode, - }); + new({required this.declaredVariable, required this.nameNode}); @override void execute(DartFileEditBuilder builder) { @@ -411,7 +408,7 @@ class _DeleteNodeInListCommand extends _Command { final NodeList nodes; final T node; - _DeleteNodeInListCommand({required this.nodes, required this.node}); + new({required this.nodes, required this.node}); @override void execute(DartFileEditBuilder builder) { @@ -423,7 +420,7 @@ class _DeleteNodeInListCommand extends _Command { class _DeleteSourceRangeCommand extends _Command { final SourceRange sourceRange; - _DeleteSourceRangeCommand({required this.sourceRange}); + new({required this.sourceRange}); @override void execute(DartFileEditBuilder builder) { @@ -435,7 +432,7 @@ class _DeleteStatementCommand extends _Command { final CorrectionUtils utils; final Statement statement; - _DeleteStatementCommand({required this.utils, required this.statement}); + new({required this.utils, required this.statement}); @override void execute(DartFileEditBuilder builder) { @@ -448,7 +445,7 @@ class _DeleteStatementCommand extends _Command { class _MakeItWildcardCommand extends _Command { final DeclaredVariablePattern declaredVariable; - _MakeItWildcardCommand({required this.declaredVariable}); + new({required this.declaredVariable}); @override void execute(DartFileEditBuilder builder) { @@ -461,10 +458,7 @@ class _ReplaceSourceRangeCommand extends _Command { final SourceRange sourceRange; final String replacement; - _ReplaceSourceRangeCommand({ - required this.sourceRange, - required this.replacement, - }); + new({required this.sourceRange, required this.replacement}); @override void execute(DartFileEditBuilder builder) { @@ -476,7 +470,7 @@ class _SideEffectVisitor extends RecursiveAstVisitor { final LocalVariableElement element; bool hasSideEffect = false; - _SideEffectVisitor(this.element); + new(this.element); @override void visitAssignmentExpression(AssignmentExpression node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart index 30a58403745..ab60b90603f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class RemoveUnusedParameter extends ResolvedCorrectionProducer { - RemoveUnusedParameter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_var.dart index e138727762c..a7f54a815e8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_var.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_var.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveVar extends ResolvedCorrectionProducer { - RemoveVar({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_var_keyword.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_var_keyword.dart index ce8a3dbe746..95409847c01 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/remove_var_keyword.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_var_keyword.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class RemoveVarKeyword extends ResolvedCorrectionProducer { - RemoveVarKeyword({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart index 978497d7e1a..ffa449c7f84 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart @@ -16,7 +16,7 @@ class RenameMethodParameter extends ResolvedCorrectionProducer { String _oldName = ''; String _newName = ''; - RenameMethodParameter({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -88,7 +88,7 @@ class _Collector extends RecursiveAstVisitor { final oldTokens = []; - _Collector(this.newName, this.target); + new(this.newName, this.target); @override void visitRegularFormalParameter(RegularFormalParameter node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart index 02166ceadee..de64214b519 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart @@ -17,7 +17,7 @@ class RenameToCamelCase extends ResolvedCorrectionProducer { /// The camel-case version of the name. String _newName = ''; - RenameToCamelCase({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart index 05b4ebd2c17..d08f6aea26f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_boolean_with_bool.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceBooleanWithBool extends ResolvedCorrectionProducer { - ReplaceBooleanWithBool({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.dart index 94b453535b9..6bc48a6aa1c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_cascade_with_dot.dart @@ -21,7 +21,7 @@ class ReplaceCascadeWithDot extends ResolvedCorrectionProducer { TokenType.QUESTION_PERIOD_PERIOD: '?.', }; - ReplaceCascadeWithDot({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.dart index 9f0263ae980..3db9b8e6037 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_equals.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceColonWithEquals extends ResolvedCorrectionProducer { - ReplaceColonWithEquals({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_in.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_in.dart index c77916a9e05..57c5ec4a162 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_in.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_colon_with_in.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class ReplaceColonWithIn extends ResolvedCorrectionProducer { - ReplaceColonWithIn({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart index 9ffe756cded..b0fb15ca84f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceConditionalWithIfElse extends ResolvedCorrectionProducer { - ReplaceConditionalWithIfElse({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_colored_box.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_colored_box.dart index 93fb916441d..4bed2087738 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_colored_box.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_colored_box.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceContainerWithColoredBox extends ResolvedCorrectionProducer { - ReplaceContainerWithColoredBox({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_sized_box.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_sized_box.dart index 7bd12aefb71..0ed4da8e0c7 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_sized_box.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_sized_box.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceContainerWithSizedBox extends ResolvedCorrectionProducer { - ReplaceContainerWithSizedBox({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_empty_map_pattern.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_empty_map_pattern.dart index 28cf009d164..6c73103d783 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_empty_map_pattern.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_empty_map_pattern.dart @@ -14,12 +14,11 @@ class ReplaceEmptyMapPattern extends ResolvedCorrectionProducer { /// Initializes a newly created correction producer to create an object /// pattern that will match any map. - ReplaceEmptyMapPattern.any({required super.context}) : _style = _Style.any; + new any({required super.context}) : _style = _Style.any; /// Initializes a newly created correction producer to create an object /// pattern that will match an empty map. - ReplaceEmptyMapPattern.empty({required super.context}) - : _style = _Style.empty; + new empty({required super.context}) : _style = _Style.empty; @override CorrectionApplicability get applicability => @@ -63,5 +62,5 @@ enum _Style { final FixKind fixKind; - const _Style(this.fixKind); + new(this.fixKind); } diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart index e6b8803ae07..32d27eb5429 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceFinalWithConst extends ResolvedCorrectionProducer { - ReplaceFinalWithConst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart index 2e358889182..22e085bf95f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_var.dart @@ -19,7 +19,7 @@ class ReplaceFinalWithVar extends ResolvedCorrectionProducer { final bool _canBeBulkApplied; - factory ReplaceFinalWithVar({required CorrectionProducerContext context}) { + factory({required CorrectionProducerContext context}) { if (context is StubCorrectionProducerContext) { return ReplaceFinalWithVar._( context: context, @@ -51,7 +51,7 @@ class ReplaceFinalWithVar extends ResolvedCorrectionProducer { ); } - ReplaceFinalWithVar._({ + new _({ required super.context, required this._finalKeyword, required this._removeFinal, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart index 3e9754297f6..298b5db2a56 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceIfElseWithConditional extends ResolvedCorrectionProducer { - ReplaceIfElseWithConditional({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.dart index f0e10383697..f1ec333e03d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_new_with_const.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceNewWithConst extends ResolvedCorrectionProducer { - ReplaceNewWithConst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_check_with_cast.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_check_with_cast.dart index 5ebf37051b1..787f7687db3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_check_with_cast.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_check_with_cast.dart @@ -14,7 +14,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceNullCheckWithCast extends ResolvedCorrectionProducer { - ReplaceNullCheckWithCast({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart index a627a6e59c6..044ace0e5a3 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceNullWithClosure extends ResolvedCorrectionProducer { - ReplaceNullWithClosure({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_void.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_void.dart index 741cb8d5a4b..c50a5685754 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_void.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_void.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceNullWithVoid extends ResolvedCorrectionProducer { - ReplaceNullWithVoid({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type.dart index b2d98289bd9..3997b8f6836 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceReturnType extends ResolvedCorrectionProducer { String _newType = ''; - ReplaceReturnType({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.dart index 9df829c102f..32dd97e5c7b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_future.dart @@ -12,7 +12,7 @@ class ReplaceReturnTypeFuture extends ResolvedCorrectionProducer { /// The text for the type argument to 'Future'. String _typeArgument = ''; - ReplaceReturnTypeFuture({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_iterable.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_iterable.dart index c7e7c9fb3a5..2743e59f740 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_iterable.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_iterable.dart @@ -14,7 +14,7 @@ class ReplaceReturnTypeIterable extends ResolvedCorrectionProducer { /// The text for the type argument to 'Iterable'. String _typeArgument = ''; - ReplaceReturnTypeIterable({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_stream.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_stream.dart index a851369bef9..a13b12f4053 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_stream.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_return_type_stream.dart @@ -14,7 +14,7 @@ class ReplaceReturnTypeStream extends ResolvedCorrectionProducer { /// The text for the type argument to 'Stream'. String _typeArgument = ''; - ReplaceReturnTypeStream({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart index c27cb8adeff..fe0a98b352c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceVarWithDynamic extends ResolvedCorrectionProducer { - ReplaceVarWithDynamic({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_arrow.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_arrow.dart index ce73a5869f0..8233d49081d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_arrow.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_arrow.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithArrow extends ResolvedCorrectionProducer { - ReplaceWithArrow({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.dart index e44220e9149..845098d9939 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_brackets.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithBrackets extends ResolvedCorrectionProducer { - ReplaceWithBrackets({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.dart index 2a02271095b..432b64fc281 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_conditional_assignment.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithConditionalAssignment extends ResolvedCorrectionProducer { - ReplaceWithConditionalAssignment({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_decorated_box.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_decorated_box.dart index 28935b9502c..d5c41acdb1c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_decorated_box.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_decorated_box.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:linter/src/diagnostic.dart' as diag; class ReplaceWithDecoratedBox extends ResolvedCorrectionProducer { - ReplaceWithDecoratedBox({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.dart index 88c7fd4c28f..3e0aff29fd0 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_eight_digit_hex.dart @@ -20,7 +20,7 @@ class ReplaceWithEightDigitHex extends ResolvedCorrectionProducer { /// The replacement text, used as an argument to the fix message. String _replacement = ''; - ReplaceWithEightDigitHex({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.dart index f05acea67e3..1c4ac42fd30 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_extension_name.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithExtensionName extends ResolvedCorrectionProducer { String _extensionName = ''; - ReplaceWithExtensionName({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.dart index 2a877e311c3..06746d4a22d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_identifier.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithIdentifier extends ResolvedCorrectionProducer { - ReplaceWithIdentifier({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart index 1f48f66fc5b..fea41366e0b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithInterpolation extends ResolvedCorrectionProducer { - ReplaceWithInterpolation({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -186,7 +186,7 @@ class _StringStyle { final int state; - factory _StringStyle({ + factory({ required bool multiline, required bool raw, required bool singleQuoted, @@ -198,7 +198,7 @@ class _StringStyle { ); } - _StringStyle._(this.state); + new _(this.state); @override int get hashCode => state; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is.dart index 2328a9f439d..4e7d126b1ca 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is.dart @@ -14,7 +14,7 @@ class ReplaceWithIs extends ResolvedCorrectionProducer { late String exclamationText; - ReplaceWithIs({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart index 1e8566d6fb3..a5306be9d25 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart @@ -22,7 +22,7 @@ class ReplaceWithIsEmpty extends ResolvedCorrectionProducer { final _Replacement? _replacement; - factory ReplaceWithIsEmpty({required CorrectionProducerContext context}) { + factory({required CorrectionProducerContext context}) { if (context is StubCorrectionProducerContext) { return ReplaceWithIsEmpty._( context: context, @@ -53,7 +53,7 @@ class ReplaceWithIsEmpty extends ResolvedCorrectionProducer { ); } - ReplaceWithIsEmpty._({ + new _({ required super.context, required this.fixKind, required this.multiFixKind, @@ -178,7 +178,7 @@ class _Replacement { final String getter; final Expression lengthTarget; - _Replacement.isEmpty(Expression lengthTarget) + new isEmpty(Expression lengthTarget) : this._( fixKind: DartFixKind.replaceWithIsEmpty, multiFixKind: DartFixKind.replaceWithIsEmptyMulti, @@ -186,7 +186,7 @@ class _Replacement { lengthTarget: lengthTarget, ); - _Replacement.isNotEmpty(Expression lengthTarget) + new isNotEmpty(Expression lengthTarget) : this._( fixKind: DartFixKind.replaceWithIsNotEmpty, multiFixKind: DartFixKind.replaceWithIsNotEmptyMulti, @@ -194,7 +194,7 @@ class _Replacement { lengthTarget: lengthTarget, ); - _Replacement._({ + new _({ required this.fixKind, required this.multiFixKind, required this.getter, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_nan.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_nan.dart index 6b066db6e17..b951c17453d 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_nan.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_nan.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithIsNan extends ResolvedCorrectionProducer { - ReplaceWithIsNan({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_named_constant.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_named_constant.dart index 1c7c4382cb0..c5bcdfa3651 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_named_constant.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_named_constant.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithNamedConstant extends ResolvedCorrectionProducer { - ReplaceWithNamedConstant({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.dart index a074883e8bf..0dae059af3b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware.dart @@ -14,7 +14,7 @@ class ReplaceWithNotNullAware extends ResolvedCorrectionProducer { /// The operator that will replace the existing operator. String _newOperator = ''; - ReplaceWithNotNullAware({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware_element_or_entry.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware_element_or_entry.dart index 6f26b8918d8..363dc9d7835 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware_element_or_entry.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_not_null_aware_element_or_entry.dart @@ -12,13 +12,13 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithNotNullAwareElementOrEntry extends ResolvedCorrectionProducer { final _ReplaceWithNotNullAwareElementOrEntryKind _kind; - ReplaceWithNotNullAwareElementOrEntry.entry({required super.context}) + new entry({required super.context}) : _kind = _ReplaceWithNotNullAwareElementOrEntryKind.entry; - ReplaceWithNotNullAwareElementOrEntry.mapKey({required super.context}) + new mapKey({required super.context}) : _kind = _ReplaceWithNotNullAwareElementOrEntryKind.mapKey; - ReplaceWithNotNullAwareElementOrEntry.mapValue({required super.context}) + new mapValue({required super.context}) : _kind = _ReplaceWithNotNullAwareElementOrEntryKind.mapValue; @override diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart index c73565c0241..10b8859750b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_null_aware.dart @@ -17,10 +17,10 @@ class ReplaceWithNullAware extends ResolvedCorrectionProducer { String _operator = '.'; String _operatorPrefix = '?'; - ReplaceWithNullAware.inChain({required super.context}) + new inChain({required super.context}) : _correctionKind = _CorrectionKind.inChain; - ReplaceWithNullAware.single({required super.context}) + new single({required super.context}) : _correctionKind = _CorrectionKind.single; @override diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_part_of_uri.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_part_of_uri.dart index 5b529c3685d..fc29010036c 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_part_of_uri.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_part_of_uri.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithPartOrUriEmpty extends ResolvedCorrectionProducer { String _uriStr = ''; - ReplaceWithPartOrUriEmpty({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.dart index 66c8432ef7f..4be59fc86f6 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_tear_off.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithTearOff extends ResolvedCorrectionProducer { - ReplaceWithTearOff({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_unicode_escape.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_unicode_escape.dart index 82cfc4afb0e..f9c98491111 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_unicode_escape.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_unicode_escape.dart @@ -9,7 +9,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithUnicodeEscape extends ResolvedCorrectionProducer { - ReplaceWithUnicodeEscape({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart index bee4012f4f9..ccc8c50c9ee 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithVar extends ResolvedCorrectionProducer { - ReplaceWithVar({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_wildcard.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_wildcard.dart index e5f7c57527e..f10a8efa697 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_wildcard.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_wildcard.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class ReplaceWithWildcard extends ResolvedCorrectionProducer { - ReplaceWithWildcard({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart index bbca59248ea..aaf18ab6c98 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/shadow_field.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; class ShadowField extends ResolvedCorrectionProducer { - ShadowField({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -135,7 +135,7 @@ class _ReferenceFinder extends RecursiveAstVisitor { /// Initialize a newly created reference finder to find references to the /// given [setter]. - _ReferenceFinder(this.setter); + new(this.setter); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/simplify_directive_path.dart b/pkg/analysis_server/lib/src/services/correction/dart/simplify_directive_path.dart index 9ddd7267f94..8fc65029742 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/simplify_directive_path.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/simplify_directive_path.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:path/path.dart' as path; class SimplifyDirectivePath extends ResolvedCorrectionProducer { - SimplifyDirectivePath({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart b/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart index 47be241dd4e..2a2c1c75473 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class SortChildPropertyLast extends ResolvedCorrectionProducer { - SortChildPropertyLast({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/sort_combinators.dart b/pkg/analysis_server/lib/src/services/correction/dart/sort_combinators.dart index c976aa94dda..636ef800745 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/sort_combinators.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/sort_combinators.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; class SortCombinators extends ResolvedCorrectionProducer { - SortCombinators({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart b/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart index ce3209553a4..4f6b0178f9b 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/sort_constructor_first.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class SortConstructorFirst extends ResolvedCorrectionProducer { - SortConstructorFirst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart b/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart index 3972e7de774..6c25b840ff4 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/range_factory.dart'; import 'package:collection/collection.dart'; class SortUnnamedConstructorFirst extends ResolvedCorrectionProducer { - SortUnnamedConstructorFirst({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.dart b/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.dart index 3455d41666c..2a416fad362 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/split_and_condition.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class SplitAndCondition extends ResolvedCorrectionProducer { - SplitAndCondition({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/split_multiple_declarations.dart b/pkg/analysis_server/lib/src/services/correction/dart/split_multiple_declarations.dart index b69d0937b22..b167b41a573 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/split_multiple_declarations.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/split_multiple_declarations.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class SplitMultipleDeclarations extends ResolvedCorrectionProducer { - SplitMultipleDeclarations({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart index bf11d096e87..118fed6ba59 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/range_factory.dart'; class SplitVariableDeclaration extends ResolvedCorrectionProducer { - SplitVariableDeclaration({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart b/pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart index 881d274fe60..dcc9751956f 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart @@ -12,7 +12,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; class SurroundWith extends MultiCorrectionProducer { - SurroundWith({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -141,7 +141,7 @@ abstract class _SurroundWith extends ResolvedCorrectionProducer { final String indentedCode; - _SurroundWith( + new( this.statementsRange, this.indentOld, this.indentNew, @@ -158,7 +158,7 @@ abstract class _SurroundWith extends ResolvedCorrectionProducer { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithBlock extends _SurroundWith { - _SurroundWithBlock( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -192,7 +192,7 @@ class _SurroundWithBlock extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithDoWhile extends _SurroundWith { - _SurroundWithDoWhile( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -225,7 +225,7 @@ class _SurroundWithDoWhile extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithFor extends _SurroundWith { - _SurroundWithFor( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -264,7 +264,7 @@ class _SurroundWithFor extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithForIn extends _SurroundWith { - _SurroundWithForIn( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -299,7 +299,7 @@ class _SurroundWithForIn extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithIf extends _SurroundWith { - _SurroundWithIf( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -332,7 +332,7 @@ class _SurroundWithIf extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithSetState extends _SurroundWith { - _SurroundWithSetState( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -367,7 +367,7 @@ class _SurroundWithSetState extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithTryCatch extends _SurroundWith { - _SurroundWithTryCatch( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -410,7 +410,7 @@ class _SurroundWithTryCatch extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithTryFinally extends _SurroundWith { - _SurroundWithTryFinally( + new( super.statementsRange, super.indentOld, super.indentNew, @@ -451,7 +451,7 @@ class _SurroundWithTryFinally extends _SurroundWith { /// A correction processor that can make one of the possible changes computed by /// the [SurroundWith] producer. class _SurroundWithWhile extends _SurroundWith { - _SurroundWithWhile( + new( super.statementsRange, super.indentOld, super.indentNew, diff --git a/pkg/analysis_server/lib/src/services/correction/dart/surround_with_parentheses.dart b/pkg/analysis_server/lib/src/services/correction/dart/surround_with_parentheses.dart index a2d93d36d01..c15eddf0eba 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/surround_with_parentheses.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/surround_with_parentheses.dart @@ -8,7 +8,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class SurroundWithParentheses extends ResolvedCorrectionProducer { - SurroundWithParentheses({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart b/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart index 6409e0d08ff..dcbc96a9c0e 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart @@ -18,7 +18,7 @@ class UpdateSdkConstraints extends ResolvedCorrectionProducer { /// Initializes a newly created instance that will update the SDK constraints /// to '2.14.0'. - UpdateSdkConstraints.version_2_14_0({required super.context}) + new version_2_14_0({required super.context}) : _minimumVersion = Version(2, 14, 0); @override diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart index beffc5febb0..84bd2279907 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart @@ -18,7 +18,7 @@ class UseCurlyBraces extends ParsedCorrectionProducer { @override final CorrectionApplicability applicability; - UseCurlyBraces({required super.context}) + new({required super.context}) : applicability = CorrectionApplicability.acrossFiles; /// Create an instance that is prevented from being applied automatically in @@ -27,7 +27,7 @@ class UseCurlyBraces extends ParsedCorrectionProducer { /// This is used in places where "Use Curly Braces" is a valid manual fix, but /// not clearly the only/correct fix to apply automatically, such as the /// `always_put_control_body_on_new_line` lint. - UseCurlyBraces.nonBulk({required super.context}) + new nonBulk({required super.context}) : applicability = CorrectionApplicability.acrossSingleFile; @override diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_different_division_operator.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_different_division_operator.dart index 624bef8f40e..6d63f21edca 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/use_different_division_operator.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/use_different_division_operator.dart @@ -15,7 +15,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class UseDifferentDivisionOperator extends MultiCorrectionProducer { - UseDifferentDivisionOperator({required super.context}); + new({required super.context}); @override Future> get producers async { @@ -63,10 +63,7 @@ class _UseDifferentDivisionOperator extends ResolvedCorrectionProducer { @override final FixKind fixKind; - _UseDifferentDivisionOperator({ - required super.context, - required this.fixKind, - }); + new({required super.context, required this.fixKind}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart index cb1e38a0fb7..cae68b44fa8 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/use_effective_integer_division.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class UseEffectiveIntegerDivision extends ResolvedCorrectionProducer { - UseEffectiveIntegerDivision({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.dart index 5f404fcc4da..08544cf05f2 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/use_eq_eq_null.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class UseEqEqNull extends ResolvedCorrectionProducer { - UseEqEqNull({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.dart index 809d3d035fc..1cd6220f801 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/use_is_not_empty.dart @@ -11,7 +11,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class UseIsNotEmpty extends ResolvedCorrectionProducer { - UseIsNotEmpty({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.dart index 4d8f4eaf4ea..130c3160ac7 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/use_not_eq_null.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class UseNotEqNull extends ResolvedCorrectionProducer { - UseNotEqNull({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.dart b/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.dart index 305a3654c15..91b0d9a2703 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/use_rethrow.dart @@ -10,7 +10,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class UseRethrow extends ResolvedCorrectionProducer { - UseRethrow({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart b/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart index 671b5544c41..a7d25d482a5 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class WrapInText extends ResolvedCorrectionProducer { - WrapInText({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => @@ -76,5 +76,5 @@ class _Context { final Expression stringExpression; final FormalParameterElement parameterElement; - _Context({required this.stringExpression, required this.parameterElement}); + new({required this.stringExpression, required this.parameterElement}); } diff --git a/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_unawaited.dart b/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_unawaited.dart index 2bc2c5fe539..cff9354b910 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_unawaited.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/wrap_in_unawaited.dart @@ -13,7 +13,7 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; import 'package:analyzer_plugin/utilities/range_factory.dart'; class WrapInUnawaited extends ResolvedCorrectionProducer { - WrapInUnawaited({required super.context}); + new({required super.context}); @override CorrectionApplicability get applicability => diff --git a/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart b/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart index e530e065161..b40ff1e0cf4 100644 --- a/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart +++ b/pkg/analysis_server/lib/src/services/correction/executable_parameters.dart @@ -17,11 +17,7 @@ class ExecutableParameters { final List optionalPositional = []; final List named = []; - ExecutableParameters._( - this.sessionHelper, - this.executable, - this.firstFragment, - ) { + new _(this.sessionHelper, this.executable, this.firstFragment) { for (var parameter in executable.formalParameters) { if (parameter.isRequiredPositional) { required.add(parameter); diff --git a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart index d48a7f60129..f5ced823eab 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart @@ -56,12 +56,8 @@ class AnalysisOptionsFixGenerator { final List fixes = []; - AnalysisOptionsFixGenerator( - this.resourceProvider, - this.diagnostic, - this.content, - this.options, - ) : diagnosticOffset = diagnostic.offset, + new(this.resourceProvider, this.diagnostic, this.content, this.options) + : diagnosticOffset = diagnostic.offset, diagnosticLength = diagnostic.length, lineInfo = LineInfo.fromContent(content); @@ -376,7 +372,7 @@ class _NonDartChangeWorkspace implements ChangeWorkspace { @override ResourceProvider resourceProvider; - _NonDartChangeWorkspace(this.resourceProvider); + new(this.resourceProvider); @override bool containsFile(String path) { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart index 9917f0db701..dd1ec76946f 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart @@ -15,7 +15,7 @@ abstract class Accessor { /// The result of using an accessor to get a result. abstract class AccessorResult { /// Initialize a newly created result. - const AccessorResult(); + const new(); /// Return `true` if the accessor returned a valid result. bool get isValid; @@ -33,7 +33,7 @@ class ArgumentAccessor extends Accessor { /// Initialize a newly created accessor to access the argument that /// corresponds to the given [parameter]. - ArgumentAccessor(this.parameter); + new(this.parameter); @override AccessorResult getValue(Object? target) { @@ -74,7 +74,7 @@ class ArgumentAccessor extends Accessor { /// A representation of an invalid result. class InvalidResult implements AccessorResult { /// Initialize a newly created invalid result. - const InvalidResult(); + const new(); @override bool get isValid => false; @@ -90,7 +90,7 @@ class TypeArgumentAccessor extends Accessor { /// Initialize a newly created accessor to access the type argument at the /// given [index]. - TypeArgumentAccessor(this.index); + new(this.index); @override AccessorResult getValue(Object? target) { @@ -132,7 +132,7 @@ class ValidResult implements AccessorResult { final Object result; /// Initialize a newly created valid result. - ValidResult(this.result); + new(this.result); @override bool get isValid => true; diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart index 64f1754e9b1..f20dbca735b 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart @@ -26,7 +26,7 @@ class AddTypeParameter extends Change<_Data> { /// Initialize a newly created change to describe adding a type parameter to a /// type or a function. - AddTypeParameter({ + new({ required this.index, required this.name, required this.argumentValue, @@ -195,7 +195,7 @@ class _TypeArgumentData extends _Data { final int newListOffset; /// Initialize newly created data. - _TypeArgumentData(this.typeArguments, this.newListOffset); + new(this.typeArguments, this.newListOffset); } /// The data returned when updating a type parameter list. @@ -209,5 +209,5 @@ class _TypeParameterData extends _Data { final int newListOffset; /// Initialize newly created data. - _TypeParameterData(this.typeParameters, this.newListOffset); + new(this.typeParameters, this.newListOffset); } diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart index afd5ea567d3..448e6bf699c 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/changes_selector.dart @@ -21,7 +21,7 @@ class ConditionalChangesSelector implements ChangesSelector { /// Initialize a newly created conditional changes selector with the changes /// in the [changeMap]. - ConditionalChangesSelector(this.changeMap); + new(this.changeMap); @override List>? getChanges(TemplateContext context) { @@ -42,7 +42,7 @@ class UnconditionalChangesSelector implements ChangesSelector { /// Initialize a newly created changes selector to return the given list of /// [changes]. - UnconditionalChangesSelector(this.changes); + new(this.changes); @override List> getChanges(TemplateContext context) { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart index b9679dd6c2f..7f57e96ab6c 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart @@ -31,7 +31,7 @@ class CodeFragmentParser { int currentIndex = 0; /// Initialize a newly created parser to report errors to the [diagnosticReporter]. - CodeFragmentParser(this.diagnosticReporter, {VariableScope? scope}) + new(this.diagnosticReporter, {VariableScope? scope}) : variableScope = scope ?? VariableScope(null, {}); /// Return the current token, or `null` if the end of the tokens has been @@ -381,7 +381,7 @@ class _CodeFragmentScanner { final DiagnosticReporter _diagnosticReporter; /// Initialize a newly created scanner to scan the given [content]. - _CodeFragmentScanner(this.content, this.delta, this._diagnosticReporter) + new(this.content, this.delta, this._diagnosticReporter) : length = content.length; /// Return the tokens in the content, or `null` if there is an error in the @@ -507,7 +507,7 @@ class _Token { final String lexeme; /// Initialize a newly created token. - _Token(this.offset, this.kind, this.lexeme); + new(this.offset, this.kind, this.lexeme); /// Return the length of this token. int get length => lexeme.length; diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart index 5cfdb5a6545..814c913a717 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart @@ -23,7 +23,7 @@ class CodeTemplate { /// Initialize a newly generated code template with the given [kind] and /// [components]. - CodeTemplate(this.kind, this.components, this.requiredIfCondition); + new(this.kind, this.components, this.requiredIfCondition); /// Use the [context] to validate that this template will be able to generate /// a value. @@ -71,11 +71,11 @@ class TemplateContext { final CorrectionUtils utils; /// Initialize a newly created template context with the [node] and [utils]. - TemplateContext(this.node, this.utils); + new(this.node, this.utils); /// Initialize a newly created template context that uses the invocation /// containing the [node] and the [utils]. - factory TemplateContext.forInvocation(AstNode node, CorrectionUtils utils) => + factory forInvocation(AstNode node, CorrectionUtils utils) => TemplateContext(_getInvocation(node), utils); /// Return the invocation containing the given [node]. The invocation will be @@ -144,7 +144,7 @@ class TemplateText extends TemplateComponent { final String text; /// Initialize a newly create template text with the given [text]. - TemplateText(this.text); + new(this.text); @override bool validate(TemplateContext context) { @@ -163,7 +163,7 @@ class TemplateVariable extends TemplateComponent { final ValueGenerator generator; /// Initialize a newly created template variable with the given [generator]. - TemplateVariable(this.generator); + new(this.generator); @override bool validate(TemplateContext context) { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart index 319098129a2..0a78c3e815b 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart @@ -31,7 +31,7 @@ class ElementDescriptor { /// accessible via any of the [libraryUris] where the path to the element /// within the library is given by the list of [components]. The [kind] of the /// element is represented by the key used in the data file. - ElementDescriptor({ + new({ required this.libraryUris, required this.kind, required this.isStatic, diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_kind.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_kind.dart index 2e7c151156a..906d929c8d0 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_kind.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_kind.dart @@ -22,7 +22,7 @@ enum ElementKind { /// A human readable name for the kind. final String displayName; - const ElementKind(this.displayName); + new(this.displayName); /// The element kind corresponding to the given [name]. static ElementKind? fromName(String name) { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart index 5c7be246752..09470d597bb 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart @@ -41,7 +41,7 @@ class ElementMatcher { /// Initialize a newly created matcher representing a reference to an element /// whose name matches the given [components] and element [kinds] in a library /// that imports the [importedUris]. - ElementMatcher({ + new({ required this.importedUris, required this.components, required List kinds, @@ -198,7 +198,7 @@ class _MatcherBuilder { final LibraryElement libraryElement; - _MatcherBuilder(this.importedUris, this.libraryElement); + new(this.importedUris, this.libraryElement); void buildMatchersForNode(AstNode? node, Token? nameToken) { if (node is ArgumentList) { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.dart index cefa27351fa..b84b9968629 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/expression.dart @@ -18,7 +18,7 @@ class BinaryExpression extends Expression { /// Initialize a newly created binary expression consisting of the /// [leftOperand], [operator], and [rightOperand]. - BinaryExpression(this.leftOperand, this.operator, this.rightOperand); + new(this.leftOperand, this.operator, this.rightOperand); @override Object? evaluateIn(TemplateContext context) { @@ -58,7 +58,7 @@ class LiteralString extends Expression { final String value; /// Initialize a newly created literal string to have the given [value]. - LiteralString(this.value); + new(this.value); @override String evaluateIn(TemplateContext context) { @@ -79,7 +79,7 @@ class VariableReference extends Expression { /// Initialize a newly created variable reference to reference the variable /// whose value is computed by the [generator]. - VariableReference(this.generator); + new(this.generator); @override String evaluateIn(TemplateContext context) { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart index 2fcf6a60e35..bdaacd7e2eb 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart @@ -37,7 +37,7 @@ class AddParameter extends ParameterModification { /// Initialize a newly created parameter modification to represent the /// addition of a parameter. If provided, the [argumentValue] will be used as /// the value of the new argument in invocations of the function. - AddParameter( + new( this.index, this.name, this.isRequired, @@ -61,7 +61,7 @@ class ChangeParameterType extends ParameterModification { /// preexisting optional positional parameters after the ones being added. final CodeTemplate? argumentValue; - ChangeParameterType({ + new({ required this.reference, required this.nullability, required this.argumentValue, @@ -76,8 +76,7 @@ class ModifyParameters extends Change<_Data> { /// Initialize a newly created transform to modifications to the parameter /// list of a function. - ModifyParameters({required this.modifications}) - : assert(modifications.isNotEmpty); + new({required this.modifications}) : assert(modifications.isNotEmpty); @override // The private type of the [data] parameter is dictated by the signature of @@ -405,7 +404,7 @@ class RemoveParameter extends ParameterModification { /// Initialize a newly created parameter modification to represent the removal /// of an existing [parameter]. - RemoveParameter(this.parameter); + new(this.parameter); } /// The data returned when updating an invocation site. @@ -415,5 +414,5 @@ class _Data { /// Initialize a newly created data object with the data needed to update an /// invocation site. - _Data(this.argumentList); + new(this.argumentList); } diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart index c987f55ad9a..4413442ee51 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart @@ -17,7 +17,7 @@ class Rename extends Change<_Data> { /// Initialize a newly created transform to describe a renaming of an element /// to the [newName]. - Rename({required this.newName}); + new({required this.newName}); @override // The private type of the [data] parameter is dictated by the signature of @@ -115,5 +115,5 @@ class _Data { final AstNode node; final Token? nameToken; - _Data(this.node, this.nameToken); + new(this.node, this.nameToken); } diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart index 27299026edd..1de387e199f 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart @@ -20,7 +20,7 @@ class RenameParameter extends Change<_Data> { /// Initialize a newly created transform to describe a renaming of a parameter /// from the [oldName] to the [newName]. - RenameParameter({required this.newName, required this.oldName}); + new({required this.newName, required this.oldName}); @override // The private type of the [data] parameter is dictated by the signature of @@ -101,12 +101,12 @@ class RenameParameter extends Change<_Data> { /// The data returned from `validate`. abstract class _Data { - const _Data(); + const new(); } /// The data returned when the change doesn't apply. class _IgnoredData extends _Data { - const _IgnoredData(); + const new(); } /// The data returned when updating an invocation site. @@ -115,7 +115,7 @@ class _InvocationData extends _Data { final Token nameToken; /// Initialize newly created data about an invocation site. - _InvocationData(this.nameToken); + new(this.nameToken); } /// The data returned when updating an override site. @@ -124,7 +124,7 @@ class _OverrideData extends _Data { final MethodDeclaration methodDeclaration; /// Initialize newly created data about an override site. - _OverrideData(this.methodDeclaration); + new(this.methodDeclaration); } extension on MethodDeclaration { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart index 72c27784f28..b17bcbd83a8 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart @@ -27,7 +27,7 @@ class ReplacedBy extends Change<_Data> { /// Initialize a newly created transform to describe a replacement of an old /// element by a [newElement]. - ReplacedBy({ + new({ required this.newElement, required this.replaceTarget, List? argumentList, @@ -307,5 +307,5 @@ class _Data { final bool isInstanceMember; - _Data(this.referenceRange, {this.suffix, this.isInstanceMember = false}); + new(this.referenceRange, {this.suffix, this.isInstanceMember = false}); } diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart index 834897084ee..f3d3f5c7ae1 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform.dart @@ -26,7 +26,7 @@ class Transform { /// Initialize a newly created transform to describe a transformation of the /// [element]. - Transform({ + new({ required this.title, required this.date, required this.bulkApply, diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart index a2b73bfca16..cfcf5195762 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart @@ -28,7 +28,7 @@ class TransformSetManager { TransformSet? _sdkCache; /// Initialize a newly created transform set manager. - TransformSetManager._(); + new _(); /// Clear the internal cache. @visibleForTesting diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart index a987a49c140..4f0c55756af 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart @@ -40,7 +40,7 @@ class ErrorContext { final YamlNode parentNode; /// Initialize a newly created error context. - ErrorContext({required this.key, required this.parentNode}); + new({required this.key, required this.parentNode}); } /// A parser used to read a transform set from a file. @@ -180,7 +180,7 @@ class TransformSetParser { /// Initialize a newly created parser to report diagnostics to the /// [_diagnosticReporter]. - TransformSetParser(this._diagnosticReporter, this.packageName); + new(this._diagnosticReporter, this.packageName); /// Return the result of parsing the file [content] into a transform set, or /// `null` if the content does not represent a valid transform set. @@ -1692,7 +1692,7 @@ class _SingleKeyEntry { final String key; final T Function(String, YamlNode) translator; - _SingleKeyEntry({ + new({ required this.keyNode, required this.valueNode, required this.key, diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.dart index 18d14330e49..a3811c62ddd 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/value_generator.dart @@ -16,7 +16,7 @@ class CodeFragment extends ValueGenerator { final List accessors; /// Initialize a newly created extractor to extract a code fragment. - CodeFragment(this.accessors); + new(this.accessors); @override String evaluateIn(TemplateContext context) { @@ -80,7 +80,7 @@ class ImportedName extends ValueGenerator { /// The name to be used. final String name; - ImportedName(this.uris, this.name); + new(this.uris, this.name); @override String evaluateIn(TemplateContext context) { diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.dart index 77a3e750499..1ff630f9448 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/variable_scope.dart @@ -18,7 +18,7 @@ class VariableScope { /// Initialize a newly created variable scope defining the variables in the /// [_generators] map. Any variables not defined locally will be looked up in /// the [outerScope]. - VariableScope(this.outerScope, this._generators); + new(this.outerScope, this._generators); /// Return the generator used to generate the value of the variable with the /// given [variableName], or `null` if the variable is not defined. diff --git a/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart index 2183af8ecfa..3d4e5ce4d2e 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart @@ -55,7 +55,7 @@ class PubspecFixGenerator { /// The end-of-line marker to be used in this `pubspec.yaml` file. final String endOfLine; - PubspecFixGenerator( + new( this.resourceProvider, this.diagnostic, this.content, @@ -375,7 +375,7 @@ class _NonDartChangeWorkspace implements ChangeWorkspace { @override ResourceProvider resourceProvider; - _NonDartChangeWorkspace(this.resourceProvider); + new(this.resourceProvider); @override bool containsFile(String path) { @@ -392,5 +392,5 @@ class _Range { int startOffset; int endOffset; - _Range(this.startOffset, this.endOffset); + new(this.startOffset, this.endOffset); } diff --git a/pkg/analysis_server/lib/src/services/correction/fix_performance.dart b/pkg/analysis_server/lib/src/services/correction/fix_performance.dart index c532e71ba82..783d4b8e991 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix_performance.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix_performance.dart @@ -6,7 +6,7 @@ import 'package:analysis_server_plugin/src/correction/performance.dart'; /// Overall performance of a request for quick fixes operation. class GetFixesPerformance extends ProducerRequestPerformance { - GetFixesPerformance({ + new({ required super.performance, required super.path, super.requestLatency, diff --git a/pkg/analysis_server/lib/src/services/correction/organize_imports.dart b/pkg/analysis_server/lib/src/services/correction/organize_imports.dart index 6da8e3f6f9a..65b08c854b0 100644 --- a/pkg/analysis_server/lib/src/services/correction/organize_imports.dart +++ b/pkg/analysis_server/lib/src/services/correction/organize_imports.dart @@ -34,12 +34,8 @@ class ImportOrganizer { bool hasUnresolvedIdentifierError = false; - ImportOrganizer( - this.initialCode, - this.unit, - this.diagnostics, { - this.removeUnused = true, - }) : code = initialCode { + new(this.initialCode, this.unit, this.diagnostics, {this.removeUnused = true}) + : code = initialCode { endOfLine = getEOL(code); hasUnresolvedIdentifierError = diagnostics.any( (d) => d.diagnosticCode.isUnresolvedIdentifier, @@ -380,7 +376,7 @@ class _DirectiveInfo implements Comparable<_DirectiveInfo> { /// The text excluding comments, documentation and annotations. final String text; - _DirectiveInfo( + new( this.directive, this.priority, this.uri, diff --git a/pkg/analysis_server/lib/src/services/correction/refactoring_performance.dart b/pkg/analysis_server/lib/src/services/correction/refactoring_performance.dart index 356dd6c71f6..9a71c8003eb 100644 --- a/pkg/analysis_server/lib/src/services/correction/refactoring_performance.dart +++ b/pkg/analysis_server/lib/src/services/correction/refactoring_performance.dart @@ -7,7 +7,7 @@ import 'package:analyzer/src/util/performance/operation_performance.dart'; /// Overall performance of a request for refactorings operation. class GetRefactoringsPerformance extends ProducerRequestPerformance { - GetRefactoringsPerformance({ + new({ required super.performance, required super.path, super.requestLatency, @@ -23,5 +23,5 @@ class RefactoringPerformance { Duration? computeTime; List producerTimings = []; - RefactoringPerformance([this.operationPerformance]); + new([this.operationPerformance]); } diff --git a/pkg/analysis_server/lib/src/services/correction/selection_analyzer.dart b/pkg/analysis_server/lib/src/services/correction/selection_analyzer.dart index e3043c70102..f212b6c9c76 100644 --- a/pkg/analysis_server/lib/src/services/correction/selection_analyzer.dart +++ b/pkg/analysis_server/lib/src/services/correction/selection_analyzer.dart @@ -14,7 +14,7 @@ class SelectionAnalyzer extends GeneralizingAstVisitor { AstNode? _coveringNode; List _selectedNodes = []; - SelectionAnalyzer(this.selection); + new(this.selection); /// Return the [AstNode] with the shortest length which completely covers the /// specified selection. diff --git a/pkg/analysis_server/lib/src/services/correction/sort_members.dart b/pkg/analysis_server/lib/src/services/correction/sort_members.dart index a8ebdfeb80a..4457b875534 100644 --- a/pkg/analysis_server/lib/src/services/correction/sort_members.dart +++ b/pkg/analysis_server/lib/src/services/correction/sort_members.dart @@ -23,12 +23,8 @@ class MemberSorter { String code; - MemberSorter( - this._initialCode, - this._unit, - CodeStyleOptions codeStyle, - this._lineInfo, - ) : _priorityItems = _getPriorityItems(codeStyle), + new(this._initialCode, this._unit, CodeStyleOptions codeStyle, this._lineInfo) + : _priorityItems = _getPriorityItems(codeStyle), code = _initialCode; /// Returns the [SourceEdit]s that sort [_unit]. @@ -300,7 +296,7 @@ class _MemberInfo { final int end; final String text; - _MemberInfo(this.item, this.name, this.offset, this.length, this.text) + new(this.item, this.name, this.offset, this.length, this.text) : end = offset + length; @override @@ -332,9 +328,9 @@ class _PriorityItem { final bool isPrivate; final bool isStatic; - _PriorityItem(this.isStatic, this.kind, this.isPrivate); + new(this.isStatic, this.kind, this.isPrivate); - factory _PriorityItem.forName(bool isStatic, String name, _MemberKind kind) { + factory forName(bool isStatic, String name, _MemberKind kind) { var isPrivate = Identifier.isPrivateName(name); return _PriorityItem(isStatic, kind, isPrivate); } diff --git a/pkg/analysis_server/lib/src/services/correction/source_buffer.dart b/pkg/analysis_server/lib/src/services/correction/source_buffer.dart index 488743e7f25..1f57494c061 100644 --- a/pkg/analysis_server/lib/src/services/correction/source_buffer.dart +++ b/pkg/analysis_server/lib/src/services/correction/source_buffer.dart @@ -10,7 +10,7 @@ class SourceBuilder { int? _exitOffset; - SourceBuilder(this.file, this.offset); + new(this.file, this.offset); /// Returns the exit offset, maybe `null` if not set. int? get exitOffset { diff --git a/pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart b/pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart index f4fdc226973..c6d660a6a72 100644 --- a/pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart +++ b/pkg/analysis_server/lib/src/services/correction/statement_analyzer.dart @@ -42,8 +42,7 @@ class StatementAnalyzer extends SelectionAnalyzer { final RefactoringStatus _status = RefactoringStatus(); - StatementAnalyzer(this.resolveResult, SourceRange selection) - : super(selection); + new(this.resolveResult, SourceRange selection) : super(selection); /// Returns the [RefactoringStatus] result of selection checking. RefactoringStatus get status => _status; diff --git a/pkg/analysis_server/lib/src/services/correction/status.dart b/pkg/analysis_server/lib/src/services/correction/status.dart index 18b94d01814..5282899e4c4 100644 --- a/pkg/analysis_server/lib/src/services/correction/status.dart +++ b/pkg/analysis_server/lib/src/services/correction/status.dart @@ -14,24 +14,24 @@ class RefactoringStatus { final List problems = []; /// Creates a new OK [RefactoringStatus]. - RefactoringStatus(); + new(); /// Creates a new [RefactoringStatus] with the ERROR severity. - factory RefactoringStatus.error(String msg, [Location? location]) { + factory error(String msg, [Location? location]) { var status = RefactoringStatus(); status.addError(msg, location); return status; } /// Creates a new [RefactoringStatus] with the FATAL severity. - factory RefactoringStatus.fatal(String msg, [Location? location]) { + factory fatal(String msg, [Location? location]) { var status = RefactoringStatus(); status.addFatalError(msg, location); return status; } /// Creates a new [RefactoringStatus] with the WARNING severity. - factory RefactoringStatus.warning(String msg, [Location? location]) { + factory warning(String msg, [Location? location]) { var status = RefactoringStatus(); status.addWarning(msg, location); return status; diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart index e0291543b2c..e44b0bccd9d 100644 --- a/pkg/analysis_server/lib/src/services/correction/util.dart +++ b/pkg/analysis_server/lib/src/services/correction/util.dart @@ -387,7 +387,7 @@ class ReturnTypeComputer extends RecursiveAstVisitor { DartType? returnType; - ReturnTypeComputer(this._typeSystem, {this._isGenerator = false}); + new(this._typeSystem, {this._isGenerator = false}); @override void visitBlockFunctionBody(BlockFunctionBody node) {} @@ -433,7 +433,7 @@ class _DeclarationCollector extends RecursiveAstVisitor { final String name; bool isDeclared = false; - _DeclarationCollector(this.name); + new(this.name); @override void visitVariableDeclaration(VariableDeclaration node) { @@ -447,7 +447,7 @@ class _ElementReferenceCollector extends RecursiveAstVisitor { final Element element; final List references = []; - _ElementReferenceCollector(this.element); + new(this.element); @override void visitImportPrefixReference(ImportPrefixReference node) { diff --git a/pkg/analysis_server/lib/src/services/dart_tooling_daemon/dtd_services.dart b/pkg/analysis_server/lib/src/services/dart_tooling_daemon/dtd_services.dart index adc535d778f..4f6182a6595 100644 --- a/pkg/analysis_server/lib/src/services/dart_tooling_daemon/dtd_services.dart +++ b/pkg/analysis_server/lib/src/services/dart_tooling_daemon/dtd_services.dart @@ -54,11 +54,7 @@ class DtdServices { /// Whether to register experimental LSP handlers over DTD. final bool registerExperimentalHandlers; - DtdServices._( - this._server, - this.dtdUri, { - this.registerExperimentalHandlers = false, - }); + new _(this._server, this.dtdUri, {this.registerExperimentalHandlers = false}); DtdConnectionState get state => _state; diff --git a/pkg/analysis_server/lib/src/services/execution/execution_context.dart b/pkg/analysis_server/lib/src/services/execution/execution_context.dart index b3b9dd3c5de..4b88e0c860c 100644 --- a/pkg/analysis_server/lib/src/services/execution/execution_context.dart +++ b/pkg/analysis_server/lib/src/services/execution/execution_context.dart @@ -10,5 +10,5 @@ class ExecutionContext { final Map contextMap = {}; /// Initialize a newly created execution context. - ExecutionContext(); + new(); } diff --git a/pkg/analysis_server/lib/src/services/flutter/class_description.dart b/pkg/analysis_server/lib/src/services/flutter/class_description.dart index 827e90b08d2..194b66bb28b 100644 --- a/pkg/analysis_server/lib/src/services/flutter/class_description.dart +++ b/pkg/analysis_server/lib/src/services/flutter/class_description.dart @@ -21,7 +21,7 @@ class ClassDescription { final ClassElement element; final ConstructorElement constructor; - ClassDescription(this.element, this.constructor); + new(this.element, this.constructor); } /// The lazy-fill registry of [ClassDescription]. diff --git a/pkg/analysis_server/lib/src/services/flutter/property.dart b/pkg/analysis_server/lib/src/services/flutter/property.dart index 5fdcba22124..b5e76175d2d 100644 --- a/pkg/analysis_server/lib/src/services/flutter/property.dart +++ b/pkg/analysis_server/lib/src/services/flutter/property.dart @@ -75,7 +75,7 @@ class PropertyDescription { /// Otherwise `null`. _EdgeInsetsProperty? _edgeInsetsProperty; - PropertyDescription({ + new({ this.parent, required this.resolvedUnit, this.classDescription, @@ -402,7 +402,7 @@ class VirtualContainerProperty { /// the new `Container` creation during its materialization. NamedArgument? _parentArgumentToMove; - VirtualContainerProperty(this.containerElement, this.widgetCreation); + new(this.containerElement, this.widgetCreation); void setParentCreation( InstanceCreationExpression parentCreation, @@ -435,7 +435,7 @@ class _EdgeInsetsProperty { PropertyDescription? rightProperty; PropertyDescription? bottomProperty; - _EdgeInsetsProperty(this.classEdgeInsets, this.property); + new(this.classEdgeInsets, this.property); void addNested() { Expression? leftExpression; diff --git a/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart b/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart index 9737e3c10a7..58f1ffa3e22 100644 --- a/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart +++ b/pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart @@ -22,7 +22,7 @@ class SetPropertyValueResult { /// The change to apply, or `null` if [errorCode] is not `null`. final protocol.SourceChange? change; - SetPropertyValueResult._({this.errorCode, this.change}); + new _({this.errorCode, this.change}); } class WidgetDescriptions { @@ -117,7 +117,7 @@ class WidgetDescriptions { class _WidgetDescription { final List properties; - _WidgetDescription(this.properties); + new(this.properties); } class _WidgetDescriptionComputer { @@ -138,11 +138,7 @@ class _WidgetDescriptionComputer { ClassElement? _classContainer; ClassElement? _classEdgeInsets; - _WidgetDescriptionComputer( - this.classRegistry, - this.resolvedUnit, - this.widgetOffset, - ); + new(this.classRegistry, this.resolvedUnit, this.widgetOffset); Future<_WidgetDescription?> compute() async { var node = resolvedUnit.unit.nodeCovering(offset: widgetOffset); diff --git a/pkg/analysis_server/lib/src/services/flutter/widget_previews.dart b/pkg/analysis_server/lib/src/services/flutter/widget_previews.dart index 25c2c040be0..d4018746697 100644 --- a/pkg/analysis_server/lib/src/services/flutter/widget_previews.dart +++ b/pkg/analysis_server/lib/src/services/flutter/widget_previews.dart @@ -137,11 +137,9 @@ final class LibraryPreviewNode { /// The set of errors found in this library. final errors = []; - LibraryPreviewNode({ - required LibraryElement library, - required this.namespaceAllocator, - }) : uri = library.uri, - path = library.firstFragment.source.fullName; + new({required LibraryElement library, required this.namespaceAllocator}) + : uri = library.uri, + path = library.firstFragment.source.fullName; /// `true` if this library contains compile time errors. bool get hasErrors => errors.isNotEmpty; @@ -250,7 +248,7 @@ class _PreviewVisitor extends RecursiveAstVisitor { final Uri _scriptUri; final Uri _libraryUri; - _PreviewVisitor({ + new({ required ResolvedUnitResult unit, required this.previewNode, required this.namespaceAllocator, diff --git a/pkg/analysis_server/lib/src/services/interactive_forms/interactive_forms.dart b/pkg/analysis_server/lib/src/services/interactive_forms/interactive_forms.dart index cb05d543645..fb01e4f6fa1 100644 --- a/pkg/analysis_server/lib/src/services/interactive_forms/interactive_forms.dart +++ b/pkg/analysis_server/lib/src/services/interactive_forms/interactive_forms.dart @@ -49,7 +49,7 @@ class InteractiveForm { /// always contains the same number of items as [outstandingFields]. final List outstandingFieldAnswers = []; - InteractiveForm({ + new({ required this.supportedInteractiveFormInputTypes, required this._masterFields, required this.existingAnswers, @@ -201,7 +201,7 @@ class ValidatedResponse { /// does not need to be re-prompted for this field. final bool isValid; - ValidatedResponse(this.field, this.value, {required this.isValid}); + new(this.field, this.value, {required this.isValid}); } extension FormFieldExtension on FormField { diff --git a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart index f725c75bc0d..59be6fa2bc2 100644 --- a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart +++ b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart @@ -114,7 +114,7 @@ class CiderKytheHelper { final String corpus; final ResourceProvider resourceProvider; - CiderKytheHelper(this.resourceProvider, this.corpus, this.sdkRootPath); + new(this.resourceProvider, this.corpus, this.sdkRootPath); /// Returns a URI that can be used to query Kythe. String toKytheUri(Element e) { @@ -149,7 +149,7 @@ class _KytheVName { final String path; final String signature; - _KytheVName({required this.path, required this.signature}); + new({required this.path, required this.signature}); } /// An objects that builds up a string signature for an element. diff --git a/pkg/analysis_server/lib/src/services/pub/pub_api.dart b/pkg/analysis_server/lib/src/services/pub/pub_api.dart index d1e35ecc5a3..adb2a6eb3dc 100644 --- a/pkg/analysis_server/lib/src/services/pub/pub_api.dart +++ b/pkg/analysis_server/lib/src/services/pub/pub_api.dart @@ -49,7 +49,7 @@ class PubApi { ' (+https://github.com/dart-lang/sdk)', }; - PubApi( + new( this.instrumentationService, http.Client? httpClient, String? envPubHostedUrl, @@ -168,7 +168,7 @@ class PubApi { class PubApiPackage { final String packageName; - PubApiPackage(this.packageName); + new(this.packageName); } class PubApiPackageDetails { @@ -176,7 +176,7 @@ class PubApiPackageDetails { final String? description; final String? latestVersion; - PubApiPackageDetails(this.packageName, this.description, this.latestVersion); + new(this.packageName, this.description, this.latestVersion); } /// A wrapper over a package:http Client that does not pass on calls to [close]. @@ -186,7 +186,7 @@ class PubApiPackageDetails { class _NoCloseHttpClient extends http.BaseClient { final http.Client client; - _NoCloseHttpClient(this.client); + new(this.client); @override Future send(http.BaseRequest request) => diff --git a/pkg/analysis_server/lib/src/services/pub/pub_command.dart b/pkg/analysis_server/lib/src/services/pub/pub_command.dart index cc0873a4a3b..471015c4151 100644 --- a/pkg/analysis_server/lib/src/services/pub/pub_command.dart +++ b/pkg/analysis_server/lib/src/services/pub/pub_command.dart @@ -43,11 +43,7 @@ class PubCommand { /// tools (such as the IDE). var _lastQueuedCommand = Future.value(); - PubCommand( - this._instrumentationService, - this._pathContext, - this._processRunner, - ) { + new(this._instrumentationService, this._pathContext, this._processRunner) { // When calling the `pub` command, we must add an identifier to the // PUB_ENVIRONMENT environment variable (joined with colons). const pubEnvString = 'analysis_server.pub_api'; @@ -178,7 +174,7 @@ class PubOutdatedPackageDetails { final String? resolvableVersion; final String? upgradableVersion; - PubOutdatedPackageDetails( + new( this.packageName, { required this.currentVersion, required this.latestVersion, diff --git a/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart b/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart index dcee8596917..ad4d51af99c 100644 --- a/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart +++ b/pkg/analysis_server/lib/src/services/pub/pub_package_service.dart @@ -30,7 +30,7 @@ class PackageDetailsCache { final Map packages; DateTime lastUpdatedUtc; - PackageDetailsCache._(this.packages, DateTime lastUpdated) + new _(this.packages, DateTime lastUpdated) : lastUpdatedUtc = lastUpdated.toUtc(); Duration get cacheTimeRemaining { @@ -112,18 +112,17 @@ class PubPackage { String? description; String? latestVersion; - PubPackage.fromDetails(PubApiPackageDetails package) + new fromDetails(PubApiPackageDetails package) : packageName = package.packageName, description = package.description, latestVersion = package.latestVersion; - PubPackage.fromJson(Map json) + new fromJson(Map json) : packageName = json['packageName'] as String, description = json['description'] as String?, latestVersion = json['latestVersion'] as String?; - PubPackage.fromName(PubApiPackage package) - : packageName = package.packageName; + new fromName(PubApiPackage package) : packageName = package.packageName; Map toJson() { return { @@ -169,7 +168,7 @@ class PubPackageService { final _pubspecPackageVersions = >{}; - PubPackageService( + new( this._instrumentationService, this.resourceProvider, this._api, diff --git a/pkg/analysis_server/lib/src/services/refactoring/add_constructor_name.dart b/pkg/analysis_server/lib/src/services/refactoring/add_constructor_name.dart index bfec5d2a7cf..7f58600057f 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/add_constructor_name.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/add_constructor_name.dart @@ -18,7 +18,7 @@ class AddConstructorName extends RefactoringProducer { static const String constTitle = 'Add a name to the constructor'; - AddConstructorName(super.context); + new(super.context); @override bool get isExperimental => false; diff --git a/pkg/analysis_server/lib/src/services/refactoring/add_import_prefix.dart b/pkg/analysis_server/lib/src/services/refactoring/add_import_prefix.dart index 68d174ad470..f9204dc095b 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/add_import_prefix.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/add_import_prefix.dart @@ -24,7 +24,7 @@ class AddImportPrefix extends RefactoringProducer { final String _defaultPrefix = 'prefix'; - AddImportPrefix(super.context); + new(super.context); @override bool get isExperimental => false; diff --git a/pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart b/pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart index f072ea176d9..fca5b2cb0e7 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart @@ -62,7 +62,7 @@ sealed class Availability {} sealed class Available extends Availability { final AbstractRefactoringContext refactoringContext; - Available({required this.refactoringContext}); + new({required this.refactoringContext}); /// Whether there are any positional parameters and, if so, if all of them /// can be converted to named parameters. @@ -126,9 +126,7 @@ final class ChangeStatusFailureSuperFormalParameter extends ChangeStatusFailure { final ConstructorDeclaration constructorDeclaration; - ChangeStatusFailureSuperFormalParameter({ - required this.constructorDeclaration, - }); + new({required this.constructorDeclaration}); } /// The result that signals the success. @@ -136,7 +134,7 @@ final class ChangeStatusSuccess extends ChangeStatus {} /// The supertype for any failure inside [analyzeSelection]. sealed class ErrorSelectionState extends SelectionState { - const ErrorSelectionState(); + const new(); } /// The description of a formal parameter, returned by [analyzeSelection]. @@ -172,7 +170,7 @@ final class FormalParameterState { /// If `true`, the selection covers this formal parameter. final bool isSelected; - FormalParameterState({ + new({ required this.id, required this.element, required this.kind, @@ -198,11 +196,7 @@ class FormalParameterUpdate { /// Whether the formal parameter should be made `super`. final bool withSuper; - FormalParameterUpdate({ - required this.id, - required this.kind, - this.withSuper = false, - }); + new({required this.id, required this.kind, this.withSuper = false}); } /// The description of a method signature update. @@ -227,7 +221,7 @@ class MethodSignatureUpdate { /// Specifies whether to add the trailing comma after arguments. final ArgumentsTrailingComma argumentsTrailingComma; - MethodSignatureUpdate({ + new({ required this.formalParameters, this.removedNamedFormalParameters = const {}, required this.formalParametersTrailingComma, @@ -248,7 +242,7 @@ final class NotAvailableNoExecutableElement extends NotAvailable {} /// The supertype for all results of [analyzeSelection]. sealed class SelectionState { - const SelectionState(); + const new(); } /// The strategy for trailing comma after formal parameters. @@ -269,7 +263,7 @@ enum TrailingComma { /// 2. The kind of a formal parameter that we don't understand. /// 3. A formal parameter without the type annotation. final class UnexpectedSelectionState extends ErrorSelectionState { - const UnexpectedSelectionState(); + const new(); } /// The valid result of [analyzeSelection]. @@ -285,7 +279,7 @@ final class ValidSelectionState extends SelectionState { /// The current formal parameters. final List formalParameters; - ValidSelectionState({ + new({ required this.refactoringContext, required this.element, required this.formalParameters, @@ -295,7 +289,7 @@ final class ValidSelectionState extends SelectionState { class _AvailabilityAnalyzer { final AbstractRefactoringContext refactoringContext; - _AvailabilityAnalyzer({required this.refactoringContext}); + new({required this.refactoringContext}); Availability analyze() { var declaration = _declaration(); @@ -440,10 +434,7 @@ class _AvailabilityAnalyzer { final class _AvailableWithDeclaration extends Available { final _Declaration declaration; - _AvailableWithDeclaration({ - required super.refactoringContext, - required this.declaration, - }); + new({required super.refactoringContext, required this.declaration}); @override bool get hasSelectedFormalParametersToConvertToNamed { @@ -533,10 +524,7 @@ final class _AvailableWithDeclaration extends Available { final class _AvailableWithExecutableElement extends Available { final ExecutableElement element; - _AvailableWithExecutableElement({ - required super.refactoringContext, - required this.element, - }); + new({required super.refactoringContext, required this.element}); @override List get _formalParameters => @@ -549,11 +537,7 @@ class _Declaration { final AstNode node; final List selected; - _Declaration({ - required this.element, - required this.node, - required this.selected, - }); + new({required this.element, required this.node, required this.selected}); } /// Formal parameters of a declaration that match the selection. @@ -561,14 +545,14 @@ final class _DeclarationFormalParameters { final List positional; final Map named; - _DeclarationFormalParameters({required this.positional, required this.named}); + new({required this.positional, required this.named}); } /// The class that implements [analyzeSelection]. class _SelectionAnalyzer { final Available available; - _SelectionAnalyzer({required this.available}); + new({required this.available}); AbstractRefactoringContext get refactoringContext { return available.refactoringContext; @@ -662,10 +646,7 @@ class _SignatureUpdater { final ValidSelectionState selectionState; final MethodSignatureUpdate signatureUpdate; - _SignatureUpdater({ - required this.selectionState, - required this.signatureUpdate, - }); + new({required this.selectionState, required this.signatureUpdate}); AbstractRefactoringContext get refactoringContext { return selectionState.refactoringContext; diff --git a/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart b/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart index 59869904dec..c3bb883e703 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart @@ -16,7 +16,7 @@ class ConvertAllFormalParametersToNamed extends RefactoringProducer { static const String constTitle = 'Convert all formal parameters to named'; - ConvertAllFormalParametersToNamed(super.context); + new(super.context); @override bool get isExperimental => true; diff --git a/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart b/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart index 40f4ed5706f..f9386123220 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart @@ -19,7 +19,7 @@ class ConvertSelectedFormalParametersToNamed extends RefactoringProducer { static const String constTitle = 'Convert selected formal parameter(s) to named'; - ConvertSelectedFormalParametersToNamed(super.context); + new(super.context); @override bool get isExperimental => true; diff --git a/pkg/analysis_server/lib/src/services/refactoring/framework/formal_parameter.dart b/pkg/analysis_server/lib/src/services/refactoring/framework/formal_parameter.dart index 683f52f7bbb..254a84bb825 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/framework/formal_parameter.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/framework/formal_parameter.dart @@ -69,7 +69,7 @@ final class NamedFormalParameterReference extends FormalParameterReference { /// Initialize a newly created reference to refer to the named formal /// parameter with the given [name]. - NamedFormalParameterReference(this.name) : assert(name.isNotEmpty); + new(this.name) : assert(name.isNotEmpty); @override Expression? argumentFrom(ArgumentList argumentList) { @@ -93,7 +93,7 @@ final class PositionalFormalParameterReference /// Initialize a newly created reference to refer to the positional formal /// parameter with the given [index]. - PositionalFormalParameterReference(this.index) : assert(index >= 0); + new(this.index) : assert(index >= 0); @override Expression? argumentFrom(ArgumentList argumentList) { diff --git a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_context.dart b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_context.dart index 18e0e49eecd..c64c323543d 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_context.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_context.dart @@ -63,7 +63,7 @@ class AbstractRefactoringContext { late final ChangeWorkspace workspace = DartChangeWorkspace(startSessions); /// Initialize a newly created refactoring context. - AbstractRefactoringContext({ + new({ required this.searchEngine, required this.startSessions, required this.resolvedLibraryResult, @@ -100,7 +100,7 @@ class RefactoringContext extends AbstractRefactoringContext { final AnalysisServer server; /// Initialize a newly created refactoring context. - RefactoringContext({ + new({ required this.server, required super.startSessions, required super.resolvedLibraryResult, diff --git a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart index e02fdc176fc..9cf706c572a 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_processor.dart @@ -44,7 +44,7 @@ class RefactoringProcessor { final Stopwatch _timer = Stopwatch(); - RefactoringProcessor(this.context, {this._performance}); + new(this.context, {this._performance}); /// Return a list containing one code action for each of the refactorings that /// are available in the current context. diff --git a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart index bdfaa76c94d..ac49f37d6f0 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/framework/refactoring_producer.dart @@ -21,7 +21,7 @@ sealed class ComputeStatus {} class ComputeStatusFailure extends ComputeStatus { final String? reason; - ComputeStatusFailure({this.reason}); + new({this.reason}); } /// The result that signals the success. @@ -30,7 +30,7 @@ class ComputeStatusSuccess extends ComputeStatus {} /// A version of [RefactoringProducer] that has parameters, allowing the user /// to provide additional values (such as a name or target file) when executed. abstract class ParameterizedRefactoringProducer extends RefactoringProducer { - ParameterizedRefactoringProducer(super.refactoringContext); + new(super.refactoringContext); /// Return a list of the parameters to send to the client. List get parameters; @@ -42,7 +42,7 @@ abstract class RefactoringProducer { final RefactoringContext refactoringContext; /// Initialize a newly created refactoring producer. - RefactoringProducer(this.refactoringContext); + new(this.refactoringContext); /// The most deeply nested node whose range completely includes the range of /// characters described by [selectionOffset] and [selectionLength]. diff --git a/pkg/analysis_server/lib/src/services/refactoring/framework/write_invocation_arguments.dart b/pkg/analysis_server/lib/src/services/refactoring/framework/write_invocation_arguments.dart index b0c2522d4f7..be8af4b8c50 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/framework/write_invocation_arguments.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/framework/write_invocation_arguments.dart @@ -144,7 +144,7 @@ sealed class FormalParameterUpdateExisting extends FormalParameterUpdate { /// The original formal parameter reference. final FormalParameterReference reference; - FormalParameterUpdateExisting({required this.reference}); + new({required this.reference}); } /// Existing named formal parameter update. @@ -153,16 +153,13 @@ final class FormalParameterUpdateExistingNamed /// The new name, might be the same as the old one. final String name; - FormalParameterUpdateExistingNamed({ - required super.reference, - required this.name, - }); + new({required super.reference, required this.name}); } /// Existing positional formal parameter update. final class FormalParameterUpdateExistingPositional extends FormalParameterUpdateExisting { - FormalParameterUpdateExistingPositional({required super.reference}); + new({required super.reference}); } /// New formal parameter. @@ -170,24 +167,18 @@ sealed class FormalParameterUpdateNew extends FormalParameterUpdate { final String name; final String valueCode; - FormalParameterUpdateNew({required this.name, required this.valueCode}); + new({required this.name, required this.valueCode}); } /// New named formal parameter. final class FormalParameterUpdateNewNamed extends FormalParameterUpdateNew { - FormalParameterUpdateNewNamed({ - required super.name, - required super.valueCode, - }); + new({required super.name, required super.valueCode}); } /// New positional formal parameter. final class FormalParameterUpdateNewPositional extends FormalParameterUpdateNew { - FormalParameterUpdateNewPositional({ - required super.name, - required super.valueCode, - }); + new({required super.name, required super.valueCode}); } /// The supertype return types from [writeArguments]. @@ -211,40 +202,40 @@ final class _ArgumentAddName extends _Argument { final String name; final Argument argument; - _ArgumentAddName({required this.name, required this.argument}); + new({required this.name, required this.argument}); } /// The argument to write as is, positional or named. final class _ArgumentAsIs extends _Argument { final Argument argument; - _ArgumentAsIs({required this.argument}); + new({required this.argument}); } /// The new argument. sealed class _ArgumentNew extends _Argument { final String valueCode; - _ArgumentNew({required this.valueCode}); + new({required this.valueCode}); } /// The new named argument. final class _ArgumentNewNamed extends _ArgumentNew { final String name; - _ArgumentNewNamed({required super.valueCode, required this.name}); + new({required super.valueCode, required this.name}); } /// The new positional argument. final class _ArgumentNewPositional extends _ArgumentNew { - _ArgumentNewPositional({required super.valueCode}); + new({required super.valueCode}); } /// The argument to write without the name. final class _ArgumentRemoveName extends _Argument { final NamedArgument namedArgument; - _ArgumentRemoveName({required this.namedArgument}); + new({required this.namedArgument}); } extension on ArgumentList { diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_getter_to_method.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_getter_to_method.dart index ed37003d18a..8214f9a3e2b 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_getter_to_method.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_getter_to_method.dart @@ -27,11 +27,8 @@ class ConvertGetterToMethodRefactoringImpl extends RefactoringImpl final CorrectionUtils utils; final GetterElement element; - ConvertGetterToMethodRefactoringImpl( - this.workspace, - this.resolvedUnit, - this.element, - ) : searchEngine = workspace.searchEngine, + new(this.workspace, this.resolvedUnit, this.element) + : searchEngine = workspace.searchEngine, utils = CorrectionUtils(resolvedUnit); @override diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_method_to_getter.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_method_to_getter.dart index 74aa031c19c..95832c9ed62 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_method_to_getter.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/convert_method_to_getter.dart @@ -27,11 +27,8 @@ class ConvertMethodToGetterRefactoringImpl extends RefactoringImpl final CorrectionUtils utils; final ExecutableElement element; - ConvertMethodToGetterRefactoringImpl( - this.workspace, - this.resolvedUnit, - this.element, - ) : sessionHelper = AnalysisSessionHelper(resolvedUnit.session), + new(this.workspace, this.resolvedUnit, this.element) + : sessionHelper = AnalysisSessionHelper(resolvedUnit.session), searchEngine = workspace.searchEngine, utils = CorrectionUtils(resolvedUnit); diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart index 342b2ee6edb..b16447c9352 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart @@ -59,11 +59,8 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl final Map elementIds = {}; Set _excludedVariableNames = {}; - ExtractLocalRefactoringImpl( - this.resolveResult, - this.selectionOffset, - this.selectionLength, - ) : selectionRange = SourceRange(selectionOffset, selectionLength), + new(this.resolveResult, this.selectionOffset, this.selectionLength) + : selectionRange = SourceRange(selectionOffset, selectionLength), utils = CorrectionUtils(resolveResult); CodeStyleOptions get codeStyleOptions => resolveResult.session.analysisContext @@ -565,12 +562,7 @@ class _OccurrencesVisitor extends GeneralizingAstVisitor { final String? selectionSource; final FeatureSet featureSet; - _OccurrencesVisitor( - this.ref, - this.occurrences, - this.selectionSource, - this.featureSet, - ); + new(this.ref, this.occurrences, this.selectionSource, this.featureSet); @override void visitExpression(Expression node) { @@ -628,7 +620,7 @@ class _OccurrencesVisitor extends GeneralizingAstVisitor { class _TokenLocalElementVisitor extends RecursiveAstVisitor { final Map map; - _TokenLocalElementVisitor(this.map); + new(this.map); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart index b10c46606c8..1e60ab02a96 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart @@ -123,7 +123,7 @@ final class ExtractMethodRefactoringImpl extends RefactoringImpl final List<_Occurrence> _occurrences = []; bool _staticContext = false; - ExtractMethodRefactoringImpl( + new( this._searchEngine, this._resolveResult, this._selectionOffset, @@ -1009,7 +1009,7 @@ final class ExtractMethodRefactoringImpl extends RefactoringImpl /// [SelectionAnalyzer] for [ExtractMethodRefactoringImpl]. class _ExtractMethodAnalyzer extends StatementAnalyzer { - _ExtractMethodAnalyzer(super.resolveResult, super.selection); + new(super.resolveResult, super.selection); @override void handleNextSelectedNode(AstNode node) { @@ -1212,7 +1212,7 @@ class _GetSourcePatternVisitor extends GeneralizingAstVisitor { final _SourcePattern pattern; final List replaceEdits; - _GetSourcePatternVisitor(this.partRange, this.pattern, this.replaceEdits); + new(this.partRange, this.pattern, this.replaceEdits); @override void visitNamedArgument(NamedArgument node) { @@ -1307,11 +1307,7 @@ class _InitializeOccurrencesVisitor extends GeneralizingAstVisitor { bool forceStatic = false; - _InitializeOccurrencesVisitor( - this.ref, - this.selectionPattern, - this.patternToSelectionName, - ); + new(this.ref, this.selectionPattern, this.patternToSelectionName); @override void visitBlock(Block node) { @@ -1428,7 +1424,7 @@ class _InitializeParametersVisitor extends GeneralizingAstVisitor { final ExtractMethodRefactoringImpl ref; final List assignedUsedVariables; - _InitializeParametersVisitor(this.ref, this.assignedUsedVariables); + new(this.ref, this.assignedUsedVariables); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -1532,7 +1528,7 @@ class _IsUsedAfterSelectionVisitor extends GeneralizingAstVisitor { final Element element; bool result = false; - _IsUsedAfterSelectionVisitor(this.ref, this.element); + new(this.ref, this.element); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -1554,7 +1550,7 @@ class _Occurrence { final Map _parameterOldToOccurrenceName = {}; - _Occurrence(this.range, this.isSelection); + new(this.range, this.isSelection); } /// Generalized version of some source, in which references to the specific diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart index eead0f77195..2f8fd9a7802 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart @@ -72,12 +72,8 @@ class ExtractWidgetRefactoringImpl extends RefactoringImpl /// and [_method] parameters. final List<_Parameter> _parameters = []; - ExtractWidgetRefactoringImpl( - this.searchEngine, - this.resolveResult, - this.offset, - this.length, - ) : sessionHelper = AnalysisSessionHelper(resolveResult.session), + new(this.searchEngine, this.resolveResult, this.offset, this.length) + : sessionHelper = AnalysisSessionHelper(resolveResult.session), utils = CorrectionUtils(resolveResult); @override @@ -608,7 +604,7 @@ class _MethodInvocationsCollector extends RecursiveAstVisitor { final ExecutableElement methodElement; final List invocations = []; - _MethodInvocationsCollector(this.methodElement); + new(this.methodElement); @override void visitMethodInvocation(MethodInvocation node) { @@ -637,7 +633,7 @@ class _Parameter { /// constructor. If the [name] is already public, then the [name]. late String constructorName; - _Parameter( + new( this.name, this.type, { this.isMethodParameter = false, @@ -655,7 +651,7 @@ class _ParametersCollector extends RecursiveAstVisitor { List? enclosingClasses; - _ParametersCollector(this.enclosingClass, this.expressionRange); + new(this.enclosingClass, this.expressionRange); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_local.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_local.dart index 62922544168..6bc984fdb48 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_local.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_local.dart @@ -29,7 +29,7 @@ class InlineLocalRefactoringImpl extends RefactoringImpl _InitialState? _initialState; - InlineLocalRefactoringImpl(this.searchEngine, this.resolveResult, this.offset) + new(this.searchEngine, this.resolveResult, this.offset) : utils = CorrectionUtils(resolveResult); @override @@ -277,7 +277,7 @@ class _InitialState { final VariableDeclarationStatement declarationStatement; final List references; - _InitialState({ + new({ required this.element, required this.node, required this.initializer, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart index c3afc920179..dc701648a7c 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart @@ -357,7 +357,7 @@ class InlineMethodRefactoringImpl extends RefactoringImpl /// calls into the same block. final Map> _introducedVariablesByBlock = {}; - InlineMethodRefactoringImpl(this.searchEngine, this.unitResult, this.offset) + new(this.searchEngine, this.unitResult, this.offset) : sessionHelper = AnalysisSessionHelper(unitResult.session), utils = CorrectionUtils(unitResult); @@ -654,7 +654,7 @@ class _InlineMethodResult { final String source; final List<_VariableDeclaration> variableDeclarations; - _InlineMethodResult(this.source, this.variableDeclarations); + new(this.source, this.variableDeclarations); } class _ParameterOccurrence { @@ -663,7 +663,7 @@ class _ParameterOccurrence { final Precedence parentPrecedence; final bool inStringInterpolation; - _ParameterOccurrence({ + new({ required this.baseOffset, required this.identifier, required this.parentPrecedence, @@ -684,7 +684,7 @@ class _ReferenceProcessor { SourceRange? _refLineRange; late String _refPrefix; - _ReferenceProcessor(this.ref, this.reference); + new(this.ref, this.reference); Future init() async { refElement = reference.element; @@ -1105,7 +1105,7 @@ class _ReturnsValidatorVisitor extends RecursiveAstVisitor { final RefactoringStatus result; int _numReturns = 0; - _ReturnsValidatorVisitor(this.result); + new(this.result); @override void visitFunctionExpression(FunctionExpression node) { @@ -1153,7 +1153,7 @@ class _SourcePart { /// The offsets of the implicit class references in static member references. final Map> _implicitClassNameOffsets = {}; - _SourcePart(this._base, this._source, this._prefix); + new(this._base, this._source, this._prefix); void addExplicitThisOffset(int offset) { _explicitThisOffsets.add(offset - _base); @@ -1214,7 +1214,7 @@ class _VariableDeclaration { final String name; final String initializer; - _VariableDeclaration(this.name, this.initializer); + new(this.name, this.initializer); } /// A visitor that fills [_SourcePart] with fields, parameters and variables. @@ -1231,12 +1231,7 @@ class _VariablesVisitor extends GeneralizingAstVisitor { /// The body [Scope] of the method being inlined. final Scope? scope; - _VariablesVisitor( - this.methodElement, - this.bodyRange, - this.result, - this.scope, - ); + new(this.methodElement, this.bodyRange, this.result, this.scope); @override void visitNode(AstNode node) { diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/move_file.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/move_file.dart index 055e4d92c0b..4124286072b 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/move_file.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/move_file.dart @@ -40,14 +40,11 @@ class MoveFileRefactoringImpl extends RefactoringImpl /// A mapping of files or folders to be renamed. final Map _renameMapping; - MoveFileRefactoringImpl( - this.resourceProvider, - this.refactoringWorkspace, - String oldFile, - ) : pathContext = resourceProvider.pathContext, + new(this.resourceProvider, this.refactoringWorkspace, String oldFile) + : pathContext = resourceProvider.pathContext, _renameMapping = {oldFile: null}; - MoveFileRefactoringImpl.multi( + new multi( this.resourceProvider, this.refactoringWorkspace, this._renameMapping, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart index 8c491839d0f..ad8d0ee67bb 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart @@ -39,7 +39,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar abstract class ConvertGetterToMethodRefactoring implements Refactoring { /// Returns a new [ConvertMethodToGetterRefactoring] instance for converting /// [element] and all the corresponding hierarchy elements. - factory ConvertGetterToMethodRefactoring( + factory( RefactoringWorkspace workspace, ResolvedUnitResult resolvedUnit, GetterElement element, @@ -66,7 +66,7 @@ abstract class ConvertGetterToMethodRefactoring implements Refactoring { abstract class ConvertMethodToGetterRefactoring implements Refactoring { /// Returns a new [ConvertMethodToGetterRefactoring] instance for converting /// [element] and all the corresponding hierarchy elements. - factory ConvertMethodToGetterRefactoring( + factory( RefactoringWorkspace workspace, ResolvedUnitResult resolvedUnit, ExecutableElement element, @@ -92,7 +92,7 @@ abstract class ConvertMethodToGetterRefactoring implements Refactoring { /// [Refactoring] to extract an expression into a local variable declaration. abstract class ExtractLocalRefactoring implements Refactoring { /// Returns a new [ExtractLocalRefactoring] instance. - factory ExtractLocalRefactoring( + factory( ResolvedUnitResult resolveResult, int selectionOffset, int selectionLength, @@ -153,7 +153,7 @@ abstract class ExtractLocalRefactoring implements Refactoring { /// [Refactoring] to extract an [Expression] or [Statement]s into a new method. abstract class ExtractMethodRefactoring implements Refactoring { /// Returns a new [ExtractMethodRefactoring] instance. - factory ExtractMethodRefactoring( + factory( SearchEngine searchEngine, ResolvedUnitResult resolveResult, int selectionOffset, @@ -233,7 +233,7 @@ abstract class ExtractMethodRefactoring implements Refactoring { /// a widget, into a new stateless or stateful widget. abstract class ExtractWidgetRefactoring implements Refactoring { /// Returns a new [ExtractWidgetRefactoring] instance. - factory ExtractWidgetRefactoring( + factory( SearchEngine searchEngine, ResolvedUnitResult resolveResult, int offset, @@ -273,7 +273,7 @@ abstract class ExtractWidgetRefactoring implements Refactoring { /// [Refactoring] to inline a local variable. abstract class InlineLocalRefactoring implements Refactoring { /// Returns a new [InlineLocalRefactoring] instance. - factory InlineLocalRefactoring( + factory( SearchEngine searchEngine, ResolvedUnitResult resolveResult, int offset, @@ -301,7 +301,7 @@ abstract class InlineLocalRefactoring implements Refactoring { /// [Refactoring] to inline an executable element. abstract class InlineMethodRefactoring implements Refactoring { /// Returns a new [InlineMethodRefactoring] instance. - factory InlineMethodRefactoring( + factory( SearchEngine searchEngine, ResolvedUnitResult resolveResult, int offset, @@ -342,7 +342,7 @@ abstract class InlineMethodRefactoring implements Refactoring { /// [Refactoring] to move/rename a file or folder. abstract class MoveFileRefactoring implements Refactoring { /// Returns a new [MoveFileRefactoring] instance. - factory MoveFileRefactoring( + factory( ResourceProvider resourceProvider, RefactoringWorkspace workspace, String oldFilePath, @@ -408,7 +408,7 @@ class RefactoringWorkspace { final Iterable drivers; final SearchEngine searchEngine; - RefactoringWorkspace(this.drivers, this.searchEngine); + new(this.drivers, this.searchEngine); /// Whether the [element] is defined in a file that is in a context root. bool containsElement(Element element) { @@ -686,5 +686,5 @@ class RenameRefactoringElement { final int offset; final int length; - RenameRefactoringElement(this.element, this.offset, this.length); + new(this.element, this.offset, this.length); } diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_internal.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_internal.dart index 6bca8223ee3..27695fd10fc 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_internal.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_internal.dart @@ -64,7 +64,7 @@ abstract class RefactoringImpl implements Refactoring { class SourceReference { final SearchMatch _match; - SourceReference(this._match); + new(this._match); Element get element => _match.element; diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_manager.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_manager.dart index 9eb6cca2a27..d87627acf0e 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_manager.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_manager.dart @@ -60,7 +60,7 @@ class RefactoringManager { Request? request; EditGetRefactoringResult? result; - RefactoringManager(this.server, this.refactoringWorkspace) + new(this.server, this.refactoringWorkspace) : searchEngine = refactoringWorkspace.searchEngine { _reset(); } diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename.dart index cd1b5966a8c..89408ac97c8 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename.dart @@ -28,12 +28,7 @@ class RenameProcessor { final SourceChange change; final String newName; - RenameProcessor( - this.workspace, - this.sessionHelper, - this.change, - this.newName, - ); + new(this.workspace, this.sessionHelper, this.change, this.newName); /// Add the edit that updates the [element] declaration. void addDeclarationEdit(Element? element) { @@ -136,12 +131,7 @@ class RenameProcessor2 { final ChangeBuilder builder; final String newName; - RenameProcessor2( - this.workspace, - this.sessionHelper, - this.builder, - this.newName, - ); + new(this.workspace, this.sessionHelper, this.builder, this.newName); /// Add the edit that updates the [element] declaration. Future addDeclarationEdit(Element? element) async { @@ -265,7 +255,7 @@ abstract class RenameRefactoringImpl extends RefactoringImpl late String newName; - RenameRefactoringImpl(this.workspace, this.sessionHelper, Element element) + new(this.workspace, this.sessionHelper, Element element) : searchEngine = workspace.searchEngine, _element = element, elementKindName = element.kind.displayName, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart index f42c0ccbb3d..f6bc8213b70 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart @@ -46,7 +46,7 @@ class RenameClassMemberRefactoringImpl extends RenameRefactoringImpl { late _RenameClassMemberValidator _validator; - RenameClassMemberRefactoringImpl( + new( RefactoringWorkspace workspace, AnalysisSessionHelper sessionHelper, this.interfaceElement, @@ -226,7 +226,7 @@ class _BaseClassMemberValidator { final RefactoringStatus result = RefactoringStatus(); - _BaseClassMemberValidator( + new( this.searchEngine, this.sessionHelper, this.interfaceElement, @@ -296,7 +296,7 @@ class _BaseClassMemberValidator { /// Helper to check if the created element will cause any conflicts. class _CreateClassMemberValidator extends _BaseClassMemberValidator { - _CreateClassMemberValidator( + new( SearchEngine searchEngine, AnalysisSessionHelper sessionHelper, InterfaceElement interfaceElement, @@ -337,7 +337,7 @@ class _LocalElementsCollector extends GeneralizingAstVisitor { final String name; final List elements = []; - _LocalElementsCollector(this.name); + new(this.name); @override void visitFormalParameter(FormalParameter node) { @@ -404,7 +404,7 @@ class _MatchShadowedBy { final SearchMatch match; final Element element; - _MatchShadowedBy(this.match, this.element); + new(this.match, this.element); } /// Helper to check if the renamed [element] will cause any conflicts. @@ -415,7 +415,7 @@ class _RenameClassMemberValidator extends _BaseClassMemberValidator { List references = []; List unshadowed = []; - _RenameClassMemberValidator( + new( SearchEngine searchEngine, AnalysisSessionHelper sessionHelper, InterfaceElement elementInterface, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart index 8cbc92babac..50dc397b6b2 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart @@ -27,7 +27,7 @@ class RenameConstructorRefactoringImpl extends RenameRefactoringImpl { final ResolvedUnitResult resolvedUnit; final CorrectionUtils utils; - RenameConstructorRefactoringImpl( + new( super.workspace, super.sessionHelper, this.resolvedUnit, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart index 50e4bff1dc6..8cdb566c6de 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart @@ -32,7 +32,7 @@ class RenameExtensionMemberRefactoringImpl extends RenameRefactoringImpl { late _ExtensionMemberValidator _validator; - RenameExtensionMemberRefactoringImpl( + new( super.workspace, super.sessionHelper, this.resolvedUnit, @@ -135,7 +135,7 @@ class _ExtensionMemberValidator { final RefactoringStatus result = RefactoringStatus(); final List references = []; - _ExtensionMemberValidator.forRename( + new forRename( this.searchEngine, this.sessionHelper, this.elementExtension, @@ -240,7 +240,7 @@ class _LocalElementsCollector extends GeneralizingAstVisitor { final String name; final List elements = []; - _LocalElementsCollector(this.name); + new(this.name); @override void visitFormalParameter(FormalParameter node) { @@ -283,5 +283,5 @@ class _MatchShadowedByLocal { final SearchMatch match; final LocalElement localElement; - _MatchShadowedByLocal(this.match, this.localElement); + new(this.match, this.localElement); } diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart index d92649dd72c..40a11e506a2 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart @@ -25,7 +25,7 @@ class RenameImportRefactoringImpl extends RenameRefactoringImpl { final MockLibraryImportElement importElement; - factory RenameImportRefactoringImpl( + factory( RefactoringWorkspace workspace, AnalysisSessionHelper sessionHelper, ResolvedUnitResult resolvedUnit, @@ -42,7 +42,7 @@ class RenameImportRefactoringImpl extends RenameRefactoringImpl { ); } - RenameImportRefactoringImpl._( + new _( super.workspace, super.sessionHelper, super.element, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_label.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_label.dart index 98e86cf3382..e46e786988f 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_label.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_label.dart @@ -18,7 +18,7 @@ class RenameLabelRefactoringImpl extends RenameRefactoringImpl { final CorrectionUtils utils; - RenameLabelRefactoringImpl( + new( super.workspace, super.sessionHelper, this.resolvedUnit, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_library.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_library.dart index b649061d305..c1053998748 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_library.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_library.dart @@ -18,7 +18,7 @@ class RenameLibraryRefactoringImpl extends RenameRefactoringImpl { final CorrectionUtils utils; - RenameLibraryRefactoringImpl( + new( super.workspace, super.sessionHelper, this.resolvedUnit, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart index a0d79368b90..0858111fa43 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart @@ -29,12 +29,7 @@ class ConflictValidatorVisitor extends RecursiveAstVisitor { final Map visibleRangeMap; final Set conflictingLocals = {}; - ConflictValidatorVisitor( - this.result, - this.newName, - this.target, - this.visibleRangeMap, - ); + new(this.result, this.newName, this.target, this.visibleRangeMap); @override void visitFunctionDeclaration(FunctionDeclaration node) { @@ -124,7 +119,7 @@ class RenameLocalRefactoringImpl extends RenameRefactoringImpl { final CorrectionUtils utils; - RenameLocalRefactoringImpl( + new( super.workspace, super.sessionHelper, this.resolvedUnit, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_parameter.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_parameter.dart index 86129b37244..5b7b2f01a9e 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_parameter.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_parameter.dart @@ -25,7 +25,7 @@ class RenameParameterRefactoringImpl extends RenameRefactoringImpl { List elements = []; bool _renameAllPositionalOccurrences = false; - RenameParameterRefactoringImpl( + new( super.workspace, super.sessionHelper, this.resolvedUnit, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_type_parameter.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_type_parameter.dart index 2a85d7563b5..32e199c9e6b 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_type_parameter.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_type_parameter.dart @@ -16,7 +16,7 @@ class RenameTypeParameterRefactoringImpl extends RenameRefactoringImpl { final CorrectionUtils utils; - RenameTypeParameterRefactoringImpl( + new( super.workspace, super.sessionHelper, this.resolvedUnit, diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_unit_member.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_unit_member.dart index 498d24a91c3..6ee058da91f 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_unit_member.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_unit_member.dart @@ -57,12 +57,8 @@ class RenameUnitMemberRefactoringImpl extends RenameRefactoringImpl { /// If [_flutterWidgetState] is set, this is the new name of it. String? _flutterWidgetStateNewName; - RenameUnitMemberRefactoringImpl( - super.workspace, - super.sessionHelper, - this.resolvedUnit, - super.element, - ) : utils = CorrectionUtils(resolvedUnit), + new(super.workspace, super.sessionHelper, this.resolvedUnit, super.element) + : utils = CorrectionUtils(resolvedUnit), super(); @override @@ -213,12 +209,7 @@ class _BaseUnitMemberValidator { final RefactoringStatus result = RefactoringStatus(); - _BaseUnitMemberValidator( - this.searchEngine, - this.library, - this.elementKind, - this.name, - ); + new(this.searchEngine, this.library, this.elementKind, this.name); /// Returns `true` if [element] is visible at the given [SearchMatch]. bool _isVisibleAt(Element element, SearchMatch at) { @@ -299,12 +290,7 @@ class _BaseUnitMemberValidator { /// Helper to check if the created element will cause any conflicts. class _CreateUnitMemberValidator extends _BaseUnitMemberValidator { - _CreateUnitMemberValidator( - super.searchEngine, - super.library, - super.elementKind, - super.name, - ); + new(super.searchEngine, super.library, super.elementKind, super.name); Future validate() async { _validateWillConflict(); @@ -318,11 +304,8 @@ class _RenameUnitMemberValidator extends _BaseUnitMemberValidator { final Element element; List references = []; - _RenameUnitMemberValidator( - SearchEngine searchEngine, - this.element, - String name, - ) : super(searchEngine, element.library!, element.kind, name); + new(SearchEngine searchEngine, this.element, String name) + : super(searchEngine, element.library!, element.kind, name); Future validate() async { _validateWillConflict(); diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart b/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart index ea7268c7325..f1ec8944de9 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart @@ -17,7 +17,7 @@ class MoveSelectedFormalParametersLeft extends RefactoringProducer { static const String constTitle = 'Move selected formal parameter(s) left'; - MoveSelectedFormalParametersLeft(super.context); + new(super.context); @override bool get isExperimental => true; diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart b/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart index aa5986f499e..517b16ae37f 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart @@ -35,7 +35,7 @@ class MoveTopLevelToFile extends ParameterizedRefactoringProducer { /// Initialize a newly created refactoring producer to use the given /// [context]. - MoveTopLevelToFile(super.context); + new(super.context); @override bool get isExperimental => false; @@ -411,7 +411,7 @@ class _Member { /// Initialize a newly created instance representing the [member] with the /// given [name]. - _Member(this.member, this.name); + new(this.member, this.name); } /// Information about a contiguous group of members to be moved. @@ -421,7 +421,7 @@ class _MemberGroup { /// Initialize a newly created instance representing a group of contiguous /// [members]. - _MemberGroup(this.members); + new(this.members); /// Return the member representing the [declaration]. _Member? memberFor(CompilationUnitMember declaration) { @@ -476,7 +476,7 @@ class _MembersToMove { final List<_MemberGroup> groups; /// Initialize a newly created instance representing [groups]. - _MembersToMove(this.containingFile, this.groups); + new(this.containingFile, this.groups); /// Return the name that should be used for the file to which the members will /// be moved. @@ -536,7 +536,7 @@ class _SealedSubclassIndex { /// may be incomplete. bool hasInvalidCandidateSet = false; - _SealedSubclassIndex(this.unit, {required this.candidateElements}) { + new(this.unit, {required this.candidateElements}) { var isCandidate = candidateElements.contains; // Index the declaration against each of its direct superclasses. diff --git a/pkg/analysis_server/lib/src/services/refactoring/remove_constructor_name.dart b/pkg/analysis_server/lib/src/services/refactoring/remove_constructor_name.dart index 115368e0af6..0913850f1e3 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/remove_constructor_name.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/remove_constructor_name.dart @@ -18,7 +18,7 @@ class RemoveConstructorName extends RefactoringProducer { static const String constTitle = 'Remove the name from the constructor'; - RemoveConstructorName(super.context); + new(super.context); @override bool get isExperimental => false; diff --git a/pkg/analysis_server/lib/src/services/refactoring/remove_import_prefix.dart b/pkg/analysis_server/lib/src/services/refactoring/remove_import_prefix.dart index 3ab1a4c42b1..4e59c93f87c 100644 --- a/pkg/analysis_server/lib/src/services/refactoring/remove_import_prefix.dart +++ b/pkg/analysis_server/lib/src/services/refactoring/remove_import_prefix.dart @@ -19,7 +19,7 @@ class RemoveImportPrefix extends RefactoringProducer { static const String constTitle = 'Remove the prefix from the import'; - RemoveImportPrefix(super.context); + new(super.context); @override bool get isExperimental => false; diff --git a/pkg/analysis_server/lib/src/services/search/element_visitors.dart b/pkg/analysis_server/lib/src/services/search/element_visitors.dart index d47800ed5dd..b8cd2b1bce0 100644 --- a/pkg/analysis_server/lib/src/services/search/element_visitors.dart +++ b/pkg/analysis_server/lib/src/services/search/element_visitors.dart @@ -25,7 +25,7 @@ typedef BoolElementProcessor = bool Function(Element element); class _ElementVisitorAdapter extends GeneralizingElementVisitor2 { final BoolElementProcessor processor; - _ElementVisitorAdapter(this.processor); + new(this.processor); @override void visitElement(Element element) { @@ -40,7 +40,7 @@ class _ElementVisitorAdapter extends GeneralizingElementVisitor2 { class _FragmentByNameOffsetVisitor { final int nameOffset; - _FragmentByNameOffsetVisitor(this.nameOffset); + new(this.nameOffset); Fragment? search(LibraryFragment fragment) => _searchIn(fragment); diff --git a/pkg/analysis_server/lib/src/services/search/search_engine.dart b/pkg/analysis_server/lib/src/services/search/search_engine.dart index d665133aeb7..b8a059583db 100644 --- a/pkg/analysis_server/lib/src/services/search/search_engine.dart +++ b/pkg/analysis_server/lib/src/services/search/search_engine.dart @@ -67,7 +67,7 @@ enum MatchKind { final bool isReference; - const MatchKind({this.isReference = false}); + new({this.isReference = false}); @override String toString() => name; diff --git a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart index 862430a1f7a..710a81a33a3 100644 --- a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart +++ b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart @@ -18,7 +18,7 @@ import 'package:analyzer/src/util/performance/operation_performance.dart'; class SearchEngineImpl implements SearchEngine { final Iterable _drivers; - SearchEngineImpl(this._drivers); + new(this._drivers); @override Future appendAllSubtypes( @@ -236,7 +236,7 @@ class SearchMatchImpl implements SearchMatch { @override final SourceRange sourceRange; - SearchMatchImpl( + new( this.file, this.librarySource, this.unitSource, diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart b/pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart index 5e3ac2209a6..3cfcc2bcc51 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart @@ -11,7 +11,7 @@ class ClassDeclaration extends DartSnippetProducer { static const prefix = 'class'; static const label = 'class'; - ClassDeclaration(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/do_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/do_statement.dart index 8afb56289f3..7ca184ca8b8 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/do_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/do_statement.dart @@ -11,7 +11,7 @@ class DoStatement extends DartSnippetProducer { static const prefix = 'do'; static const label = 'do while'; - DoStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart index 131c55cf813..d6dedf76ae2 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart @@ -21,7 +21,7 @@ class FlutterStatefulWidget extends FlutterSnippetProducer @override late ClassElement? classKey; - FlutterStatefulWidget(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart index be94aec3c75..947448f1d93 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart @@ -25,10 +25,7 @@ class FlutterStatefulWidgetWithAnimationController late ClassElement? classAnimationController; late MixinElement? classSingleTickerProviderStateMixin; - FlutterStatefulWidgetWithAnimationController( - super.request, { - required super.elementImportCache, - }); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateless_widget.dart b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateless_widget.dart index 367d55a8750..b8cf441d605 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateless_widget.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateless_widget.dart @@ -21,7 +21,7 @@ class FlutterStatelessWidget extends FlutterSnippetProducer @override late ClassElement? classKey; - FlutterStatelessWidget(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart index 4203051ef3a..f164ad25880 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart @@ -11,7 +11,7 @@ class ForInStatement extends DartSnippetProducer { static const prefix = 'forin'; static const label = 'for in'; - ForInStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart index 330bb4c872c..02d4bf3353d 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart @@ -11,7 +11,7 @@ class ForStatement extends DartSnippetProducer { static const prefix = 'for'; static const label = 'for'; - ForStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/function_declaration.dart b/pkg/analysis_server/lib/src/services/snippets/dart/function_declaration.dart index 27e75a25166..8ab2171020b 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/function_declaration.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/function_declaration.dart @@ -11,7 +11,7 @@ class FunctionDeclaration extends DartSnippetProducer { static const prefix = 'fun'; static const label = 'fun'; - FunctionDeclaration(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/if_else_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/if_else_statement.dart index 6162dbff2a4..30bdb9d3acc 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/if_else_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/if_else_statement.dart @@ -11,7 +11,7 @@ class IfElseStatement extends DartSnippetProducer { static const prefix = 'ife'; static const label = 'ife'; - IfElseStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart index f466dbd6a51..f8d3972961f 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart @@ -11,7 +11,7 @@ class IfStatement extends DartSnippetProducer { static const prefix = 'if'; static const label = 'if'; - IfStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/main_function.dart b/pkg/analysis_server/lib/src/services/snippets/dart/main_function.dart index 4d860a23bca..cf7311c0da0 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/main_function.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/main_function.dart @@ -15,7 +15,7 @@ class MainFunction extends DartSnippetProducer { static const prefix = 'main'; static const label = 'main()'; - MainFunction(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/switch_expression.dart b/pkg/analysis_server/lib/src/services/snippets/dart/switch_expression.dart index f4217843565..fbab5c64ff9 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/switch_expression.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/switch_expression.dart @@ -11,7 +11,7 @@ class SwitchExpression extends DartSnippetProducer { static const prefix = 'switch'; static const label = 'switch expression'; - SwitchExpression(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/switch_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/switch_statement.dart index 0d3f783d034..70de1ea4e13 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/switch_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/switch_statement.dart @@ -11,7 +11,7 @@ class SwitchStatement extends DartSnippetProducer { static const prefix = 'switch'; static const label = 'switch statement'; - SwitchStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/test_definition.dart b/pkg/analysis_server/lib/src/services/snippets/dart/test_definition.dart index 9d35d9dc65e..28bdab424a4 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/test_definition.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/test_definition.dart @@ -14,7 +14,7 @@ class TestDefinition extends DartSnippetProducer with TestSnippetMixin { static const prefix = 'test'; static const label = 'test'; - TestDefinition(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/test_group_definition.dart b/pkg/analysis_server/lib/src/services/snippets/dart/test_group_definition.dart index ff84d9b3af7..23e431a55c3 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/test_group_definition.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/test_group_definition.dart @@ -12,7 +12,7 @@ class TestGroupDefinition extends DartSnippetProducer with TestSnippetMixin { static const prefix = 'group'; static const label = 'group'; - TestGroupDefinition(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/try_catch_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/try_catch_statement.dart index 21cd216972f..e49e1e7ba11 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/try_catch_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/try_catch_statement.dart @@ -11,7 +11,7 @@ class TryCatchStatement extends DartSnippetProducer { static const prefix = 'try'; static const label = 'try'; - TryCatchStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart b/pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart index 5cb4963b8a1..5f99af3eb9d 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart @@ -11,7 +11,7 @@ class WhileStatement extends DartSnippetProducer { static const prefix = 'while'; static const label = 'while'; - WhileStatement(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); @override String get snippetPrefix => prefix; diff --git a/pkg/analysis_server/lib/src/services/snippets/dart_snippet_request.dart b/pkg/analysis_server/lib/src/services/snippets/dart_snippet_request.dart index b35b3a6718d..07a1a613ad4 100644 --- a/pkg/analysis_server/lib/src/services/snippets/dart_snippet_request.dart +++ b/pkg/analysis_server/lib/src/services/snippets/dart_snippet_request.dart @@ -51,7 +51,7 @@ class DartSnippetRequest { /// replaced if the snippet is selected. late final SourceRange replacementRange; - DartSnippetRequest({required ResolvedUnitResult unit, required this.offset}) + new({required ResolvedUnitResult unit, required this.offset}) : analysisSession = unit.session, typeProvider = unit.typeProvider, file = unit.file, @@ -71,7 +71,7 @@ class DartSnippetRequest { ); } - DartSnippetRequest.fromCompletionResult({ + new fromCompletionResult({ required ResolvedForCompletionResultImpl unit, required this.offset, required this.file, diff --git a/pkg/analysis_server/lib/src/services/snippets/snippet.dart b/pkg/analysis_server/lib/src/services/snippets/snippet.dart index e6ed9bb7770..36be5b24db5 100644 --- a/pkg/analysis_server/lib/src/services/snippets/snippet.dart +++ b/pkg/analysis_server/lib/src/services/snippets/snippet.dart @@ -17,5 +17,5 @@ class Snippet { /// The source changes to be made to insert this snippet. final SourceChange change; - Snippet(this.prefix, this.label, this.documentation, this.change); + new(this.prefix, this.label, this.documentation, this.change); } diff --git a/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart b/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart index 8d007cb1434..87d6163433f 100644 --- a/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart +++ b/pkg/analysis_server/lib/src/services/snippets/snippet_producer.dart @@ -28,7 +28,7 @@ abstract class DartSnippetProducer extends SnippetProducer { /// repeated searches where they may add imports for the same elements. final Map _elementImportCache; - DartSnippetProducer(super.request, {required this._elementImportCache}) + new(super.request, {required this._elementImportCache}) : sessionHelper = AnalysisSessionHelper(request.analysisSession), utils = CorrectionUtils.fromUnitAndContent( request.compilationUnit, @@ -55,7 +55,7 @@ abstract class FlutterSnippetProducer extends DartSnippetProducer { /// builder. final Set _requiredElementImports = {}; - FlutterSnippetProducer(super.request, {required super.elementImportCache}); + new(super.request, {required super.elementImportCache}); /// Adds public imports for any elements fetched by [getClass] and [getMixin] /// to [builder]. @@ -188,7 +188,7 @@ mixin FlutterWidgetSnippetProducerMixin on FlutterSnippetProducer { abstract class SnippetProducer { final DartSnippetRequest request; - SnippetProducer(this.request); + new(this.request); /// The prefix a user types to use this snippet. String get snippetPrefix; diff --git a/pkg/analysis_server/lib/src/services/user_prompts/dart_fix_prompt_manager.dart b/pkg/analysis_server/lib/src/services/user_prompts/dart_fix_prompt_manager.dart index 630ac6be4a9..af1ce8c9696 100644 --- a/pkg/analysis_server/lib/src/services/user_prompts/dart_fix_prompt_manager.dart +++ b/pkg/analysis_server/lib/src/services/user_prompts/dart_fix_prompt_manager.dart @@ -78,7 +78,7 @@ class DartFixPromptManager { CancelableToken? _inProgressCheckCancellationToken; - DartFixPromptManager(this.server, this.preferences); + new(this.server, this.preferences); /// Gets a map of context root paths to a list of associated sdk version /// constraints. diff --git a/pkg/analysis_server/lib/src/services/user_prompts/survey_manager.dart b/pkg/analysis_server/lib/src/services/user_prompts/survey_manager.dart index 408d23ddeb6..a68b330ed5e 100644 --- a/pkg/analysis_server/lib/src/services/user_prompts/survey_manager.dart +++ b/pkg/analysis_server/lib/src/services/user_prompts/survey_manager.dart @@ -40,7 +40,7 @@ class SurveyManager { /// timer if cancellation occurred while it was running. bool _isShutdown = false; - SurveyManager( + new( this._server, this._instrumentationService, this._analytics, { diff --git a/pkg/analysis_server/lib/src/services/user_prompts/user_prompts.dart b/pkg/analysis_server/lib/src/services/user_prompts/user_prompts.dart index dc3e70d7503..90644f8ef7b 100644 --- a/pkg/analysis_server/lib/src/services/user_prompts/user_prompts.dart +++ b/pkg/analysis_server/lib/src/services/user_prompts/user_prompts.dart @@ -14,7 +14,7 @@ import 'package:meta/meta.dart'; /// When the supplied resource provider is unable to store state, prompts will /// not be persisted and will default to safe values. abstract class UserPromptPreferences { - factory UserPromptPreferences( + factory( ResourceProvider resourceProvider, InstrumentationService instrumentationService, ) { @@ -80,10 +80,7 @@ class _PersistableUserPromptPreferences implements UserPromptPreferences { @visibleForTesting final File preferencesFile; - _PersistableUserPromptPreferences( - this.preferencesFile, - this._instrumentationService, - ); + new(this.preferencesFile, this._instrumentationService); @override bool get canPersist => true; diff --git a/pkg/analysis_server/lib/src/session_logger/entry_kind.dart b/pkg/analysis_server/lib/src/session_logger/entry_kind.dart index fa479df5a3b..d8cbb51ab9b 100644 --- a/pkg/analysis_server/lib/src/session_logger/entry_kind.dart +++ b/pkg/analysis_server/lib/src/session_logger/entry_kind.dart @@ -30,8 +30,8 @@ enum EntryKind { final String name; /// Creates a new kind with the given [name]. - const EntryKind(this.name); + new(this.name); /// Returns the kind with the given [name]. - factory EntryKind.forName(String name) => _nameMap[name]!; + factory forName(String name) => _nameMap[name]!; } diff --git a/pkg/analysis_server/lib/src/session_logger/process_id.dart b/pkg/analysis_server/lib/src/session_logger/process_id.dart index ac8d4cf55c6..dc2e46bb5b2 100644 --- a/pkg/analysis_server/lib/src/session_logger/process_id.dart +++ b/pkg/analysis_server/lib/src/session_logger/process_id.dart @@ -33,8 +33,8 @@ enum ProcessId { final String name; /// Creates a new process with the given [name]. - const ProcessId(this.name); + new(this.name); /// Returns the process with the given [name]. - factory ProcessId.forName(String name) => _nameMap[name]!; + factory forName(String name) => _nameMap[name]!; } diff --git a/pkg/analysis_server/lib/src/session_logger/session_logger.dart b/pkg/analysis_server/lib/src/session_logger/session_logger.dart index 2eb21e4fb2e..82db1ff5d3b 100644 --- a/pkg/analysis_server/lib/src/session_logger/session_logger.dart +++ b/pkg/analysis_server/lib/src/session_logger/session_logger.dart @@ -23,7 +23,7 @@ class SessionLogger { /// /// If [filePath] is non-`null`, it also writes log entries to a file at /// [filePath]. - factory SessionLogger({String? filePath}) { + factory({String? filePath}) { var normalizer = LogNormalizer(); var sink = SessionLoggerInMemorySink( maxBufferLength: 1024, @@ -33,7 +33,7 @@ class SessionLogger { return SessionLogger._(sink: sink, normalizer: normalizer); } - SessionLogger._({required this.sink, required this.normalizer}); + new _({required this.sink, required this.normalizer}); /// Adds normalization replacements for the package roots. /// diff --git a/pkg/analysis_server/lib/src/session_logger/session_logger_sink.dart b/pkg/analysis_server/lib/src/session_logger/session_logger_sink.dart index 5041a0ad10b..1938b236bad 100644 --- a/pkg/analysis_server/lib/src/session_logger/session_logger_sink.dart +++ b/pkg/analysis_server/lib/src/session_logger/session_logger_sink.dart @@ -20,7 +20,7 @@ final class SessionLoggerFileSink extends SessionLoggerSink { /// Initializes a newly created sink to write to the file at the given /// [filePath]. - SessionLoggerFileSink(String filePath, {required this._normalizer}) { + new(String filePath, {required this._normalizer}) { _sink = io.File(filePath).openWrite(); } @@ -73,7 +73,7 @@ final class SessionLoggerInMemorySink extends SessionLoggerSink { final LogNormalizer _normalizer; /// Initialize a newly created sink to store up to [maxBufferLength] entries. - SessionLoggerInMemorySink({ + new({ required this.maxBufferLength, required LogNormalizer normalizer, String? sessionLogFilePath, diff --git a/pkg/analysis_server/lib/src/socket_server.dart b/pkg/analysis_server/lib/src/socket_server.dart index 0cef00c88a1..199ec9aaf1a 100644 --- a/pkg/analysis_server/lib/src/socket_server.dart +++ b/pkg/analysis_server/lib/src/socket_server.dart @@ -66,7 +66,7 @@ class SocketServer implements AbstractSocketServer { final Map? environment; - SocketServer( + new( this.analysisServerOptions, this.sdkManager, this.crashReportingAttachmentsBuilder, diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart index c26b1cb005e..f02a8f8e477 100644 --- a/pkg/analysis_server/lib/src/status/diagnostics.dart +++ b/pkg/analysis_server/lib/src/status/diagnostics.dart @@ -102,7 +102,7 @@ String formatOption(String name, Object value) { } class AnalyticsPage extends DiagnosticPageWithNav { - AnalyticsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'analytics', @@ -155,7 +155,7 @@ class CollectedOptionsData { abstract class DiagnosticPage extends Page { final DiagnosticsSite site; - DiagnosticPage(this.site, String id, String title, {super.description}) + new(this.site, String id, String title, {super.description}) : super(id, title); bool get isNavPage => false; @@ -244,7 +244,7 @@ abstract class DiagnosticPage extends Page { abstract class DiagnosticPageWithNav extends DiagnosticPage { final bool indentInNav; - DiagnosticPageWithNav( + new( super.site, super.id, super.title, { @@ -509,8 +509,7 @@ td.pre { /// The last few lines printed. final List lastPrintedLines; - DiagnosticsSite(this.socketServer, this.lastPrintedLines) - : super('Analysis Server') { + new(this.socketServer, this.lastPrintedLines) : super('Analysis Server') { pages.add(CommunicationsPage(this)); pages.add(ContextsPage(this)); pages.add(EnvironmentVariablesPage(this)); @@ -588,7 +587,7 @@ td.pre { /// A base class for pages that provide real-time logging over a WebSocket. abstract class WebSocketLoggingPage extends DiagnosticPageWithNav implements WebSocketPage { - WebSocketLoggingPage(super.site, super.id, super.title, {super.description}); + new(super.site, super.id, super.title, {super.description}); void button(String text, {String? id, String classes = '', String? onClick}) { var attributes = { diff --git a/pkg/analysis_server/lib/src/status/pages.dart b/pkg/analysis_server/lib/src/status/pages.dart index fa09fe5802b..7e1e30d43c4 100644 --- a/pkg/analysis_server/lib/src/status/pages.dart +++ b/pkg/analysis_server/lib/src/status/pages.dart @@ -24,7 +24,7 @@ abstract class Page { final String title; final String? description; - Page(this.id, this.title, {this.description}); + new(this.id, this.title, {this.description}); // We could make this absolute which would make it work from multi-path // routes, but that also breaks it when serving through certain proxy servers @@ -195,7 +195,7 @@ abstract class Site { final String title; final List pages = []; - Site(this.title); + new(this.title); String get customCss => ''; diff --git a/pkg/analysis_server/lib/src/status/pages/analysis_driver_page.dart b/pkg/analysis_server/lib/src/status/pages/analysis_driver_page.dart index 907e37310d7..3424756ed5a 100644 --- a/pkg/analysis_server/lib/src/status/pages/analysis_driver_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/analysis_driver_page.dart @@ -11,7 +11,7 @@ import 'package:analyzer/src/util/performance/operation_performance.dart'; class AnalysisDriverPage extends DiagnosticPageWithNav implements PostablePage { static const _resetFormId = 'reset-driver-timers'; - AnalysisDriverPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'analysis-driver', diff --git a/pkg/analysis_server/lib/src/status/pages/analysis_options_page.dart b/pkg/analysis_server/lib/src/status/pages/analysis_options_page.dart index 83e4ad2142b..051aab7d30a 100644 --- a/pkg/analysis_server/lib/src/status/pages/analysis_options_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/analysis_options_page.dart @@ -10,7 +10,7 @@ import 'package:analyzer/src/generated/engine.dart'; /// The page that displays information about analysis options. class AnalysisOptionsPage extends DiagnosticPageWithNav { - AnalysisOptionsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'options', diff --git a/pkg/analysis_server/lib/src/status/pages/analysis_performance_log_page.dart b/pkg/analysis_server/lib/src/status/pages/analysis_performance_log_page.dart index bda11f8f58c..9662ad6f101 100644 --- a/pkg/analysis_server/lib/src/status/pages/analysis_performance_log_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/analysis_performance_log_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/diagnostics.dart'; import 'package:analysis_server/src/utilities/stream_string_stink.dart'; class AnalysisPerformanceLogPage extends WebSocketLoggingPage { - AnalysisPerformanceLogPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'analysis-performance-log', diff --git a/pkg/analysis_server/lib/src/status/pages/assists_page.dart b/pkg/analysis_server/lib/src/status/pages/assists_page.dart index 74403a2a9f4..a30516fbc93 100644 --- a/pkg/analysis_server/lib/src/status/pages/assists_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/assists_page.dart @@ -10,7 +10,7 @@ import 'package:analysis_server_plugin/src/correction/assist_performance.dart'; import 'package:path/path.dart' as path; class AssistsPage extends DiagnosticPageWithNav with PerformanceChartMixin { - AssistsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'assists', diff --git a/pkg/analysis_server/lib/src/status/pages/ast_page.dart b/pkg/analysis_server/lib/src/status/pages/ast_page.dart index dfd4990ace1..7791e147145 100644 --- a/pkg/analysis_server/lib/src/status/pages/ast_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/ast_page.dart @@ -12,7 +12,7 @@ import 'package:analyzer/dart/analysis/results.dart'; class AstPage extends DiagnosticPageWithNav { String? _description; - AstPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super(site, 'ast', 'AST', description: 'The AST for a file.'); @override diff --git a/pkg/analysis_server/lib/src/status/pages/client_page.dart b/pkg/analysis_server/lib/src/status/pages/client_page.dart index cf175b36922..19b82b39ffc 100644 --- a/pkg/analysis_server/lib/src/status/pages/client_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/client_page.dart @@ -7,7 +7,7 @@ import 'dart:async'; import 'package:analysis_server/src/status/diagnostics.dart'; class ClientPage extends DiagnosticPageWithNav { - ClientPage(super.site, [super.id = 'client', super.title = 'Client']) + new(super.site, [super.id = 'client', super.title = 'Client']) : super(description: 'Information about the client.'); @override diff --git a/pkg/analysis_server/lib/src/status/pages/code_completion_page.dart b/pkg/analysis_server/lib/src/status/pages/code_completion_page.dart index 7f2b87c45ce..b84086cce25 100644 --- a/pkg/analysis_server/lib/src/status/pages/code_completion_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/code_completion_page.dart @@ -11,7 +11,7 @@ import 'package:path/path.dart' as path; class CodeCompletionPage extends DiagnosticPageWithNav with PerformanceChartMixin { - CodeCompletionPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'code-completion', diff --git a/pkg/analysis_server/lib/src/status/pages/collect_report_page.dart b/pkg/analysis_server/lib/src/status/pages/collect_report_page.dart index 5b0a5fd5ea2..071c86df733 100644 --- a/pkg/analysis_server/lib/src/status/pages/collect_report_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/collect_report_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/diagnostics.dart'; import 'package:analysis_server/src/status/utilities/report_data.dart'; class CollectReportPage extends DiagnosticPage { - CollectReportPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'collect-report', diff --git a/pkg/analysis_server/lib/src/status/pages/communications_page.dart b/pkg/analysis_server/lib/src/status/pages/communications_page.dart index 4c35f318cd6..375d9b88497 100644 --- a/pkg/analysis_server/lib/src/status/pages/communications_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/communications_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/diagnostics.dart'; import 'package:analysis_server/src/status/pages.dart'; class CommunicationsPage extends DiagnosticPageWithNav { - CommunicationsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'communications', diff --git a/pkg/analysis_server/lib/src/status/pages/contents_page.dart b/pkg/analysis_server/lib/src/status/pages/contents_page.dart index 2fa55ae9bf5..d50ba0f97f1 100644 --- a/pkg/analysis_server/lib/src/status/pages/contents_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/contents_page.dart @@ -10,7 +10,7 @@ import 'package:analysis_server/src/status/pages.dart'; class ContentsPage extends DiagnosticPageWithNav { String? _description; - ContentsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'contents', diff --git a/pkg/analysis_server/lib/src/status/pages/contexts_page.dart b/pkg/analysis_server/lib/src/status/pages/contexts_page.dart index f49c8401674..4cfe1b7f7d0 100644 --- a/pkg/analysis_server/lib/src/status/pages/contexts_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/contexts_page.dart @@ -21,7 +21,7 @@ import 'package:analyzer/src/workspace/workspace.dart'; import 'package:path/path.dart' as path; class ContextsPage extends DiagnosticPageWithNav { - ContextsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'contexts', diff --git a/pkg/analysis_server/lib/src/status/pages/element_model_page.dart b/pkg/analysis_server/lib/src/status/pages/element_model_page.dart index b3db9b96276..3f2daf2da3d 100644 --- a/pkg/analysis_server/lib/src/status/pages/element_model_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/element_model_page.dart @@ -12,7 +12,7 @@ import 'package:analyzer/dart/analysis/results.dart'; class ElementModelPage extends DiagnosticPageWithNav { String? _description; - ElementModelPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'element-model', diff --git a/pkg/analysis_server/lib/src/status/pages/environment_variables_page.dart b/pkg/analysis_server/lib/src/status/pages/environment_variables_page.dart index 68686a99802..6fdb2fc37c4 100644 --- a/pkg/analysis_server/lib/src/status/pages/environment_variables_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/environment_variables_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/pages.dart'; import 'package:analyzer/src/util/platform_info.dart'; class EnvironmentVariablesPage extends DiagnosticPageWithNav { - EnvironmentVariablesPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'environment', diff --git a/pkg/analysis_server/lib/src/status/pages/exception_page.dart b/pkg/analysis_server/lib/src/status/pages/exception_page.dart index ae3f4e5939e..3b0c9dec328 100644 --- a/pkg/analysis_server/lib/src/status/pages/exception_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/exception_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/diagnostics.dart'; class ExceptionPage extends DiagnosticPage { final StackTrace trace; - ExceptionPage(DiagnosticsSite site, String message, this.trace) + new(DiagnosticsSite site, String message, this.trace) : super(site, '', '500 Oops', description: message); @override diff --git a/pkg/analysis_server/lib/src/status/pages/exceptions_page.dart b/pkg/analysis_server/lib/src/status/pages/exceptions_page.dart index 4f49702587b..92b2aeb2e7e 100644 --- a/pkg/analysis_server/lib/src/status/pages/exceptions_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/exceptions_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/diagnostics.dart'; import 'package:analysis_server/src/status/pages.dart'; class ExceptionsPage extends DiagnosticPageWithNav { - ExceptionsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'exceptions', diff --git a/pkg/analysis_server/lib/src/status/pages/feedback_page.dart b/pkg/analysis_server/lib/src/status/pages/feedback_page.dart index 48621b90c0f..510497291e8 100644 --- a/pkg/analysis_server/lib/src/status/pages/feedback_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/feedback_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/pages.dart'; import 'package:analyzer/src/util/platform_info.dart'; class FeedbackPage extends DiagnosticPage { - FeedbackPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'feedback', diff --git a/pkg/analysis_server/lib/src/status/pages/file_byte_store_timing_page.dart b/pkg/analysis_server/lib/src/status/pages/file_byte_store_timing_page.dart index e8a7303ba16..e3bd04930f7 100644 --- a/pkg/analysis_server/lib/src/status/pages/file_byte_store_timing_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/file_byte_store_timing_page.dart @@ -9,7 +9,7 @@ import 'package:analysis_server/src/status/pages.dart'; class FileByteStoreTimingPage extends DiagnosticPageWithNav with PerformanceChartMixin { - FileByteStoreTimingPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'file-byte-store-timing', diff --git a/pkg/analysis_server/lib/src/status/pages/fixes_page.dart b/pkg/analysis_server/lib/src/status/pages/fixes_page.dart index 3a010281c38..9ec6078e0b5 100644 --- a/pkg/analysis_server/lib/src/status/pages/fixes_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/fixes_page.dart @@ -10,7 +10,7 @@ import 'package:analysis_server/src/status/pages.dart'; import 'package:path/path.dart' as path; class FixesPage extends DiagnosticPageWithNav with PerformanceChartMixin { - FixesPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'fixes', diff --git a/pkg/analysis_server/lib/src/status/pages/legacy_plugins_page.dart b/pkg/analysis_server/lib/src/status/pages/legacy_plugins_page.dart index b6b2d8362e6..b5412bdfadc 100644 --- a/pkg/analysis_server/lib/src/status/pages/legacy_plugins_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/legacy_plugins_page.dart @@ -15,7 +15,7 @@ class LegacyPluginsPage extends DiagnosticPageWithNav { @override AnalysisServer server; - LegacyPluginsPage(DiagnosticsSite site, this.server) + new(DiagnosticsSite site, this.server) : super( site, 'legacy-plugins', diff --git a/pkg/analysis_server/lib/src/status/pages/lsp_capabilities_page.dart b/pkg/analysis_server/lib/src/status/pages/lsp_capabilities_page.dart index bbf58c8459d..ff3d244ccf5 100644 --- a/pkg/analysis_server/lib/src/status/pages/lsp_capabilities_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/lsp_capabilities_page.dart @@ -12,7 +12,7 @@ class LspCapabilitiesPage extends DiagnosticPageWithNav { @override LspAnalysisServer server; - LspCapabilitiesPage(DiagnosticsSite site, this.server) + new(DiagnosticsSite site, this.server) : super( site, 'lsp-capabilities', diff --git a/pkg/analysis_server/lib/src/status/pages/lsp_client_page.dart b/pkg/analysis_server/lib/src/status/pages/lsp_client_page.dart index 200f32f8756..7048ea54da8 100644 --- a/pkg/analysis_server/lib/src/status/pages/lsp_client_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/lsp_client_page.dart @@ -14,7 +14,7 @@ class LspClientPage extends ClientPage { @override LspAnalysisServer server; - LspClientPage(DiagnosticsSite site, this.server) : super(site, 'lsp', 'LSP'); + new(DiagnosticsSite site, this.server) : super(site, 'lsp', 'LSP'); @override Future generateContent(Map params) async { diff --git a/pkg/analysis_server/lib/src/status/pages/lsp_registrations_page.dart b/pkg/analysis_server/lib/src/status/pages/lsp_registrations_page.dart index c9675d8e02e..add526acfa2 100644 --- a/pkg/analysis_server/lib/src/status/pages/lsp_registrations_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/lsp_registrations_page.dart @@ -12,7 +12,7 @@ class LspRegistrationsPage extends DiagnosticPageWithNav { @override LspAnalysisServer server; - LspRegistrationsPage(DiagnosticsSite site, this.server) + new(DiagnosticsSite site, this.server) : super( site, 'lsp-registrations', diff --git a/pkg/analysis_server/lib/src/status/pages/memory_and_cpu_page.dart b/pkg/analysis_server/lib/src/status/pages/memory_and_cpu_page.dart index 688550b927d..ddb51050372 100644 --- a/pkg/analysis_server/lib/src/status/pages/memory_and_cpu_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/memory_and_cpu_page.dart @@ -13,7 +13,7 @@ import 'package:analysis_server/src/utilities/profiling.dart'; class MemoryAndCpuPage extends DiagnosticPageWithNav { final ProcessProfiler profiler; - MemoryAndCpuPage(DiagnosticsSite site, this.profiler) + new(DiagnosticsSite site, this.profiler) : super( site, 'memory-and-cpu-usage', diff --git a/pkg/analysis_server/lib/src/status/pages/message_scheduler_page.dart b/pkg/analysis_server/lib/src/status/pages/message_scheduler_page.dart index a49f1c6f152..d63e646302b 100644 --- a/pkg/analysis_server/lib/src/status/pages/message_scheduler_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/message_scheduler_page.dart @@ -10,7 +10,7 @@ import 'package:analysis_server/src/scheduler/scheduler_tracking_listener.dart'; import 'package:analysis_server/src/status/diagnostics.dart'; class MessageSchedulerPage extends DiagnosticPageWithNav { - MessageSchedulerPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'messageScheduler', diff --git a/pkg/analysis_server/lib/src/status/pages/not_found_page.dart b/pkg/analysis_server/lib/src/status/pages/not_found_page.dart index bc7b8455a0f..9309cdc771a 100644 --- a/pkg/analysis_server/lib/src/status/pages/not_found_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/not_found_page.dart @@ -10,7 +10,7 @@ class NotFoundPage extends DiagnosticPage { @override final String path; - NotFoundPage(DiagnosticsSite site, this.path) + new(DiagnosticsSite site, this.path) : super(site, '', '404 Not found', description: "'$path' not found."); @override diff --git a/pkg/analysis_server/lib/src/status/pages/plugins_page.dart b/pkg/analysis_server/lib/src/status/pages/plugins_page.dart index bd322022d14..d4ea4cde128 100644 --- a/pkg/analysis_server/lib/src/status/pages/plugins_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/plugins_page.dart @@ -17,7 +17,7 @@ class PluginsPage extends DiagnosticPageWithNav { @override AnalysisServer server; - PluginsPage(DiagnosticsSite site, this.server) + new(DiagnosticsSite site, this.server) : super(site, 'plugins', 'Plugins', description: 'Plugins in use.'); @override diff --git a/pkg/analysis_server/lib/src/status/pages/refactorings_page.dart b/pkg/analysis_server/lib/src/status/pages/refactorings_page.dart index ba2d71c835f..bcf1ce5c91c 100644 --- a/pkg/analysis_server/lib/src/status/pages/refactorings_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/refactorings_page.dart @@ -11,7 +11,7 @@ import 'package:path/path.dart' as path; class RefactoringsPage extends DiagnosticPageWithNav with PerformanceChartMixin { - RefactoringsPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'getRefactorings', diff --git a/pkg/analysis_server/lib/src/status/pages/session_log_page.dart b/pkg/analysis_server/lib/src/status/pages/session_log_page.dart index 08bbe8ecf3b..5293a247851 100644 --- a/pkg/analysis_server/lib/src/status/pages/session_log_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/session_log_page.dart @@ -12,7 +12,7 @@ import 'package:analysis_server/src/status/pages.dart'; class SessionLogPage extends DiagnosticPageWithNav implements PostablePage { static const _captureFormId = 'capture-entries'; - SessionLogPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'session-log', diff --git a/pkg/analysis_server/lib/src/status/pages/status_page.dart b/pkg/analysis_server/lib/src/status/pages/status_page.dart index ed00df451c1..d2f1a5f6b45 100644 --- a/pkg/analysis_server/lib/src/status/pages/status_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/status_page.dart @@ -12,7 +12,7 @@ import 'package:analysis_server/src/status/diagnostics.dart'; import 'package:analyzer/src/util/platform_info.dart'; class StatusPage extends DiagnosticPageWithNav { - StatusPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super( site, 'status', diff --git a/pkg/analysis_server/lib/src/status/pages/subscriptions_page.dart b/pkg/analysis_server/lib/src/status/pages/subscriptions_page.dart index e522bceb250..044fea363c4 100644 --- a/pkg/analysis_server/lib/src/status/pages/subscriptions_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/subscriptions_page.dart @@ -12,7 +12,7 @@ class SubscriptionsPage extends DiagnosticPageWithNav { @override LegacyAnalysisServer server; - SubscriptionsPage(DiagnosticsSite site, this.server) + new(DiagnosticsSite site, this.server) : super( site, 'subscriptions', diff --git a/pkg/analysis_server/lib/src/status/pages/timing_page.dart b/pkg/analysis_server/lib/src/status/pages/timing_page.dart index e780714de27..6406f2bd4e6 100644 --- a/pkg/analysis_server/lib/src/status/pages/timing_page.dart +++ b/pkg/analysis_server/lib/src/status/pages/timing_page.dart @@ -12,7 +12,7 @@ import 'package:analysis_server_plugin/src/correction/performance.dart'; import 'package:collection/collection.dart'; class TimingPage extends DiagnosticPageWithNav with PerformanceChartMixin { - TimingPage(DiagnosticsSite site) + new(DiagnosticsSite site) : super(site, 'timing', 'Timing', description: 'Timing statistics.'); @override diff --git a/pkg/analysis_server/lib/src/status/performance_logger.dart b/pkg/analysis_server/lib/src/status/performance_logger.dart index dff1ff5fed3..7efc70333b1 100644 --- a/pkg/analysis_server/lib/src/status/performance_logger.dart +++ b/pkg/analysis_server/lib/src/status/performance_logger.dart @@ -11,7 +11,7 @@ class PerformanceLogger { /// to be done at this point. late final IOSink _sink; - PerformanceLogger(String filePath) { + new(String filePath) { _sink = File(filePath).openWrite(); } diff --git a/pkg/analysis_server/lib/src/status/utilities/ast_writer.dart b/pkg/analysis_server/lib/src/status/utilities/ast_writer.dart index 1d8d9ace33d..6afff4c1f38 100644 --- a/pkg/analysis_server/lib/src/status/utilities/ast_writer.dart +++ b/pkg/analysis_server/lib/src/status/utilities/ast_writer.dart @@ -13,7 +13,7 @@ class AstWriter extends UnifyingAstVisitor with TreeWriter { /// Initialize a newly created element writer to write the HTML representation /// of visited nodes on the given [buffer]. - AstWriter(this.buffer); + new(this.buffer); @override void visitNode(AstNode node) { diff --git a/pkg/analysis_server/lib/src/status/utilities/element_writer.dart b/pkg/analysis_server/lib/src/status/utilities/element_writer.dart index 89d946b46f3..043b1d4181f 100644 --- a/pkg/analysis_server/lib/src/status/utilities/element_writer.dart +++ b/pkg/analysis_server/lib/src/status/utilities/element_writer.dart @@ -16,7 +16,7 @@ class ElementWriter with TreeWriter { /// Initialize a newly created element writer to write the HTML representation /// of visited elements on the given [buffer]. - ElementWriter(this.buffer); + new(this.buffer); void write(Element element) { _writeElement(element); diff --git a/pkg/analysis_server/lib/src/utilities/element_location2.dart b/pkg/analysis_server/lib/src/utilities/element_location2.dart index 5cdfd2ded9c..90df9369965 100644 --- a/pkg/analysis_server/lib/src/utilities/element_location2.dart +++ b/pkg/analysis_server/lib/src/utilities/element_location2.dart @@ -20,7 +20,7 @@ class ElementLocation { /// this location is a [_MemberElementLocation]. final String _topLevelName; - factory ElementLocation.decode(String encoded) { + factory decode(String encoded) { var components = encoded.split(';'); return switch (components) { [String library, String topName] => ElementLocation._(library, topName), @@ -34,7 +34,7 @@ class ElementLocation { }; } - ElementLocation._(this._libraryUri, this._topLevelName); + new _(this._libraryUri, this._topLevelName); String get encoding => '$_libraryUri;$_topLevelName'; @@ -81,11 +81,7 @@ class _MemberElementLocation extends ElementLocation { /// The [Element.lookupName] for this member within [_topLevelName]. final String _memberName; - _MemberElementLocation._( - super.libraryUri, - super.topLevelName, - this._memberName, - ) : super._(); + new _(super.libraryUri, super.topLevelName, this._memberName) : super._(); @override String get encoding => '${super.encoding};$_memberName'; diff --git a/pkg/analysis_server/lib/src/utilities/extensions/ast.dart b/pkg/analysis_server/lib/src/utilities/extensions/ast.dart index 5ca17cb947c..21f90586d9c 100644 --- a/pkg/analysis_server/lib/src/utilities/extensions/ast.dart +++ b/pkg/analysis_server/lib/src/utilities/extensions/ast.dart @@ -19,7 +19,7 @@ class ThrowStatement { final ExpressionStatement statement; final ThrowExpression expression; - ThrowStatement({required this.statement, required this.expression}); + new({required this.statement, required this.expression}); } class _ReferencedUnprefixedNamesCollector extends RecursiveAstVisitor { diff --git a/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart b/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart index f0ce00b8968..65004f45e5d 100644 --- a/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart +++ b/pkg/analysis_server/lib/src/utilities/extensions/range_factory.dart @@ -15,7 +15,7 @@ class TokenWithOptionalComma { /// `true` if a comma is previously included. final bool includesComma; - TokenWithOptionalComma(this.token, this.includesComma); + new(this.token, this.includesComma); } extension RangeFactoryExtensions on RangeFactory { diff --git a/pkg/analysis_server/lib/src/utilities/file_string_sink.dart b/pkg/analysis_server/lib/src/utilities/file_string_sink.dart index 553c3c0f9da..dc83d571418 100644 --- a/pkg/analysis_server/lib/src/utilities/file_string_sink.dart +++ b/pkg/analysis_server/lib/src/utilities/file_string_sink.dart @@ -8,8 +8,7 @@ import 'dart:io'; class FileStringSink implements StringSink { final IOSink _sink; - FileStringSink(String path) - : _sink = File(path).openWrite(mode: FileMode.append); + new(String path) : _sink = File(path).openWrite(mode: FileMode.append); @override void write(Object? obj) { diff --git a/pkg/analysis_server/lib/src/utilities/import_analyzer.dart b/pkg/analysis_server/lib/src/utilities/import_analyzer.dart index 92c9e3ff3a0..a65dcac9e76 100644 --- a/pkg/analysis_server/lib/src/utilities/import_analyzer.dart +++ b/pkg/analysis_server/lib/src/utilities/import_analyzer.dart @@ -39,7 +39,7 @@ class ImportAnalyzer { /// /// The declarations being moved are in the file at the given [path] in the /// given [ranges]. - ImportAnalyzer(this.result, String path, List ranges) { + new(this.result, String path, List ranges) { for (var unit in result.units) { var finder = _ReferenceFinder( unit, @@ -95,7 +95,7 @@ class _ElementRecorder { /// Initialize a newly created recorder to use the [analyzer] to record /// declarations of and references to elements, based on whether the reference /// is within the [ranges]. - _ElementRecorder(this.analyzer, this.ranges); + new(this.analyzer, this.ranges); /// Record that the [declaredElement] is declared in the library. /// @@ -176,7 +176,7 @@ class _ReferenceFinder extends RecursiveAstVisitor { final _importsByPrefix = >{}; /// Initialize a newly created finder to send information to the [recorder]. - _ReferenceFinder(this.unit, this.recorder) { + new(this.unit, this.recorder) { for (var import in unit.libraryElement.firstFragment.libraryImports) { _importsByPrefix .putIfAbsent(import.prefix?.element.name ?? '', () => {}) diff --git a/pkg/analysis_server/lib/src/utilities/index_range.dart b/pkg/analysis_server/lib/src/utilities/index_range.dart index 648ec025a12..e5c45bdbe51 100644 --- a/pkg/analysis_server/lib/src/utilities/index_range.dart +++ b/pkg/analysis_server/lib/src/utilities/index_range.dart @@ -12,7 +12,7 @@ class IndexRange { final int upper; /// Initialize a newly created range. - IndexRange(this.lower, this.upper); + new(this.lower, this.upper); /// Return the number of indices in this range. int get count => upper - lower + 1; diff --git a/pkg/analysis_server/lib/src/utilities/mocks.dart b/pkg/analysis_server/lib/src/utilities/mocks.dart index e6962b7178a..2668ae47508 100644 --- a/pkg/analysis_server/lib/src/utilities/mocks.dart +++ b/pkg/analysis_server/lib/src/utilities/mocks.dart @@ -63,8 +63,7 @@ class MockServerChannel implements ServerCommunicationChannel { /// True if we are printing out messages exchanged with the server. final bool printMessages; - MockServerChannel({bool? printMessages}) - : printMessages = printMessages ?? false; + new({bool? printMessages}) : printMessages = printMessages ?? false; /// Return the broadcast stream of notifications. Stream get notifications { @@ -213,7 +212,7 @@ class MockServerChannel implements ServerCommunicationChannel { class ServerError implements Exception { final String message; - ServerError(this.message); + new(this.message); @override String toString() { diff --git a/pkg/analysis_server/lib/src/utilities/navigation/keyword_navigation_computer.dart b/pkg/analysis_server/lib/src/utilities/navigation/keyword_navigation_computer.dart index 2ccd6ca7fd7..affca5addf4 100644 --- a/pkg/analysis_server/lib/src/utilities/navigation/keyword_navigation_computer.dart +++ b/pkg/analysis_server/lib/src/utilities/navigation/keyword_navigation_computer.dart @@ -14,7 +14,7 @@ class KeywordNavigationComputer { final NavigationCollector collector; final LibraryFragment libraryFrament; - KeywordNavigationComputer(this.collector, this.libraryFrament); + new(this.collector, this.libraryFrament); void compute(AstNode? node) { if (node is! Statement) return; diff --git a/pkg/analysis_server/lib/src/utilities/process.dart b/pkg/analysis_server/lib/src/utilities/process.dart index 00558d3e3da..982a47cc2fb 100644 --- a/pkg/analysis_server/lib/src/utilities/process.dart +++ b/pkg/analysis_server/lib/src/utilities/process.dart @@ -10,7 +10,7 @@ import 'dart:io'; class ProcessRunner { final Map? environment; - const ProcessRunner({this.environment}); + const new({this.environment}); ProcessResult runSync( String executable, diff --git a/pkg/analysis_server/lib/src/utilities/profiling.dart b/pkg/analysis_server/lib/src/utilities/profiling.dart index a28b36d0020..24928b8b7ed 100644 --- a/pkg/analysis_server/lib/src/utilities/profiling.dart +++ b/pkg/analysis_server/lib/src/utilities/profiling.dart @@ -10,7 +10,7 @@ import 'package:analyzer/src/util/platform_info.dart'; /// A class that can return memory and cpu usage information for a given /// process. abstract class ProcessProfiler { - ProcessProfiler._(); + new _(); Future getProcessUsage(int processId); @@ -39,7 +39,7 @@ class UsageInfo { /// The process memory usage in kilobytes. final int memoryKB; - UsageInfo(this.cpuPercentage, this.memoryKB); + new(this.cpuPercentage, this.memoryKB); double get memoryMB => memoryKB / 1024; @@ -55,7 +55,7 @@ class UsageInfo { class _PosixProcessProfiler extends ProcessProfiler { static final RegExp stringSplitRegExp = RegExp(r'\s+'); - _PosixProcessProfiler() : super._(); + new() : super._(); @override Future getProcessUsage(int processId) { @@ -91,7 +91,7 @@ class _PosixProcessProfiler extends ProcessProfiler { } class _WindowsProcessProfiler extends ProcessProfiler { - _WindowsProcessProfiler() : super._(); + new() : super._(); @override Future getProcessUsage(int processId) async { diff --git a/pkg/analysis_server/lib/src/utilities/pubspec.dart b/pkg/analysis_server/lib/src/utilities/pubspec.dart index 53ed86d91a4..e43f586fff0 100644 --- a/pkg/analysis_server/lib/src/utilities/pubspec.dart +++ b/pkg/analysis_server/lib/src/utilities/pubspec.dart @@ -103,7 +103,7 @@ class PubspecEdit { /// The full new SDK constraint text after the edit is applied. final String newConstraint; - PubspecEdit({ + new({ required this.offset, required this.length, required this.replacement, diff --git a/pkg/analysis_server/lib/src/utilities/request_statistics.dart b/pkg/analysis_server/lib/src/utilities/request_statistics.dart index e331576fcc5..9ee2e451934 100644 --- a/pkg/analysis_server/lib/src/utilities/request_statistics.dart +++ b/pkg/analysis_server/lib/src/utilities/request_statistics.dart @@ -26,7 +26,7 @@ class RequestStatisticsHelper { /// Is `true` if the client subscribed for "server.log" notification. bool _isNotificationSubscribed = false; - RequestStatisticsHelper(); + new(); /// Set whether the client subscribed for "server.log" notification. set isNotificationSubscribed(bool value) { @@ -176,12 +176,7 @@ class _RequestStatistics { final DateTime serverRequestTime; final List<_RequestStatisticsItem> items = []; - _RequestStatistics( - this.id, - this.method, - this.clientRequestTime, - this.serverRequestTime, - ); + new(this.id, this.method, this.clientRequestTime, this.serverRequestTime); Map toJson(DateTime responseTime) { var map = { @@ -202,7 +197,7 @@ class _RequestStatisticsItem { final String name; final DateTime? timeValue; - _RequestStatisticsItem(this.name, {this.timeValue}); + new(this.name, {this.timeValue}); Map toJson() { var timeValue = this.timeValue; @@ -216,7 +211,7 @@ class _RequestStatisticsItem { class _ServerLogStringSink implements StringSink { final RequestStatisticsHelper helper; - _ServerLogStringSink(this.helper); + new(this.helper); @override void write(Object? obj) { diff --git a/pkg/analysis_server/lib/src/utilities/sdk.dart b/pkg/analysis_server/lib/src/utilities/sdk.dart index 80563a2d597..8f8d99e526e 100644 --- a/pkg/analysis_server/lib/src/utilities/sdk.dart +++ b/pkg/analysis_server/lib/src/utilities/sdk.dart @@ -24,9 +24,9 @@ class Sdk { final bool _runFromBuildRoot; - factory Sdk() => _instance; + factory() => _instance; - Sdk._(this.sdkPath, this._runFromBuildRoot); + new _(this.sdkPath, this._runFromBuildRoot); /// Path to the 'dart' executable in the Dart SDK. String get dart { diff --git a/pkg/analysis_server/lib/src/utilities/source_change_merger.dart b/pkg/analysis_server/lib/src/utilities/source_change_merger.dart index 8e9654318a7..db5a65c8efa 100644 --- a/pkg/analysis_server/lib/src/utilities/source_change_merger.dart +++ b/pkg/analysis_server/lib/src/utilities/source_change_merger.dart @@ -24,7 +24,7 @@ class SourceChangeMerger { /// This can be used in tests to provide more details about failures. final StringBuffer? debugBuffer; - SourceChangeMerger({this.debugBuffer}); + new({this.debugBuffer}); /// Merges a set of edits in-place. List merge(List edits) { diff --git a/pkg/analysis_server/lib/src/utilities/stream.dart b/pkg/analysis_server/lib/src/utilities/stream.dart index ef5e9c7402d..1405d345762 100644 --- a/pkg/analysis_server/lib/src/utilities/stream.dart +++ b/pkg/analysis_server/lib/src/utilities/stream.dart @@ -14,7 +14,7 @@ class MoreTypedStreamController { /// There is no static guarantee that [onPause] will not be invoked twice. /// /// Internally the wrapper is not safe, and uses explicit null checks. - factory MoreTypedStreamController({ + factory({ required ListenData Function(StreamController) onListen, PauseData Function(ListenData)? onPause, void Function(ListenData, PauseData)? onResume, @@ -54,5 +54,5 @@ class MoreTypedStreamController { return MoreTypedStreamController._(controller); } - MoreTypedStreamController._(this.controller); + new _(this.controller); } diff --git a/pkg/analysis_server/lib/src/utilities/stream_string_stink.dart b/pkg/analysis_server/lib/src/utilities/stream_string_stink.dart index 0dc1fc5b1c5..dc341b4e866 100644 --- a/pkg/analysis_server/lib/src/utilities/stream_string_stink.dart +++ b/pkg/analysis_server/lib/src/utilities/stream_string_stink.dart @@ -8,7 +8,7 @@ import 'dart:async'; class StreamStringSink implements StringSink { final StreamSink _sink; - StreamStringSink(this._sink); + new(this._sink); @override void write(Object? obj) { diff --git a/pkg/analysis_server/lib/src/utilities/strings.dart b/pkg/analysis_server/lib/src/utilities/strings.dart index 4bc4d233f06..bb6312d1a61 100644 --- a/pkg/analysis_server/lib/src/utilities/strings.dart +++ b/pkg/analysis_server/lib/src/utilities/strings.dart @@ -136,5 +136,5 @@ class SimpleDiff { final int length; final String replacement; - SimpleDiff(this.offset, this.length, this.replacement); + new(this.offset, this.length, this.replacement); } diff --git a/pkg/analysis_server/lib/src/utilities/timing_byte_store.dart b/pkg/analysis_server/lib/src/utilities/timing_byte_store.dart index 19af82a7032..5379751d5f5 100644 --- a/pkg/analysis_server/lib/src/utilities/timing_byte_store.dart +++ b/pkg/analysis_server/lib/src/utilities/timing_byte_store.dart @@ -15,7 +15,7 @@ class ByteStoreTimings { final _readTime = Stopwatch(); var _readCount = 0; - ByteStoreTimings(this.reason) : time = DateTime.now(); + new(this.reason) : time = DateTime.now(); int get readCount => _readCount; Duration get readTime => _readTime.elapsed; @@ -34,7 +34,7 @@ class TimingByteStore implements ByteStore { /// The current bucket to record times into. var _current = ByteStoreTimings('startup'); - TimingByteStore(this._store); + new(this._store); @override Uint8List? get(String key) { diff --git a/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart b/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart index 664152c1fc1..cf20f768bb9 100644 --- a/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart +++ b/pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart @@ -19,7 +19,7 @@ class YamlNodeLocator { /// /// If the [end] offset is not provided, then it is considered the same as the /// [start] offset. - YamlNodeLocator({required int start, int? end}) + new({required int start, int? end}) : _startOffset = start, _endOffset = end ?? start; diff --git a/pkg/analysis_server/lib/starter.dart b/pkg/analysis_server/lib/starter.dart index 826d46806ea..97db0c57c17 100644 --- a/pkg/analysis_server/lib/starter.dart +++ b/pkg/analysis_server/lib/starter.dart @@ -14,7 +14,7 @@ import 'package:analysis_server/src/server/driver.dart'; /// Clients may not extend, implement or mix-in this class. abstract class ServerStarter { /// Initialize a newly created starter to start up an analysis server. - factory ServerStarter() = Driver; + factory() = Driver; /// Set the new builder for attachments that should be included into crash /// reports. diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml index 9153a5e0c88..8ccef64c0cd 100644 --- a/pkg/analysis_server/pubspec.yaml +++ b/pkg/analysis_server/pubspec.yaml @@ -3,7 +3,7 @@ name: analysis_server publish_to: none environment: - sdk: '^3.12.0-0' + sdk: '^3.13.0-0' resolution: workspace diff --git a/pkg/analysis_server/test/client/impl/completion_driver.dart b/pkg/analysis_server/test/client/impl/completion_driver.dart index 37c5d8481c8..dbf349b00ef 100644 --- a/pkg/analysis_server/test/client/impl/completion_driver.dart +++ b/pkg/analysis_server/test/client/impl/completion_driver.dart @@ -32,7 +32,7 @@ class CompletionDriver with ExpectMixin { late int replacementOffset; late int replacementLength; - CompletionDriver({required this.server}) { + new({required this.server}) { server.serverChannel.notifications.listen(processNotification); } diff --git a/pkg/analysis_server/test/completion_test_support.dart b/pkg/analysis_server/test/completion_test_support.dart index 7f25eced482..5fbf38224d5 100644 --- a/pkg/analysis_server/test/completion_test_support.dart +++ b/pkg/analysis_server/test/completion_test_support.dart @@ -133,7 +133,7 @@ class LocationSpec { List negativeResults = []; late String source; - LocationSpec(this.id); + new(this.id); /// Parse a set of tests from the given `originalSource`. Return a list of the /// specifications that were parsed. diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart index 4c37c9eb1a4..023271b0997 100644 --- a/pkg/analysis_server/test/domain_analysis_test.dart +++ b/pkg/analysis_server/test/domain_analysis_test.dart @@ -2681,7 +2681,7 @@ class _NotificationPrinter { final ResourceProvider resourceProvider; final TreeStringSink sink; - _NotificationPrinter({ + new({ required this.configuration, required this.resourceProvider, required this.sink, diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart index e9fe636b35a..b22ade753f5 100644 --- a/pkg/analysis_server/test/domain_completion_test.dart +++ b/pkg/analysis_server/test/domain_completion_test.dart @@ -2296,7 +2296,7 @@ class RequestWithFutureResponse { final Request request; final Future futureResponse; - RequestWithFutureResponse(this.offset, this.request, this.futureResponse); + new(this.offset, this.request, this.futureResponse); Future toResponse() async { var response = await futureResponse; @@ -2325,7 +2325,7 @@ class _SuggestionDetailsPrinter { String _indent = ''; - _SuggestionDetailsPrinter({ + new({ required this.buffer, required this.result, required this.resourceProvider, diff --git a/pkg/analysis_server/test/lsp/change_verifier.dart b/pkg/analysis_server/test/lsp/change_verifier.dart index b1fb3660c79..96b2e2426a3 100644 --- a/pkg/analysis_server/test/lsp/change_verifier.dart +++ b/pkg/analysis_server/test/lsp/change_verifier.dart @@ -38,7 +38,7 @@ class LspChangeVerifier { /// The line terminator to use in the output. final String endOfLine = testEol; - LspChangeVerifier(this.editHelpers, this.edit) { + new(this.editHelpers, this.edit) { _applyEdit(); } @@ -302,9 +302,9 @@ class TextEditWithIndex { final int index; final TextEdit edit; - TextEditWithIndex(this.index, this.edit); + new(this.index, this.edit); - TextEditWithIndex.fromUnion( + new fromUnion( this.index, Either3 edit, ) : edit = edit.map((e) => e, (e) => e, (e) => e); @@ -338,7 +338,7 @@ class _Change { final actions = []; final annotations = >{}; - _Change(this.content); + new(this.content); } extension on Range { diff --git a/pkg/analysis_server/test/lsp/completion_dart_test.dart b/pkg/analysis_server/test/lsp/completion_dart_test.dart index e8a7fda35fe..af13ece52a5 100644 --- a/pkg/analysis_server/test/lsp/completion_dart_test.dart +++ b/pkg/analysis_server/test/lsp/completion_dart_test.dart @@ -66,7 +66,7 @@ abstract class AbstractCompletionTest extends AbstractLspAnalysisServerTest late String content; late final TestCode code = TestCode.parseNormalized(content); - AbstractCompletionTest() { + new() { defaultInitializationOptions = { // Default to a high budget for tests because everything is cold and // may take longer to return. diff --git a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart index bdd5218cc67..20b839d4e96 100644 --- a/pkg/analysis_server/test/lsp/semantic_tokens_test.dart +++ b/pkg/analysis_server/test/lsp/semantic_tokens_test.dart @@ -3375,7 +3375,7 @@ class _Token { final SemanticTokenTypes type; final List modifiers; - _Token(this.content, this.type, [this.modifiers = const []]); + new(this.content, this.type, [this.modifiers = const []]); @override int get hashCode => content.hashCode; diff --git a/pkg/analysis_server/test/lsp/temporary_overlay_operation_test.dart b/pkg/analysis_server/test/lsp/temporary_overlay_operation_test.dart index 97386bb949f..b8c19840daa 100644 --- a/pkg/analysis_server/test/lsp/temporary_overlay_operation_test.dart +++ b/pkg/analysis_server/test/lsp/temporary_overlay_operation_test.dart @@ -125,7 +125,7 @@ class TemporaryOverlayOperationTest extends AbstractLspAnalysisServerTest { class _TestTemporaryOverlayOperation extends TemporaryOverlayOperation { final Future Function() operation; - _TestTemporaryOverlayOperation(super.server, this.operation); + new(super.server, this.operation); Future doWork() => pauseSchedulerWithTemporaryOverlays(operation); } diff --git a/pkg/analysis_server/test/lsp_over_legacy/abstract_lsp_over_legacy.dart b/pkg/analysis_server/test/lsp_over_legacy/abstract_lsp_over_legacy.dart index fde0b447053..24fb46eb4ec 100644 --- a/pkg/analysis_server/test/lsp_over_legacy/abstract_lsp_over_legacy.dart +++ b/pkg/analysis_server/test/lsp_over_legacy/abstract_lsp_over_legacy.dart @@ -30,7 +30,7 @@ class EventsCollector { final ContextResolutionTest test; List events = []; - EventsCollector(this.test) { + new(this.test) { test.notificationListener = (notification) { switch (notification.event) { case analysisNotificationErrors: @@ -71,7 +71,7 @@ class EventsPrinter { final ResourceProvider resourceProvider; final TreeStringSink sink; - EventsPrinter({ + new({ required this.configuration, required this.resourceProvider, required this.sink, @@ -131,7 +131,7 @@ abstract class LspOverLegacyTest extends PubPackageAnalysisServerTest final StreamController _notificationsFromServer = StreamController.broadcast(); - LspOverLegacyTest() { + new() { // Ensure the base fields for the tests are populated with the same default // client caapbilities that the server uses. This ensures if a test does not // explicitly set capabilities, they match on the client+server (so we can - diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart index aa834363212..ef2a80f0de5 100644 --- a/pkg/analysis_server/test/mocks.dart +++ b/pkg/analysis_server/test/mocks.dart @@ -62,7 +62,7 @@ class MockProcess implements Process { final _exitCodeCompleter = Completer(); final String _stdout, _stderr; - MockProcess(this._pid, FutureOr exitCode, this._stdout, this._stderr) { + new(this._pid, FutureOr exitCode, this._stdout, this._stderr) { Future.value(exitCode).then(_exitCodeCompleter.complete); } @@ -194,7 +194,7 @@ class _IsResponseFailure extends Matcher { final String _id; final RequestErrorCode? _code; - _IsResponseFailure(this._id, this._code); + new(this._id, this._code); @override Description describe(Description description) { @@ -245,7 +245,7 @@ class _IsResponseFailure extends Matcher { class _IsResponseSuccess extends Matcher { final String _id; - _IsResponseSuccess(this._id); + new(this._id); @override Description describe(Description description) { diff --git a/pkg/analysis_server/test/mocks_lsp.dart b/pkg/analysis_server/test/mocks_lsp.dart index 84ffc650224..596bd099d3e 100644 --- a/pkg/analysis_server/test/mocks_lsp.dart +++ b/pkg/analysis_server/test/mocks_lsp.dart @@ -24,7 +24,7 @@ class MockLspServerChannel implements LspServerCommunicationChannel { /// Warning popups sent to the user. final shownWarnings = []; - MockLspServerChannel(bool printMessages) { + new(bool printMessages) { if (printMessages) { _serverToClient.stream.listen( (message) => print('<== ${jsonEncode(message)}'), diff --git a/pkg/analysis_server/test/search/abstract_search_domain.dart b/pkg/analysis_server/test/search/abstract_search_domain.dart index 3d01f95e4cf..8ee35a1c22e 100644 --- a/pkg/analysis_server/test/search/abstract_search_domain.dart +++ b/pkg/analysis_server/test/search/abstract_search_domain.dart @@ -110,5 +110,5 @@ class _ResultSet { final List results = []; bool done = false; - _ResultSet(this.id); + new(this.id); } diff --git a/pkg/analysis_server/test/services/completion/dart/completion_check.dart b/pkg/analysis_server/test/services/completion/dart/completion_check.dart index 10fbecc60b5..83189309438 100644 --- a/pkg/analysis_server/test/services/completion/dart/completion_check.dart +++ b/pkg/analysis_server/test/services/completion/dart/completion_check.dart @@ -14,7 +14,7 @@ class CompletionResponseForTesting { final bool isIncomplete; final List suggestions; - CompletionResponseForTesting({ + new({ required this.requestOffset, required this.requestLocationName, required this.opTypeLocationName, diff --git a/pkg/analysis_server/test/services/completion/dart/completion_printer.dart b/pkg/analysis_server/test/services/completion/dart/completion_printer.dart index 1cc6c791251..d504e803680 100644 --- a/pkg/analysis_server/test/services/completion/dart/completion_printer.dart +++ b/pkg/analysis_server/test/services/completion/dart/completion_printer.dart @@ -15,7 +15,7 @@ class CompletionResponsePrinter { String _indent = ''; - CompletionResponsePrinter({ + new({ required this.buffer, required this.configuration, required this.response, @@ -419,7 +419,7 @@ class Configuration { bool withSelection; bool Function(CompletionSuggestion suggestion) filter; - Configuration({ + new({ this.sorting = Sorting.relevanceThenCompletionThenKind, this.withDeclaringType = false, this.withDefaultArgumentList = false, diff --git a/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart b/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart index 2a81286f564..58a6d898a17 100644 --- a/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart +++ b/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart @@ -1638,7 +1638,7 @@ class _Context { final bool isExtensionType; final bool isMixin; - _Context({ + new({ this.isClass = false, this.isEnum = false, this.isExtension = false, diff --git a/pkg/analysis_server/test/services/completion/dart/text_expectations.dart b/pkg/analysis_server/test/services/completion/dart/text_expectations.dart index 3c211110102..4c23b66f27f 100644 --- a/pkg/analysis_server/test/services/completion/dart/text_expectations.dart +++ b/pkg/analysis_server/test/services/completion/dart/text_expectations.dart @@ -130,7 +130,7 @@ sealed class _Argument { final class _ArgumentIndex extends _Argument { final int index; - _ArgumentIndex(this.index); + new(this.index); @override Expression get(ArgumentList argumentList) { @@ -146,7 +146,7 @@ class _AssertMethod { final String stackTracePattern; final _Argument argument; - const _AssertMethod({ + const new({ required String className, required this.methodName, required this.argument, @@ -160,7 +160,7 @@ class _File { final CompilationUnit unit; final List<_Replacement> replacements = []; - factory _File(String path) { + factory(String path) { var content = io.File(path).readAsStringSync(); var collection = AnalysisContextCollection( @@ -180,7 +180,7 @@ class _File { ); } - _File._({ + new _({ required this.path, required this.content, required this.lineInfo, @@ -242,7 +242,7 @@ class _InvocationVisitor extends RecursiveAstVisitor { final int requestedLine; MethodInvocation? result; - _InvocationVisitor({required this.lineInfo, required this.requestedLine}); + new({required this.lineInfo, required this.requestedLine}); @override void visitMethodInvocation(MethodInvocation node) { @@ -264,7 +264,7 @@ class _Replacement { final int end; final String text; - _Replacement(this.offset, this.end, this.text); + new(this.offset, this.end, this.text); } extension on AstNode { diff --git a/pkg/analysis_server/test/services/snippets/snippet_manager_test.dart b/pkg/analysis_server/test/services/snippets/snippet_manager_test.dart index b14b9135c8f..f1f9af1f734 100644 --- a/pkg/analysis_server/test/services/snippets/snippet_manager_test.dart +++ b/pkg/analysis_server/test/services/snippets/snippet_manager_test.dart @@ -96,7 +96,7 @@ class SnippetManagerTest extends AbstractSingleUnitTest { /// A snippet producer that always returns `false` from [isValid] and throws /// if [compute] is called. class _NotValidSnippetProducer extends SnippetProducer { - _NotValidSnippetProducer._(super.request); + new _(super.request); @override String get snippetPrefix => 'invalid'; @@ -122,13 +122,13 @@ class _TestDartSnippetManager extends DartSnippetManager { @override final Map> producerGenerators; - _TestDartSnippetManager(this.producerGenerators); + new(this.producerGenerators); } /// A snippet producer that always returns `true` from [isValid] and a simple /// snippet from [compute]. class _ValidSnippetProducer extends SnippetProducer { - _ValidSnippetProducer._(super.request); + new _(super.request); @override String get snippetPrefix => 'mysnip'; diff --git a/pkg/analysis_server/test/services/user_prompts/dart_fix_prompt_manager_test.dart b/pkg/analysis_server/test/services/user_prompts/dart_fix_prompt_manager_test.dart index 21928dd2eae..d9a514f39d2 100644 --- a/pkg/analysis_server/test/services/user_prompts/dart_fix_prompt_manager_test.dart +++ b/pkg/analysis_server/test/services/user_prompts/dart_fix_prompt_manager_test.dart @@ -317,7 +317,7 @@ class TestDartFixPromptManager extends DartFixPromptManager { Future bulkFixesAvailableOverride = Future.value(true); - TestDartFixPromptManager(super.server, super.preferences); + new(super.server, super.preferences); @override Future bulkFixesAvailable(CancellationToken token) { @@ -388,7 +388,7 @@ class TestServer implements LspAnalysisServer { String? respondToPromptWithAction; - TestServer(this.instrumentationService); + new(this.instrumentationService); ExecuteCommandParams get lastCommandParams => (executeCommandHandler as TestExecuteCommandHandler).lastParams!; diff --git a/pkg/analysis_server/test/services/user_prompts/preferences_test.dart b/pkg/analysis_server/test/services/user_prompts/preferences_test.dart index fab57df8950..114126fecab 100644 --- a/pkg/analysis_server/test/services/user_prompts/preferences_test.dart +++ b/pkg/analysis_server/test/services/user_prompts/preferences_test.dart @@ -108,7 +108,7 @@ class _OptionalStateResourceProvider implements ResourceProvider { final ResourceProvider _provider; - _OptionalStateResourceProvider(this._provider); + new(this._provider); @override Context get pathContext => _provider.pathContext; diff --git a/pkg/analysis_server/test/services/user_prompts/survey_manager_test.dart b/pkg/analysis_server/test/services/user_prompts/survey_manager_test.dart index db9b61521ed..c3dca2240fd 100644 --- a/pkg/analysis_server/test/services/user_prompts/survey_manager_test.dart +++ b/pkg/analysis_server/test/services/user_prompts/survey_manager_test.dart @@ -199,7 +199,7 @@ class TestServer implements AnalysisServer { bool supportsOpenUri = true; - TestServer(this.instrumentationService); + new(this.instrumentationService); @override OpenUriNotificationSender? get openUriNotificationSender => @@ -227,7 +227,7 @@ class TestServer implements AnalysisServer { class TestSurveyManager extends SurveyManager { int numberOfChecksPerformed = 0; - TestSurveyManager( + new( super.server, super.instrumentationService, super.analytics, { diff --git a/pkg/analysis_server/test/shared/shared_code_actions_assists_tests.dart b/pkg/analysis_server/test/shared/shared_code_actions_assists_tests.dart index 25c1fa4ffae..9cf23f443bf 100644 --- a/pkg/analysis_server/test/shared/shared_code_actions_assists_tests.dart +++ b/pkg/analysis_server/test/shared/shared_code_actions_assists_tests.dart @@ -476,7 +476,7 @@ void f() { class _RawParams extends ToJsonable { final String _json; - _RawParams(this._json); + new(this._json); @override Object toJson() => jsonDecode(_json) as Object; diff --git a/pkg/analysis_server/test/shared/shared_code_actions_fixes_tests.dart b/pkg/analysis_server/test/shared/shared_code_actions_fixes_tests.dart index 00ea2f4bc66..ea30e2bbf0c 100644 --- a/pkg/analysis_server/test/shared/shared_code_actions_fixes_tests.dart +++ b/pkg/analysis_server/test/shared/shared_code_actions_fixes_tests.dart @@ -895,7 +895,7 @@ class _DeprecatedCamelCaseTypes extends AnalysisRule { uniqueName: 'LintCode.camel_case_types', ); - _DeprecatedCamelCaseTypes() + new() : super( name: 'camel_case_types', state: RuleState.deprecated(), diff --git a/pkg/analysis_server/test/shared/shared_dtd_tests.dart b/pkg/analysis_server/test/shared/shared_dtd_tests.dart index 6391863a842..aa9a18bfc9d 100644 --- a/pkg/analysis_server/test/shared/shared_dtd_tests.dart +++ b/pkg/analysis_server/test/shared/shared_dtd_tests.dart @@ -29,7 +29,7 @@ const lspStreamName = 'Lsp'; class DtdHelper with LspRequestHelpersMixin { final DartToolingDaemon connection; - DtdHelper(this.connection); + new(this.connection); @override Future expectSuccessfulResponseTo( diff --git a/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart b/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart index 7980474dee4..aeaa92cc788 100644 --- a/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart +++ b/pkg/analysis_server/test/src/analytics/analytics_manager_test.dart @@ -581,36 +581,36 @@ class _ExpectedEvent { final DashEvent eventName; final Map? eventData; - _ExpectedEvent(this.eventName, this.eventData); + new(this.eventName, this.eventData); - _ExpectedEvent.analysisStatistics({Map? eventData}) + new analysisStatistics({Map? eventData}) : this(DashEvent.analysisStatistics, eventData); - _ExpectedEvent.commandExecuted({Map? eventData}) + new commandExecuted({Map? eventData}) : this(DashEvent.commandExecuted, eventData); - _ExpectedEvent.contextStructure({Map? eventData}) + new contextStructure({Map? eventData}) : this(DashEvent.contextStructure, eventData); - _ExpectedEvent.lintUsageCount({Map? eventData}) + new lintUsageCount({Map? eventData}) : this(DashEvent.lintUsageCount, eventData); - _ExpectedEvent.notification({Map? eventData}) + new notification({Map? eventData}) : this(DashEvent.clientNotification, eventData); - _ExpectedEvent.pluginRequest({Map? eventData}) + new pluginRequest({Map? eventData}) : this(DashEvent.pluginRequest, eventData); - _ExpectedEvent.pluginUse({Map? eventData}) + new pluginUse({Map? eventData}) : this(DashEvent.pluginUse, eventData); - _ExpectedEvent.request({Map? eventData}) + new request({Map? eventData}) : this(DashEvent.clientRequest, eventData); - _ExpectedEvent.session({Map? eventData}) + new session({Map? eventData}) : this(DashEvent.serverSession, eventData); - _ExpectedEvent.severityAdjustment({Map? eventData}) + new severityAdjustment({Map? eventData}) : this(DashEvent.severityAdjustment, eventData); /// Compare the expected event with the [actual] event, failing if the actual @@ -666,7 +666,7 @@ class _ExpectedEvent { /// A matcher for strings containing positive integer values. class _IsPercentiles extends Matcher { - const _IsPercentiles(); + const new(); @override Description describe(Description description) => @@ -694,7 +694,7 @@ class _IsPercentiles extends Matcher { /// A matcher for strings containing positive integer values. class _IsPositiveInt extends Matcher { - const _IsPositiveInt(); + const new(); @override Description describe(Description description) => @@ -710,7 +710,7 @@ class _IsPositiveInt extends Matcher { class _MockAnalytics implements NoOpAnalytics { List events = []; - _MockAnalytics(); + new(); @override Map get parsedTools => throw UnimplementedError(); diff --git a/pkg/analysis_server/test/src/cider/assists_test.dart b/pkg/analysis_server/test/src/cider/assists_test.dart index 196de562b36..a80e16c8d50 100644 --- a/pkg/analysis_server/test/src/cider/assists_test.dart +++ b/pkg/analysis_server/test/src/cider/assists_test.dart @@ -149,5 +149,5 @@ class _CorrectionContext { final int line; final int character; - _CorrectionContext(this.content, this.offset, this.line, this.character); + new(this.content, this.offset, this.line, this.character); } diff --git a/pkg/analysis_server/test/src/cider/completion_test.dart b/pkg/analysis_server/test/src/cider/completion_test.dart index e0d897b1b6f..b80b481c7de 100644 --- a/pkg/analysis_server/test/src/cider/completion_test.dart +++ b/pkg/analysis_server/test/src/cider/completion_test.dart @@ -880,5 +880,5 @@ class _CompletionContext { final int line; final int character; - _CompletionContext(this.content, this.offset, this.line, this.character); + new(this.content, this.offset, this.line, this.character); } diff --git a/pkg/analysis_server/test/src/cider/fixes_test.dart b/pkg/analysis_server/test/src/cider/fixes_test.dart index eac6ebb1c75..01cbfb227ec 100644 --- a/pkg/analysis_server/test/src/cider/fixes_test.dart +++ b/pkg/analysis_server/test/src/cider/fixes_test.dart @@ -245,5 +245,5 @@ class _CorrectionContext { final int line; final int character; - _CorrectionContext(this.content, this.offset, this.line, this.character); + new(this.content, this.offset, this.line, this.character); } diff --git a/pkg/analysis_server/test/src/cider/rename_test.dart b/pkg/analysis_server/test/src/cider/rename_test.dart index ef0e33857ab..ba528e574ed 100644 --- a/pkg/analysis_server/test/src/cider/rename_test.dart +++ b/pkg/analysis_server/test/src/cider/rename_test.dart @@ -1190,5 +1190,5 @@ class _CorrectionContext { final int line; final int character; - _CorrectionContext(this.content, this.offset, this.line, this.character); + new(this.content, this.offset, this.line, this.character); } diff --git a/pkg/analysis_server/test/src/cider/signature_help_test.dart b/pkg/analysis_server/test/src/cider/signature_help_test.dart index d9ed88344d9..d6f347b8cf4 100644 --- a/pkg/analysis_server/test/src/cider/signature_help_test.dart +++ b/pkg/analysis_server/test/src/cider/signature_help_test.dart @@ -227,5 +227,5 @@ class _CorrectionContext { final int line; final int character; - _CorrectionContext(this.content, this.offset, this.line, this.character); + new(this.content, this.offset, this.line, this.character); } diff --git a/pkg/analysis_server/test/src/plugin/plugin_isolate_test.dart b/pkg/analysis_server/test/src/plugin/plugin_isolate_test.dart index 6bbfe1adf57..8ef6b2eff6c 100644 --- a/pkg/analysis_server/test/src/plugin/plugin_isolate_test.dart +++ b/pkg/analysis_server/test/src/plugin/plugin_isolate_test.dart @@ -299,7 +299,7 @@ class TestServerCommunicationChannel implements ServerCommunicationChannel { int closeCount = 0; List sentRequests = []; - TestServerCommunicationChannel(this.session) { + new(this.session) { session.channel = this; } diff --git a/pkg/analysis_server/test/src/services/completion/yaml/analysis_options_generator_test.dart b/pkg/analysis_server/test/src/services/completion/yaml/analysis_options_generator_test.dart index eb52e5a051b..df62a86d412 100644 --- a/pkg/analysis_server/test/src/services/completion/yaml/analysis_options_generator_test.dart +++ b/pkg/analysis_server/test/src/services/completion/yaml/analysis_options_generator_test.dart @@ -356,7 +356,7 @@ class InternalRule extends AnalysisRule { uniqueName: 'LintCode.internal_rule', ); - InternalRule() + new() : super( name: 'internal_lint', state: RuleState.internal(), diff --git a/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart b/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart index 22aa5463130..b59f6942c82 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart @@ -25,7 +25,7 @@ class DeprecatedRule extends AnalysisRule { uniqueName: 'LintCode.deprecated_rule', ); - DeprecatedRule() + new() : super( name: 'deprecated_rule', description: '', diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_test.dart index 2b219b97e90..712d00cb824 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_test.dart @@ -1415,9 +1415,9 @@ class _Element { final List components; final String declaration; - _Element(this.kind, this.components, this.declaration); + new(this.kind, this.components, this.declaration); - factory _Element.class_({bool isDeprecated = false, bool isOld = false}) { + factory class_({bool isDeprecated = false, bool isOld = false}) { var name = isOld ? 'C_old' : 'C_new'; var annotation = _annotation(isDeprecated: isDeprecated, isTopLevel: true); return _Element( @@ -1428,7 +1428,7 @@ ${annotation}class $name {}''', ); } - factory _Element.constant({bool isDeprecated = false, bool isOld = false}) { + factory constant({bool isDeprecated = false, bool isOld = false}) { var enumName = isOld ? 'E_old' : 'E_new'; var constantName = isOld ? 'c_old' : 'c_new'; var annotation = _annotation(isDeprecated: isDeprecated); @@ -1442,10 +1442,7 @@ enum $enumName { ); } - factory _Element.defaultConstructor({ - bool isDeprecated = false, - bool isOld = false, - }) { + factory defaultConstructor({bool isDeprecated = false, bool isOld = false}) { var className = isOld ? 'C_old' : 'C_new'; var annotation = _annotation(isDeprecated: isDeprecated); return _Element( @@ -1458,7 +1455,7 @@ class $className { ); } - factory _Element.enum_({bool isDeprecated = false, bool isOld = false}) { + factory enum_({bool isDeprecated = false, bool isOld = false}) { var enumName = isOld ? 'E_old' : 'E_new'; var constantName = isOld ? 'c_old' : 'c_new'; var annotation = _annotation(isDeprecated: isDeprecated, isTopLevel: true); @@ -1470,7 +1467,7 @@ ${annotation}enum $enumName { $constantName }''', ); } - factory _Element.extensionType({ + factory extensionType({ bool isDeprecated = false, bool isOld = false, String representationType = 'int', @@ -1492,7 +1489,7 @@ ${annotation}extension type $constPrefix$name$constructorPart {}''', ); } - factory _Element.field({ + factory field({ bool isDeprecated = false, bool isOld = false, bool isStatic = false, @@ -1511,7 +1508,7 @@ class $className { ); } - factory _Element.getter({ + factory getter({ bool isDeprecated = false, bool isOld = false, bool isStatic = false, @@ -1530,7 +1527,7 @@ class $className { ); } - factory _Element.method({ + factory method({ bool isDeprecated = false, bool isOld = false, bool isStatic = false, @@ -1549,7 +1546,7 @@ class $className { ); } - factory _Element.mixin({bool isDeprecated = false, bool isOld = false}) { + factory mixin({bool isDeprecated = false, bool isOld = false}) { var name = isOld ? 'M_old' : 'M_new'; var annotation = _annotation(isDeprecated: isDeprecated, isTopLevel: true); return _Element( @@ -1560,10 +1557,7 @@ ${annotation}mixin $name {}''', ); } - factory _Element.namedConstructor({ - bool isDeprecated = false, - bool isOld = false, - }) { + factory namedConstructor({bool isDeprecated = false, bool isOld = false}) { var constructorName = isOld ? 'c_old' : 'c_new'; var className = isOld ? 'C_old' : 'C_new'; var annotation = _annotation(isDeprecated: isDeprecated); @@ -1577,7 +1571,7 @@ class $className { ); } - factory _Element.setter({ + factory setter({ bool isDeprecated = false, bool isOld = false, bool isStatic = false, @@ -1596,10 +1590,7 @@ class $className { ); } - factory _Element.topLevelFunction({ - bool isDeprecated = false, - bool isOld = false, - }) { + factory topLevelFunction({bool isDeprecated = false, bool isOld = false}) { var name = isOld ? 'f_old' : 'f_new'; var annotation = _annotation(isDeprecated: isDeprecated, isTopLevel: true); return _Element( @@ -1610,10 +1601,7 @@ ${annotation}int $name() => 0;''', ); } - factory _Element.topLevelGetter({ - bool isDeprecated = false, - bool isOld = false, - }) { + factory topLevelGetter({bool isDeprecated = false, bool isOld = false}) { var getterName = isOld ? 'g_old' : 'g_new'; var annotation = _annotation(isDeprecated: isDeprecated); return _Element( @@ -1624,10 +1612,7 @@ ${annotation}int get $getterName => 0;''', ); } - factory _Element.topLevelSetter({ - bool isDeprecated = false, - bool isOld = false, - }) { + factory topLevelSetter({bool isDeprecated = false, bool isOld = false}) { var setterName = isOld ? 's_old' : 's_new'; var annotation = _annotation(isDeprecated: isDeprecated); return _Element( @@ -1638,10 +1623,7 @@ ${annotation}set $setterName(int v) {}''', ); } - factory _Element.topLevelVariable({ - bool isDeprecated = false, - bool isOld = false, - }) { + factory topLevelVariable({bool isDeprecated = false, bool isOld = false}) { var name = isOld ? 'v_old' : 'v_new'; var annotation = _annotation(isDeprecated: isDeprecated, isTopLevel: true); return _Element( @@ -1652,7 +1634,7 @@ ${annotation}int $name = 0;''', ); } - factory _Element.typedef({ + factory typedef({ bool isDeprecated = false, bool isOld = false, String aliasedType = 'int Function()', diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_type_test.dart index 717cb5f49dc..99df6a644e3 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_type_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/replaced_by_type_test.dart @@ -505,7 +505,7 @@ enum TypeKind { // Single character used to represent the type in constructed names. final String char; - const TypeKind(this.name, this.char); + new(this.name, this.char); bool get canBeClassInterface => this == classKind || this == mixinKind || this == typedefKind; diff --git a/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart b/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart index f5ea6c18b14..2aefd9eb941 100644 --- a/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart +++ b/pkg/analysis_server/test/src/utilities/extensions/range_factory_test.dart @@ -992,7 +992,7 @@ class _NodesCollector extends UnifyingAstVisitor { final bool Function(AstNode) filter; final List _nodes = []; - _NodesCollector(this.filter); + new(this.filter); @override void visitNode(AstNode node) { diff --git a/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart b/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart index 97dec66abd7..ac427e835d6 100644 --- a/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart +++ b/pkg/analysis_server/test/src/utilities/import_analyzer_test.dart @@ -1048,7 +1048,7 @@ abstract class ImportAnalyzerTest extends PubPackageAnalysisServerTest { class _ExpectedElement { final String name; - _ExpectedElement({required this.name}); + new({required this.name}); void assertMatches(Element element) { expect(element, isA()); diff --git a/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart b/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart index 06ebd32dac0..0adbc609127 100644 --- a/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart +++ b/pkg/analysis_server/test/src/utilities/selection_coverage_test.dart @@ -21,7 +21,7 @@ void main() { class AstImplData { final List instantiableInterfaces = []; - AstImplData(); + new(); } class AstInterfaceData { @@ -33,7 +33,7 @@ class AstInterfaceData { /// in that class that return a `NodeList`. final Map> declaredLists = {}; - AstInterfaceData(); + new(); List nodeListsFor(ClassElement class_) { var lists = []; @@ -269,13 +269,13 @@ class SelectionCoverageTest { class SelectionData { final Map> visitedLists = {}; - SelectionData(); + new(); } class VisitMethodVisitor extends RecursiveAstVisitor { List visitedLists = []; - VisitMethodVisitor(); + new(); @override void visitMethodInvocation(MethodInvocation node) { diff --git a/pkg/analysis_server/test/src/utilities/selection_test.dart b/pkg/analysis_server/test/src/utilities/selection_test.dart index ae15924c559..794026e032c 100644 --- a/pkg/analysis_server/test/src/utilities/selection_test.dart +++ b/pkg/analysis_server/test/src/utilities/selection_test.dart @@ -1456,5 +1456,5 @@ class _CodeSelection { final TestCode testCode; final Selection selection; - _CodeSelection({required this.testCode, required this.selection}); + new({required this.testCode, required this.selection}); } diff --git a/pkg/analysis_server/test/stress/completion/completion_runner.dart b/pkg/analysis_server/test/stress/completion/completion_runner.dart index 95239faa51e..48d1859cbb2 100644 --- a/pkg/analysis_server/test/stress/completion/completion_runner.dart +++ b/pkg/analysis_server/test/stress/completion/completion_runner.dart @@ -37,7 +37,7 @@ class CompletionRunner { bool deleteBeforeCompletion = false; /// Initialize a newly created completion runner. - CompletionRunner({ + new({ StringSink? output, bool? printMissing, bool? printQuality, diff --git a/pkg/analysis_server/test/stress/replay/operation.dart b/pkg/analysis_server/test/stress/replay/operation.dart index 515f1ea418b..497f9e67ed1 100644 --- a/pkg/analysis_server/test/stress/replay/operation.dart +++ b/pkg/analysis_server/test/stress/replay/operation.dart @@ -17,7 +17,7 @@ class Analysis_UpdateContent extends ServerOperation { /// Initialize an operation to send an 'analysis.updateContent' request with /// the given [filePath] and [overlay] as parameters. - Analysis_UpdateContent(this.filePath, this.overlay); + new(this.filePath, this.overlay); @override void perform(Server server) { diff --git a/pkg/analysis_server/test/stress/replay/replay.dart b/pkg/analysis_server/test/stress/replay/replay.dart index aae4c1ec16b..fdcbc642844 100644 --- a/pkg/analysis_server/test/stress/replay/replay.dart +++ b/pkg/analysis_server/test/stress/replay/replay.dart @@ -113,7 +113,7 @@ class Driver { /// The logger to which verbose logging data will be written. late Logger _logger; - Driver._({ + new _({ required this._overlayStyle, required this._repositoryPath, required this._analysisRoots, @@ -503,7 +503,7 @@ class FileEdit { /// Initialize a collection of edits to be associated with the file at the /// given [filePath]. - FileEdit(this.overlayStyle, DiffRecord record) { + new(this.overlayStyle, DiffRecord record) { filePath = record.srcPath!; if (record.isAddition) { content = ''; @@ -576,7 +576,7 @@ class Statistics { int editCount = 0; /// Initialize a newly created set of statistics. - Statistics(this.driver); + new(this.driver); /// Print the statistics to [stdout]. void print() { diff --git a/pkg/analysis_server/test/stress/utilities/git.dart b/pkg/analysis_server/test/stress/utilities/git.dart index c64dd3e6551..9e0ceb35c9c 100644 --- a/pkg/analysis_server/test/stress/utilities/git.dart +++ b/pkg/analysis_server/test/stress/utilities/git.dart @@ -27,7 +27,7 @@ class BlobDiff { /// command (the [input]). /// /// This is only intended to be invoked from [GitRepository.getBlobDiff]. - BlobDiff._(List input) { + new _(List input) { _parseInput(input); } @@ -79,7 +79,7 @@ class CommitDelta { /// command (the [diffResults]). /// /// This is only intended to be invoked from [GitRepository.getBlobDiff]. - CommitDelta._(this.repository, String diffResults) { + new _(this.repository, String diffResults) { _parseInput(diffResults); } @@ -213,7 +213,7 @@ class DiffHunk { /// Initialize a newly created hunk. The lines will be added after the object /// has been created. - DiffHunk(this.diffSrcLine, this.diffDstLine); + new(this.diffSrcLine, this.diffDstLine); /// Return the index of the first line that was changed in the dst. Unlike the /// [diffDstLine] field, this getter adjusts the line number to be consistent @@ -264,7 +264,7 @@ class DiffRecord { final String? dstPath; /// Initialize a newly created diff record. - DiffRecord( + new( this.repository, this.srcBlob, this.dstBlob, @@ -320,7 +320,7 @@ class GitRepository { /// the given [path]. /// /// If a [commandSink] is provided, any calls to git will be written to it. - GitRepository(this.path, {this.logger}); + new(this.path, {this.logger}); /// Checkout the given [commit] from the repository. This is done by running /// the command `git checkout `. @@ -389,7 +389,7 @@ class LinearCommitHistory { /// Initialize a commit history for the given [repository] to have the given /// [commitIds]. - LinearCommitHistory(this.repository, this.commitIds); + new(this.repository, this.commitIds); /// Return an iterator that can be used to iterate over this commit history. LinearCommitHistoryIterator iterator() { @@ -407,7 +407,7 @@ class LinearCommitHistoryIterator { /// Initialize a newly created iterator to iterate over the commits with the /// given [commitIds]; - LinearCommitHistoryIterator(this.history) { + new(this.history) { currentCommit = history.commitIds.length; } diff --git a/pkg/analysis_server/test/stress/utilities/logger.dart b/pkg/analysis_server/test/stress/utilities/logger.dart index 8e1d93739ff..2a80912221a 100644 --- a/pkg/analysis_server/test/stress/utilities/logger.dart +++ b/pkg/analysis_server/test/stress/utilities/logger.dart @@ -14,7 +14,7 @@ class Logger { final StringSink sink; /// Initialize a newly created logger to write to the given [sink]. - Logger(this.sink); + new(this.sink); /// Log the given information. /// diff --git a/pkg/analysis_server/test/stress/utilities/server.dart b/pkg/analysis_server/test/stress/utilities/server.dart index 4f8e7ec2c94..55e8633a116 100644 --- a/pkg/analysis_server/test/stress/utilities/server.dart +++ b/pkg/analysis_server/test/stress/utilities/server.dart @@ -29,11 +29,11 @@ class ErrorMap { HashMap>(); /// Initialize a newly created error map. - ErrorMap(); + new(); /// Initialize a newly created error map to contain the same mapping as the /// given [errorMap]. - ErrorMap.from(ErrorMap errorMap) { + new from(ErrorMap errorMap) { pathMap.addAll(errorMap.pathMap); } @@ -67,7 +67,7 @@ class RequestData { Completer? _responseCompleter; /// Initialize a newly created set of request data. - RequestData(this.id, this.method, this.params, this.requestTime); + new(this.id, this.method, this.params, this.requestTime); /// Return the number of milliseconds that elapsed between the request and the /// response. This getter assumes that the response was received. @@ -160,7 +160,7 @@ class Server { /// /// If a [logger] is provided, the communications between the client (this /// test) and the server will be written to it. - Server({this.logger}); + new({this.logger}); /// Return a future that will complete when a 'server.status' notification is /// received from the server with 'analyzing' set to false. diff --git a/pkg/analysis_server/test/timing/completion/completion_simple.dart b/pkg/analysis_server/test/timing/completion/completion_simple.dart index 7abac78e47a..de6bfc88ad6 100644 --- a/pkg/analysis_server/test/timing/completion/completion_simple.dart +++ b/pkg/analysis_server/test/timing/completion/completion_simple.dart @@ -38,7 +38,7 @@ class SimpleTest extends TimingTest { late int cursorOffset; /// Initialize a newly created test. - SimpleTest(); + new(); @override Future oneTimeSetUp() { diff --git a/pkg/analysis_server/test/timing/timing_framework.dart b/pkg/analysis_server/test/timing/timing_framework.dart index 23cfe95fdd7..b4860f16cc9 100644 --- a/pkg/analysis_server/test/timing/timing_framework.dart +++ b/pkg/analysis_server/test/timing/timing_framework.dart @@ -21,7 +21,7 @@ class TimingResult { List times; /// Initialize a newly created timing result. - TimingResult(this.times); + new(this.times); /// The average amount of time spent executing a single iteration, in /// milliseconds. diff --git a/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart b/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart index 349c8cf3c5f..18a0816de8c 100644 --- a/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart +++ b/pkg/analysis_server/test/tool/completion_metrics/metrics_util_test.dart @@ -244,7 +244,7 @@ class _DoubleEquals extends Matcher { final double _value; final int fractionDigits = 10; - const _DoubleEquals(this._value); + const new(this._value); @override Description describe(Description description) => diff --git a/pkg/analysis_server/test/tool/lsp_spec/matchers.dart b/pkg/analysis_server/test/tool/lsp_spec/matchers.dart index c0e3955cdaa..dc1ed422bb0 100644 --- a/pkg/analysis_server/test/tool/lsp_spec/matchers.dart +++ b/pkg/analysis_server/test/tool/lsp_spec/matchers.dart @@ -31,7 +31,7 @@ Matcher isSimpleType(String name) => SimpleTypeMatcher(name); class ArrayTypeMatcher extends Matcher { final Matcher _elementTypeMatcher; - const ArrayTypeMatcher(this._elementTypeMatcher); + const new(this._elementTypeMatcher); @override Description describe(Description description) => @@ -66,7 +66,7 @@ class ArrayTypeMatcher extends Matcher { class LiteralTypeMatcher extends Matcher { final Matcher _typeMatcher; final String _value; - LiteralTypeMatcher(this._typeMatcher, this._value); + new(this._typeMatcher, this._value); @override Description describe(Description description) => description @@ -84,7 +84,7 @@ class LiteralTypeMatcher extends Matcher { class MapTypeMatcher extends Matcher { final Matcher _indexMatcher, _valueMatcher; - const MapTypeMatcher(this._indexMatcher, this._valueMatcher); + const new(this._indexMatcher, this._valueMatcher); @override Description describe(Description description) => description @@ -103,7 +103,7 @@ class MapTypeMatcher extends Matcher { class SimpleTypeMatcher extends Matcher { final String _expectedName; - const SimpleTypeMatcher(this._expectedName); + const new(this._expectedName); @override Description describe(Description description) => diff --git a/pkg/analysis_server/test/utils/test_support.dart b/pkg/analysis_server/test/utils/test_support.dart index 0244592a63e..8733eb50c55 100644 --- a/pkg/analysis_server/test/utils/test_support.dart +++ b/pkg/analysis_server/test/utils/test_support.dart @@ -29,7 +29,7 @@ class ExpectedContextMessage { /// The message text for the error. final String? text; - ExpectedContextMessage(this.filePath, this.offset, this.length, {this.text}); + new(this.filePath, this.offset, this.length, {this.text}); /// Return `true` if the [message] matches this description of what the state /// of the [message] is expected to be. @@ -68,7 +68,7 @@ class ExpectedError { final List expectedContextMessages; /// Initialize a newly created error description. - ExpectedError( + new( this.code, this.offset, this.length, { @@ -127,7 +127,7 @@ class GatheringDiagnosticListener implements DiagnosticListener { final Map _lineInfoMap = {}; /// Initialize a newly created diagnostic listener to collect diagnostics. - GatheringDiagnosticListener({this.checkRanges = true}); + new({this.checkRanges = true}); /// The diagnostics that were collected. List get diagnostics => _diagnostics; diff --git a/pkg/analysis_server/test/verify_tests_test.dart b/pkg/analysis_server/test/verify_tests_test.dart index 0f29d6e32d8..a99cda0f191 100644 --- a/pkg/analysis_server/test/verify_tests_test.dart +++ b/pkg/analysis_server/test/verify_tests_test.dart @@ -20,7 +20,7 @@ void main() { } class _VerifyTests extends VerifyTests { - _VerifyTests(super.testDirPath, {super.excludedPaths}); + new(super.testDirPath, {super.excludedPaths}); @override bool isExpensive(Resource resource) { diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/benchmark_utils.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/benchmark_utils.dart index 023be2e5629..e8893be6157 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/benchmark_utils.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/benchmark_utils.dart @@ -252,7 +252,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class RunDetails { @@ -265,7 +265,7 @@ class RunDetails { final List orderedFileCopies; final int numFiles; - RunDetails({ + new({ required this.libDirUri, required this.mainFile, required this.mainFileTypingContent, diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart index 6fd69d84d3f..e161e40b6ea 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart @@ -112,7 +112,7 @@ abstract class AbstractScanner { int recoveryCount = 0; final bool allowLazyStrings; - AbstractScanner( + new( ScannerConfiguration? config, this.includeComments, this.languageVersionChanged, { @@ -125,7 +125,7 @@ abstract class AbstractScanner { this.configuration = config; } - AbstractScanner.recoveryOptionScanner(AbstractScanner copyFrom) + new recoveryOptionScanner(AbstractScanner copyFrom) : lineStarts = [], includeComments = false, languageVersionChanged = null, @@ -2077,8 +2077,7 @@ class LineStarts extends Object with ListMixin { List array; int arrayLength = 0; - LineStarts(int numberOfBytesHint) - : array = _createInitialArray(numberOfBytesHint) { + new(int numberOfBytesHint) : array = _createInitialArray(numberOfBytesHint) { // The first line starts at character offset 0. add(/* value = */ 0); } @@ -2168,7 +2167,7 @@ class ScannerConfiguration { /// If `true`, 'augment' is treated as a built-in identifier. final bool forAugmentationLibrary; - const ScannerConfiguration({ + const new({ this.enableTripleShift = false, this.forAugmentationLibrary = false, }); diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link.dart index 6ba6499c5cd..c6054f925d8 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link.dart @@ -8,7 +8,7 @@ import 'link_implementation.dart' show LinkBuilderImplementation, LinkEntry, LinkIterator, MappedLinkIterable; class Link implements Iterable { - const Link(); + const new(); // TODO(ahe): Remove this method? @override T get first { @@ -187,7 +187,7 @@ class Link implements Iterable { /// Builder object for creating linked lists using [Link] or fixed-length [List] /// objects. abstract class LinkBuilder { - factory LinkBuilder() = LinkBuilderImplementation; + factory() = LinkBuilderImplementation; /// Returns the first element in the list being built. T get first; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart index 1132fb0cf05..5f1ce9a6818 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart @@ -16,7 +16,7 @@ class LinkBuilderImplementation implements LinkBuilder { @override int length = 0; - LinkBuilderImplementation(); + new(); @override T get first { @@ -83,7 +83,7 @@ class LinkEntry extends Link { @override Link tail; - LinkEntry(this.head, [Link? tail]) : tail = tail ?? const Link(); + new(this.head, [Link? tail]) : tail = tail ?? const Link(); @override int get hashCode => throw new UnsupportedError('LinkEntry.hashCode'); @@ -185,7 +185,7 @@ class LinkIterator implements Iterator { T? _current; Link _link; - LinkIterator(this._link); + new(this._link); @override T get current => _current!; @@ -206,7 +206,7 @@ class MappedLinkIterable extends IterableBase { Transformation _transformation; Link _link; - MappedLinkIterable(this._link, this._transformation); + new(this._link, this._transformation); @override Iterator get iterator { @@ -219,7 +219,7 @@ class MappedLinkIterator implements Iterator { Link _link; T? _current; - MappedLinkIterator(this._link, this._transformation); + new(this._link, this._transformation); @override T get current => _current!; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/token.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/token.dart index c319da29aee..91d8230090b 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/token.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/token.dart @@ -310,7 +310,7 @@ class BeginToken extends SimpleToken { * Initialize a newly created token to have the given [type] at the given * [offset]. */ - BeginToken(TokenType type, int offset, [CommentToken? precedingComment]) + new(TokenType type, int offset, [CommentToken? precedingComment]) : super(type, offset, precedingComment) { assert( type == TokenType.LT || @@ -345,7 +345,7 @@ class CommentToken extends StringToken { * Initialize a newly created token to represent a token of the given [type] * with the given [value] at the given [offset]. */ - CommentToken(super.type, super.value, super.offset); + new(super.type, super.value, super.offset); } /** @@ -356,7 +356,7 @@ class DocumentationCommentToken extends CommentToken { * Initialize a newly created token to represent a token of the given [type] * with the given [value] at the given [offset]. */ - DocumentationCommentToken(super.type, super.value, super.offset); + new(super.type, super.value, super.offset); } /** @@ -983,7 +983,7 @@ class Keyword extends TokenType { /** * Initialize a newly created keyword. */ - const Keyword( + const new( int index, String lexeme, String name, @@ -1045,7 +1045,7 @@ class KeywordToken extends SimpleToken { * Initialize a newly created token to represent the given [keyword] at the * given [offset]. */ - KeywordToken(super.keyword, super.offset, [super.precedingComment]); + new(super.keyword, super.offset, [super.precedingComment]); @override bool get isIdentifier => keyword.isPseudo || keyword.isBuiltIn; @@ -1078,7 +1078,7 @@ class LanguageVersionToken extends CommentToken { */ final int minor; - LanguageVersionToken.from(String text, int offset, this.major, this.minor) + new from(String text, int offset, this.major, this.minor) : super(TokenType.SINGLE_LINE_COMMENT, text, offset); } @@ -1093,8 +1093,7 @@ class ReplacementToken extends SyntheticToken { @override Token? beforeSynthetic; - ReplacementToken(TokenType type, this.replacedToken) - : super(type, replacedToken.offset) { + new(TokenType type, this.replacedToken) : super(type, replacedToken.offset) { precedingComments = replacedToken.precedingComments; } @@ -1132,7 +1131,7 @@ class SimpleToken implements Token { /** * Initialize a newly created token to have the given [type] and [offset]. */ - SimpleToken(TokenType type, int offset, [this._precedingComment]) + new(TokenType type, int offset, [this._precedingComment]) : _typeAndOffset = (((offset + 1) << 8) | type.index) { // See https://github.com/dart-lang/sdk/issues/50048 for details. assert(offset >= -1); @@ -1307,7 +1306,7 @@ class StringToken extends SimpleToken { * Initialize a newly created token to represent a token of the given [type] * with the given [value] at the given [offset]. */ - StringToken(super.type, String value, super.offset, [super.precedingComment]) + new(super.type, String value, super.offset, [super.precedingComment]) : _value = StringUtilities.intern(value); @override @@ -1331,7 +1330,7 @@ class SyntheticBeginToken extends BeginToken { * Initialize a newly created token to have the given [type] at the given * [offset]. */ - SyntheticBeginToken(super.type, super.offset, [super.precedingComment]); + new(super.type, super.offset, [super.precedingComment]); @override bool get isSynthetic => true; @@ -1351,7 +1350,7 @@ class SyntheticKeywordToken extends KeywordToken { * Initialize a newly created token to represent the given [keyword] at the * given [offset]. */ - SyntheticKeywordToken(super.keyword, super.offset); + new(super.keyword, super.offset); @override int get length => 0; @@ -1371,7 +1370,7 @@ class SyntheticStringToken extends StringToken { * with the given [value] at the given [offset]. If the [length] is * not specified, then it defaults to the length of [value]. */ - SyntheticStringToken(super.type, super.value, super.offset, [this._length]); + new(super.type, super.value, super.offset, [this._length]); @override bool get isSynthetic => true; @@ -1387,7 +1386,7 @@ class SyntheticToken extends SimpleToken { @override Token? beforeSynthetic; - SyntheticToken(super.type, super.offset); + new(super.type, super.offset); @override bool get isSynthetic => true; @@ -1406,13 +1405,13 @@ abstract class Token implements SyntacticEntity { /** * Initialize a newly created token to have the given [type] and [offset]. */ - factory Token(TokenType type, int offset, [CommentToken? precedingComment]) = + factory(TokenType type, int offset, [CommentToken? precedingComment]) = SimpleToken; /** * Initialize a newly created end-of-file token to have the given [offset]. */ - factory Token.eof(int offset, [CommentToken? precedingComments]) { + factory eof(int offset, [CommentToken? precedingComments]) { Token eof = new SimpleToken(TokenType.EOF, offset, precedingComments); // EOF points to itself so there's always infinite look-ahead. eof.previous = eof; @@ -1818,7 +1817,7 @@ class TokenClass { * Initialize a newly created class of tokens to have the given [name] and * [precedence]. */ - const TokenClass(this.name, [this.precedence = NO_PRECEDENCE]); + const new(this.name, [this.precedence = NO_PRECEDENCE]); @override String toString() => name; @@ -2783,7 +2782,7 @@ class TokenType { */ final String? stringValue; - const TokenType( + const new( this.index, this.lexeme, this.name, diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_get_fixes_on_error.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_get_fixes_on_error.dart index a2b91d08463..5467bc199f0 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_get_fixes_on_error.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_get_fixes_on_error.dart @@ -27,12 +27,8 @@ class LegacyGetFixesOnErrorBenchmark extends DartLanguageServerBenchmark { final RunDetails runDetails; - LegacyGetFixesOnErrorBenchmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: false); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: false); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart index 2f7cfad499e..3042ce59c75 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart @@ -42,12 +42,8 @@ class LegacyManyFilesInFlutterSetSubscriptionsBenchmark final RunDetails runDetails; - LegacyManyFilesInFlutterSetSubscriptionsBenchmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: false); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: false); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart index 075901abefd..804c99073b9 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart @@ -37,12 +37,8 @@ class LegacyManyGetFixesAndGetAssisstRequestsBenchmark final RunDetails runDetails; - LegacyManyGetFixesAndGetAssisstRequestsBenchmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: false); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: false); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart index f41903162a0..07f4db39937 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart @@ -32,12 +32,8 @@ class LegacyManyHoverRequestsBenchmark extends DartLanguageServerBenchmark { final RunDetails runDetails; - LegacyManyHoverRequestsBenchmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: false); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: false); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_typing_temporary_missing_end_brace.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_typing_temporary_missing_end_brace.dart index 84ba9eaa12c..cf72fb033f5 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_typing_temporary_missing_end_brace.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_typing_temporary_missing_end_brace.dart @@ -36,12 +36,8 @@ class LegacyTypingTemporaryMissingEndBraceBenchmark final RunDetails runDetails; - LegacyTypingTemporaryMissingEndBraceBenchmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: false); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: false); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart index 7ed771bf889..4eef876ea10 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart @@ -31,12 +31,8 @@ class LegacyWithPluginThatTimesOutBencmark extends DartLanguageServerBenchmark { final RunDetails runDetails; - LegacyWithPluginThatTimesOutBencmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: false); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: false); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_completion_after_change.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_completion_after_change.dart index ea99f6d5dc6..db873bbb4a6 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_completion_after_change.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_completion_after_change.dart @@ -28,12 +28,8 @@ class LspCompletionAfterChange extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspCompletionAfterChange( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_typing_temporarily_missing_end_brace_in_string_interpolation.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_typing_temporarily_missing_end_brace_in_string_interpolation.dart index 6266a469c69..0b75e1e3a17 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_typing_temporarily_missing_end_brace_in_string_interpolation.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_typing_temporarily_missing_end_brace_in_string_interpolation.dart @@ -41,12 +41,8 @@ class LSPTypingTemporaryMissingEndBraceInterpolationBenchmark final RunDetails runDetails; - LSPTypingTemporaryMissingEndBraceInterpolationBenchmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_with_plugin_that_times_out.dart b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_with_plugin_that_times_out.dart index d990a0df1e4..6a5e9c05cc7 100644 --- a/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_with_plugin_that_times_out.dart +++ b/pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_with_plugin_that_times_out.dart @@ -31,12 +31,8 @@ class LspWithPluginThatTimesOutBencmark extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspWithPluginThatTimesOutBencmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; diff --git a/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart b/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart index 620d858e44c..cca4edb43a3 100644 --- a/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart +++ b/pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart @@ -39,7 +39,7 @@ abstract class DartLanguageServerBenchmark { final bool _lsp; - DartLanguageServerBenchmark(List args, {required bool useLspProtocol}) + new(List args, {required bool useLspProtocol}) : _lsp = useLspProtocol, executableToUse = extractDartParamOrDefault(args) { _checkCorrectDart(); @@ -501,7 +501,7 @@ class DurationInfo { final String name; final Duration duration; - DurationInfo(this.name, this.duration); + new(this.name, this.duration); } enum LaunchFrom { source, dart, aot, aotWithPerf } @@ -510,13 +510,13 @@ class MemoryInfo { final String name; final int kb; - MemoryInfo(this.name, this.kb); + new(this.name, this.kb); } class OutstandingRequest { final Stopwatch stopwatch = Stopwatch(); final Completer> completer = Completer(); - OutstandingRequest() { + new() { stopwatch.start(); } } @@ -524,7 +524,7 @@ class OutstandingRequest { class _Uint8ListHelper { Uint8List data; int length = 0; - _Uint8ListHelper() : data = Uint8List(1024); + new() : data = Uint8List(1024); int operator [](int index) { if (index < 0 || index >= length) throw 'Out of bounds: $index'; diff --git a/pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart b/pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart index 7671c8dd1de..37e05c26bcc 100644 --- a/pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart +++ b/pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart @@ -7,7 +7,7 @@ class Location { final int line; final int column; - Location(this.uri, this.line, this.column); + new(this.uri, this.line, this.column); @override String toString() => 'Location[$uri:$line:$column]'; diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/legacy_type_in_big_file_ask_for_completion.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/legacy_type_in_big_file_ask_for_completion.dart index 4be553b7086..d1a90c1acf7 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/legacy_type_in_big_file_ask_for_completion.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/legacy_type_in_big_file_ask_for_completion.dart @@ -65,7 +65,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LegacyTypingInBigFileAskForCompletion @@ -77,12 +77,8 @@ class LegacyTypingInBigFileAskForCompletion final RunDetails runDetails; - LegacyTypingInBigFileAskForCompletion( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: false); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: false); @override LaunchFrom get launchFrom => LaunchFrom.dart; @@ -175,5 +171,5 @@ class RunDetails { final FileContentPair mainFile; final int offset; - RunDetails({required this.mainFile, required this.offset}); + new({required this.mainFile, required this.offset}); } diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_assist_other_file_could_add_late.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_assist_other_file_could_add_late.dart index 89cb4e5e2de..dbf0416dadc 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_assist_other_file_could_add_late.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_assist_other_file_could_add_late.dart @@ -74,7 +74,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LspAssistLate extends DartLanguageServerBenchmark { @@ -85,7 +85,7 @@ class LspAssistLate extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspAssistLate(super.args, this.rootUri, this.cacheFolder, this.runDetails) + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) : super(useLspProtocol: true); @override @@ -139,5 +139,5 @@ class LspAssistLate extends DartLanguageServerBenchmark { class RunDetails { final FileContentPair mainFile; - RunDetails({required this.mainFile}); + new({required this.mainFile}); } diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_change_requests_processing.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_change_requests_processing.dart index da011e91238..0c11979a4cb 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_change_requests_processing.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_change_requests_processing.dart @@ -65,7 +65,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LspTypingInBigFileAskForCompletion extends DartLanguageServerBenchmark { @@ -76,12 +76,8 @@ class LspTypingInBigFileAskForCompletion extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspTypingInBigFileAskForCompletion( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; @@ -166,5 +162,5 @@ class RunDetails { final FileContentPair mainFile; final int addAtLine; - RunDetails({required this.mainFile, required this.addAtLine}); + new({required this.mainFile, required this.addAtLine}); } diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_assist_calls.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_assist_calls.dart index b4948e4fb8f..d4169027cfa 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_assist_calls.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_assist_calls.dart @@ -77,7 +77,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LspManyAssistCalls extends DartLanguageServerBenchmark { @@ -88,12 +88,8 @@ class LspManyAssistCalls extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspManyAssistCalls( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; @@ -155,7 +151,7 @@ class RunDetails { final String lineEnding; final FileContentPair mainFile; - RunDetails({required this.mainFile, required this.lineEnding}); + new({required this.mainFile, required this.lineEnding}); } enum _LineEndings { windows, unix } diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_prefer_single_quotes_violations_benchmark.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_prefer_single_quotes_violations_benchmark.dart index 4871fdc1269..08ed3d3492c 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_prefer_single_quotes_violations_benchmark.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_prefer_single_quotes_violations_benchmark.dart @@ -69,7 +69,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LspManyPreferSingleQuotesViolationsBenchmark @@ -81,12 +81,8 @@ class LspManyPreferSingleQuotesViolationsBenchmark final RunDetails runDetails; - LspManyPreferSingleQuotesViolationsBenchmark( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; @@ -159,5 +155,5 @@ class LspManyPreferSingleQuotesViolationsBenchmark class RunDetails { final FileContentPair mainFile; - RunDetails({required this.mainFile}); + new({required this.mainFile}); } diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_semantic_token_full_in_big_file.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_semantic_token_full_in_big_file.dart index b011dce94e3..8895e771289 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_semantic_token_full_in_big_file.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_semantic_token_full_in_big_file.dart @@ -58,7 +58,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LspRequestSemanticTokenFull extends DartLanguageServerBenchmark { @@ -69,12 +69,8 @@ class LspRequestSemanticTokenFull extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspRequestSemanticTokenFull( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; @@ -118,5 +114,5 @@ class LspRequestSemanticTokenFull extends DartLanguageServerBenchmark { class RunDetails { final FileContentPair mainFile; - RunDetails({required this.mainFile}); + new({required this.mainFile}); } diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart index 5b733572506..969aba975db 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart @@ -61,7 +61,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LspTypingInBigFile extends DartLanguageServerBenchmark { @@ -72,12 +72,8 @@ class LspTypingInBigFile extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspTypingInBigFile( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; @@ -448,5 +444,5 @@ class RunDetails { final FileContentPair mainFile; final int addAtLine; - RunDetails({required this.mainFile, required this.addAtLine}); + new({required this.mainFile, required this.addAtLine}); } diff --git a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file_ask_for_completion.dart b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file_ask_for_completion.dart index 0c28c15b2c6..407cb15e21f 100644 --- a/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file_ask_for_completion.dart +++ b/pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file_ask_for_completion.dart @@ -60,7 +60,7 @@ class FileContentPair { final Uri uri; final String content; - FileContentPair(this.uri, this.content); + new(this.uri, this.content); } class LspTypingInBigFileAskForCompletion extends DartLanguageServerBenchmark { @@ -71,12 +71,8 @@ class LspTypingInBigFileAskForCompletion extends DartLanguageServerBenchmark { final RunDetails runDetails; - LspTypingInBigFileAskForCompletion( - super.args, - this.rootUri, - this.cacheFolder, - this.runDetails, - ) : super(useLspProtocol: true); + new(super.args, this.rootUri, this.cacheFolder, this.runDetails) + : super(useLspProtocol: true); @override LaunchFrom get launchFrom => LaunchFrom.dart; @@ -164,5 +160,5 @@ class RunDetails { final FileContentPair mainFile; final int addAtLine; - RunDetails({required this.mainFile, required this.addAtLine}); + new({required this.mainFile, required this.addAtLine}); } diff --git a/pkg/analysis_server/tool/bulk_fix/parse_utils.dart b/pkg/analysis_server/tool/bulk_fix/parse_utils.dart index 44196dee6aa..5eb37b86fa7 100644 --- a/pkg/analysis_server/tool/bulk_fix/parse_utils.dart +++ b/pkg/analysis_server/tool/bulk_fix/parse_utils.dart @@ -77,5 +77,5 @@ class CorrectionDetails { bool canBeBulkApplied; bool hasComment; - CorrectionDetails({required this.canBeBulkApplied, required this.hasComment}); + new({required this.canBeBulkApplied, required this.hasComment}); } diff --git a/pkg/analysis_server/tool/code_completion/benchmark/sliding_statistics.dart b/pkg/analysis_server/tool/code_completion/benchmark/sliding_statistics.dart index 8839561718e..f70c7f37749 100644 --- a/pkg/analysis_server/tool/code_completion/benchmark/sliding_statistics.dart +++ b/pkg/analysis_server/tool/code_completion/benchmark/sliding_statistics.dart @@ -10,7 +10,7 @@ class SlidingStatistics { int _index = 0; bool _isReady = false; - SlidingStatistics(int length) : _values = Uint32List(length); + new(int length) : _values = Uint32List(length); bool get isReady => _isReady; diff --git a/pkg/analysis_server/tool/code_completion/code_metrics.dart b/pkg/analysis_server/tool/code_completion/code_metrics.dart index 83e0a99778d..1e1a161bcb9 100644 --- a/pkg/analysis_server/tool/code_completion/code_metrics.dart +++ b/pkg/analysis_server/tool/code_completion/code_metrics.dart @@ -101,7 +101,7 @@ class CodeShapeData { Set missedChildren = {}; /// Initialize a newly created set of relevance data to be empty. - CodeShapeData(); + new(); /// Record that an element of the given [node] was found in the given /// [context]. @@ -163,7 +163,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor { /// Initialize a newly created collector to add data points to the given /// [data]. - CodeShapeDataCollector(this.data); + new(this.data); @override void visitAdjacentStrings(AdjacentStrings node) { @@ -1270,7 +1270,7 @@ class CodeShapeMetricsComputer { /// Initialize a newly created metrics computer that can compute the metrics /// in one or more files and directories. - CodeShapeMetricsComputer(); + new(); /// Compute the metrics for the file(s) in the [rootPath]. Future compute(String rootPath) async { diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics.dart b/pkg/analysis_server/tool/code_completion/completion_metrics.dart index 7a43d54b3fc..ebfaf4eeeab 100644 --- a/pkg/analysis_server/tool/code_completion/completion_metrics.dart +++ b/pkg/analysis_server/tool/code_completion/completion_metrics.dart @@ -412,11 +412,11 @@ class CompletionMetrics { final Map> worstResults = {}; - CompletionMetrics(this.name, {this.enableFunction, this.disableFunction}) + new(this.name, {this.enableFunction, this.disableFunction}) : userTag = UserTag(name); /// Return an instance extracted from the decoded JSON [map]. - factory CompletionMetrics.fromJson(Map map) { + factory fromJson(Map map) { var metrics = CompletionMetrics(map['name'] as String); metrics.completionCounter.fromJson( map['completionCounter'] as Map, @@ -748,7 +748,7 @@ class CompletionMetricsQualityOptions extends CompletionMetricsOptions { /// completion requests that had the worst mrr scores. final bool printWorstResults; - CompletionMetricsQualityOptions(super.results) + new(super.results) : printMissedCompletionDetails = results.flag( _printMissedCompletionDetails, ), @@ -770,10 +770,7 @@ class CompletionQualityMetricsComputer extends CompletionMetricsComputer { /// A list of the metrics to be computed. final List targetMetrics = []; - CompletionQualityMetricsComputer( - super.rootPath, - CompletionMetricsQualityOptions super.options, - ); + new(super.rootPath, CompletionMetricsQualityOptions super.options); @override CompletionMetricsQualityOptions get options => @@ -1655,7 +1652,7 @@ class CompletionResult { final Map? precedingRelevanceCounts; - CompletionResult( + new( this.place, this.request, this.actualSuggestion, @@ -1667,7 +1664,7 @@ class CompletionResult { ); /// Return an instance extracted from the decoded JSON [map]. - factory CompletionResult.fromJson(Map map) { + factory fromJson(Map map) { var place = Place.fromJson(map['place'] as Map); var actualSuggestion = SuggestionData.fromJson( map['actualSuggestion'] as Map, @@ -1824,7 +1821,7 @@ class LocationTableLine { final double mrr; final double mrr_5; - LocationTableLine({ + new({ required this.label, required this.product, required this.count, @@ -1935,7 +1932,7 @@ class RelevanceTables { final Map> keywordRelevance; /// Initialize a newly created description of a pair of relevance tables. - RelevanceTables(this.name, this.elementKindRelevance, this.keywordRelevance); + new(this.name, this.elementKindRelevance, this.keywordRelevance); } /// Information about a completion suggestion that suggested a shadowed element. @@ -1944,7 +1941,7 @@ class ShadowedCompletion { final CandidateSuggestion closeMatchSuggestion; - ShadowedCompletion(this.expectedCompletion, this.closeMatchSuggestion); + new(this.expectedCompletion, this.closeMatchSuggestion); } /// The information being remembered about an individual suggestion. @@ -1955,10 +1952,10 @@ class SuggestionData { /// The values of the features used to compute the suggestion. List features; - SuggestionData(this.suggestion, this.features); + new(this.suggestion, this.features); /// Return an instance extracted from the decoded JSON [map]. - factory SuggestionData.fromJson(Map map) { + factory fromJson(Map map) { throw UnimplementedError(); // return SuggestionData( // CandidateSuggestion.fromJson(map['suggestion'] as Map), diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart b/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart index c122c14bbe6..2b7c2530ec6 100644 --- a/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart +++ b/pkg/analysis_server/tool/code_completion/completion_metrics_base.dart @@ -36,7 +36,7 @@ abstract class CompletionMetricsComputer { int overlayModificationStamp = 0; - CompletionMetricsComputer(this.rootPath, this.options); + new(this.rootPath, this.options); /// Applies an overlay in [filePath] at [expectedCompletion]. Future applyOverlay( @@ -213,7 +213,7 @@ class CompletionMetricsOptions { /// completion requests that were the slowest to return suggestions. final bool printSlowestResults; - CompletionMetricsOptions(ArgResults results) + new(ArgResults results) : overlay = OverlayMode.parseFlag(results.option(overlayOption)!), prefixLength = int.parse(results.option(prefixLengthOption)!), printSlowestResults = results.flag(printSlowestResultsFlag); @@ -233,7 +233,7 @@ enum OverlayMode { final String flag; - const OverlayMode(this.flag); + new(this.flag); static OverlayMode parseFlag(String flag) { for (var mode in values) { @@ -275,7 +275,7 @@ class ProgressBar { int _tickCount = 0; - ProgressBar(this._logger, this._totalTickCount) { + new(this._logger, this._totalTickCount) { if (!stdout.hasTerminal) { _shouldDrawProgress = false; } else { diff --git a/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart b/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart index 5d7c32e8960..8dd2e11b810 100644 --- a/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart +++ b/pkg/analysis_server/tool/code_completion/completion_metrics_client.dart @@ -191,7 +191,7 @@ class _AnalysisServerClient { final Map _requestMetadata = {}; - _AnalysisServerClient(this.sdkPath, this.analysisRoots); + new(this.sdkPath, this.analysisRoots); /// Completes when we next receive an analysis finished event (unless there's /// no current analysis and we've already received a complete event, in which @@ -484,7 +484,7 @@ class _CompletionClientMetricsComputer extends CompletionMetricsComputer { final metrics = CompletionMetrics(); - _CompletionClientMetricsComputer(super.rootPath, super.options, this.client); + new(super.rootPath, super.options, this.client); @override Future applyOverlay( @@ -582,7 +582,7 @@ class _RequestError { final String message; final String stackTrace; - _RequestError(this.code, this.message, {required this.stackTrace}); + new(this.code, this.message, {required this.stackTrace}); @override String toString() => '[RequestError code: $code, message: $message]'; @@ -611,7 +611,7 @@ class _RequestMetadata { /// The duration of deserializing a response, in milliseconds. late final int deserializeDuration; - _RequestMetadata(this.startMilliseconds); + new(this.startMilliseconds); /// The duration of time between sending a completion request and receiving a /// completion response, not including the time to decode the response. @@ -627,9 +627,9 @@ class _Sdk { /// Path to SDK directory. final String sdkPath; - factory _Sdk() => _instance; + factory() => _instance; - _Sdk._(this.sdkPath); + new _(this.sdkPath); String get analysisServerSnapshot => path.absolute( sdkPath, @@ -682,5 +682,5 @@ class _SuggestionsData { final CompletionGetSuggestions2Result result; final _RequestMetadata metadata; - _SuggestionsData(this.result, this.metadata); + new(this.result, this.metadata); } diff --git a/pkg/analysis_server/tool/code_completion/corpus.dart b/pkg/analysis_server/tool/code_completion/corpus.dart index 38deb93c369..5ab4a535934 100644 --- a/pkg/analysis_server/tool/code_completion/corpus.dart +++ b/pkg/analysis_server/tool/code_completion/corpus.dart @@ -128,5 +128,5 @@ class CloneResult { final String directory; final int exitCode; final String msg; - CloneResult(this.exitCode, this.directory, {this.msg = ''}); + new(this.exitCode, this.directory, {this.msg = ''}); } diff --git a/pkg/analysis_server/tool/code_completion/flutter_metrics.dart b/pkg/analysis_server/tool/code_completion/flutter_metrics.dart index 3bab0624c6a..e46d3512fef 100644 --- a/pkg/analysis_server/tool/code_completion/flutter_metrics.dart +++ b/pkg/analysis_server/tool/code_completion/flutter_metrics.dart @@ -95,7 +95,7 @@ class FlutterData { Map> childData = {}; /// Initialize a newly created set of data to be empty. - FlutterData(); + new(); /// Record that an instance of the [childWidget] was created. If the instance /// creation expression is an argument in another widget constructor @@ -126,7 +126,7 @@ class FlutterDataCollector extends RecursiveAstVisitor { /// Initialize a newly created collector to add data points to the given /// [data]. - FlutterDataCollector(this.data); + new(this.data); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { @@ -158,7 +158,7 @@ class FlutterMetricsComputer { /// Initialize a newly created metrics computer that can compute the metrics /// in one or more files and directories. - FlutterMetricsComputer(); + new(); /// Compute the metrics for the file(s) in the [rootPath]. Future compute(String rootPath) async { diff --git a/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart b/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart index 04731074c19..73a32ca7fc2 100644 --- a/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart +++ b/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart @@ -97,7 +97,7 @@ class ImpliedTypeCollector extends RecursiveAstVisitor { /// Initialize a newly created collector to add data points to the given /// [data]. - ImpliedTypeCollector(this.data); + new(this.data); void handleVariableDeclaration(VariableDeclaration node, DartType? dartType) { // If some untyped variable declaration @@ -129,7 +129,7 @@ class ImpliedTypeComputer { /// Initialize a newly created metrics computer that can compute the metrics /// in one or more files and directories. - ImpliedTypeComputer(); + new(); /// Compute the metrics for the file(s) in the [rootPath]. /// If [corpus] is true, treat rootPath as a container of packages, creating diff --git a/pkg/analysis_server/tool/code_completion/metrics_util.dart b/pkg/analysis_server/tool/code_completion/metrics_util.dart index 7df32414160..253a95044e0 100644 --- a/pkg/analysis_server/tool/code_completion/metrics_util.dart +++ b/pkg/analysis_server/tool/code_completion/metrics_util.dart @@ -17,7 +17,7 @@ class ArithmeticMeanComputer { int? min; int? max; - ArithmeticMeanComputer(this.name); + new(this.name); double get mean => sum / count; @@ -98,7 +98,7 @@ class Counter { final Map _buckets = {}; int _totalCount = 0; - Counter(this.name); + new(this.name); /// Return a copy of all the current count data, this getter copies and /// returns the data to ensure that the data is only modified with the public @@ -224,7 +224,7 @@ class MeanReciprocalRankComputer { double _sum_5 = 0; int _count = 0; - MeanReciprocalRankComputer(this.name); + new(this.name); int get count => _count; @@ -322,8 +322,7 @@ class PercentileComputer { int maxValue = 0; - PercentileComputer(this.name, {required this.valueLimit}) - : _counts = Uint32List(valueLimit); + new(this.name, {required this.valueLimit}) : _counts = Uint32List(valueLimit); /// Calculates the median (p50) value. int get median => kthPercentile(50); @@ -432,16 +431,16 @@ class Place { /// The total number of possible places. final int _denominator; - const Place(this._numerator, this._denominator) + const new(this._numerator, this._denominator) : assert(_numerator > 0), assert(_denominator >= _numerator); /// Return an instance extracted from the decoded JSON [map]. - factory Place.fromJson(Map map) { + factory fromJson(Map map) { return Place(map['numerator'] as int, map['denominator'] as int); } - const Place.none() : _numerator = 0, _denominator = 0; + const new none() : _numerator = 0, _denominator = 0; int get denominator => _denominator; diff --git a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart index 8785853abe7..acd2d0009a0 100644 --- a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart +++ b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart @@ -145,7 +145,7 @@ class RelevanceData { final Map _percentageData = {}; /// Initialize a newly created set of relevance data to be empty. - RelevanceData(); + new(); /// Increment the count associated with the given [name] by one. void incrementCount(String name) { @@ -279,7 +279,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor { /// Initialize a newly created collector to add data points to the given /// [data]. - RelevanceDataCollector(this.data); + new(this.data); @override void visitAdjacentStrings(AdjacentStrings node) { @@ -2118,7 +2118,7 @@ class RelevanceMetricsComputer { /// Initialize a newly created metrics computer that can compute the metrics /// in one or more files and directories. - RelevanceMetricsComputer(); + new(); /// Compute the metrics for the file(s) in the [rootPath]. /// If [corpus] is true, treat rootPath as a container of packages, creating @@ -2458,7 +2458,7 @@ class _PercentageData { int positive = 0; /// Initialize a newly created keeper of percentage data. - _PercentageData(); + new(); /// Add a data point to the data being collected. If [wasPositive] is `true` /// then the data point is a positive data point. diff --git a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart index f2384c9da55..ede85185cb8 100644 --- a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart +++ b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart @@ -183,11 +183,11 @@ class RelevanceData { final Map> _byKind = {}; /// Initialize a newly created set of relevance data to be empty. - RelevanceData(); + new(); /// Initialize a newly created set of relevance data based on the content of /// the JSON encoded string. - RelevanceData.fromJson(String encoded) { + new fromJson(String encoded) { var map = json.decode(encoded) as Map; for (var contextEntry in map.entries) { var contextMap = _byKind.putIfAbsent(contextEntry.key, () => {}); @@ -340,7 +340,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor { /// Initialize a newly created collector to add data points to the given /// [data]. - RelevanceDataCollector(this.data); + new(this.data); /// Initialize this collector prior to visiting the unit in the [result]. void initializeFrom(ResolvedUnitResult result) { @@ -2401,7 +2401,7 @@ class RelevanceMetricsComputer { /// Initialize a newly created metrics computer that can compute the metrics /// in one or more files and directories. - RelevanceMetricsComputer(); + new(); /// Compute the metrics for the file(s) in the [rootPath]. /// If [corpus] is true, treat rootPath as a container of packages, creating @@ -2528,7 +2528,7 @@ class RelevanceMetricsComputer { class RelevanceTableWriter { final StringSink sink; - RelevanceTableWriter(this.sink); + new(this.sink); void write(RelevanceData data) { writeFileHeader(); @@ -2696,10 +2696,10 @@ class _ElementKind extends _Kind { final ElementKind elementKind; - factory _ElementKind(ElementKind elementKind) => + factory(ElementKind elementKind) => instances.putIfAbsent(elementKind, () => _ElementKind._(elementKind)); - _ElementKind._(this.elementKind); + new _(this.elementKind); @override String get uniqueKey => 'e${elementKind.name}'; @@ -2712,10 +2712,10 @@ class _Keyword extends _Kind { final Keyword keyword; - factory _Keyword(Keyword keyword) => + factory(Keyword keyword) => instances.putIfAbsent(keyword, () => _Keyword._(keyword)); - _Keyword._(this.keyword); + new _(this.keyword); @override String get uniqueKey => 'k${keyword.lexeme}'; diff --git a/pkg/analysis_server/tool/code_completion/visitors.dart b/pkg/analysis_server/tool/code_completion/visitors.dart index 5625a582c26..dc57a7eb7c5 100644 --- a/pkg/analysis_server/tool/code_completion/visitors.dart +++ b/pkg/analysis_server/tool/code_completion/visitors.dart @@ -32,7 +32,7 @@ class ExpectedCompletion { final protocol.ElementKind? _elementKind; - ExpectedCompletion( + new( this._filePath, this._entity, this._lineNumber, @@ -42,7 +42,7 @@ class ExpectedCompletion { ) : _completionString = null; /// Return an instance extracted from the decoded JSON [map]. - factory ExpectedCompletion.fromJson(Map map) { + factory fromJson(Map map) { var jsonDecoder = ResponseDecoder(null); var filePath = map['filePath'] as String; var offset = map['offset'] as int; @@ -74,7 +74,7 @@ class ExpectedCompletion { ); } - ExpectedCompletion.specialCompletionString( + new specialCompletionString( this._filePath, this._entity, this._lineNumber, @@ -169,7 +169,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor { /// comment don't yield an error like Dart syntax mistakes would yield. final bool _doExpectCommentRefs = false; - ExpectedCompletionsVisitor(this.result, {required this._caretOffset}); + new(this.result, {required this._caretOffset}); /// Return the path of the file that is being visited. String get filePath => result.path; @@ -882,7 +882,7 @@ class _SyntacticEntity extends SyntacticEntity { @override final int offset; - _SyntacticEntity(this.offset); + new(this.offset); @override int get end => offset + length; diff --git a/pkg/analysis_server/tool/codebase/failing_tests.dart b/pkg/analysis_server/tool/codebase/failing_tests.dart index c63c8b0526c..5ba2b7fe212 100644 --- a/pkg/analysis_server/tool/codebase/failing_tests.dart +++ b/pkg/analysis_server/tool/codebase/failing_tests.dart @@ -118,7 +118,7 @@ class AnnotatedTest { final String testName; final Uri issueUri; - AnnotatedTest(this.file, this.testName, this.issueUri); + new(this.file, this.testName, this.issueUri); } /// A [RecursiveAstVisitor] that tracks nodes annotated with [FailingTest] or @@ -127,7 +127,7 @@ class FailingTestAnnotationTracker extends RecursiveAstVisitor { final annotatedTests = []; final File file; - FailingTestAnnotationTracker(this.file); + new(this.file); @override void visitAnnotation(Annotation node) { diff --git a/pkg/analysis_server/tool/instrumentation/log/log.dart b/pkg/analysis_server/tool/instrumentation/log/log.dart index a11863e11fa..6e12610a26f 100644 --- a/pkg/analysis_server/tool/instrumentation/log/log.dart +++ b/pkg/analysis_server/tool/instrumentation/log/log.dart @@ -50,7 +50,7 @@ class EntryGroup { final Predicate filter; /// Initialize a newly created entry group with the given state. - EntryGroup._(this.id, this.name, this.filter); + new _(this.id, this.name, this.filter); /// Given a list of [entries], return all of the entries in the list that are /// members of this group. @@ -81,24 +81,19 @@ class EntryRange { /// Initialize a newly created range to represent the entries between the /// [firstIndex] and the [lastIndex], inclusive. - EntryRange(this.firstIndex, this.lastIndex); + new(this.firstIndex, this.lastIndex); } /// A log entry representing an Err entry. class ErrorEntry extends GenericEntry { /// Initialize a newly created log entry. - ErrorEntry(super.index, super.timeStamp, super.entryKind, super.components); + new(super.index, super.timeStamp, super.entryKind, super.components); } /// A log entry representing an Ex entry. class ExceptionEntry extends GenericEntry { /// Initialize a newly created log entry. - ExceptionEntry( - super.index, - super.timeStamp, - super.entryKind, - super.components, - ); + new(super.index, super.timeStamp, super.entryKind, super.components); } /// A representation of a generic log entry. @@ -111,7 +106,7 @@ class GenericEntry extends LogEntry { /// Initialize a newly created generic log entry to have the given /// [timeStamp], [entryKind] and list of [components] - GenericEntry(super.index, super.timeStamp, this.entryKind, this.components); + new(super.index, super.timeStamp, this.entryKind, this.components); @override String get kind => entryKind; @@ -133,7 +128,7 @@ class GenericPluginEntry extends GenericEntry with PluginEntryMixin { final List pluginData; /// Initialize a newly created log entry. - GenericPluginEntry( + new( super.index, super.timeStamp, super.entryKind, @@ -188,7 +183,7 @@ class InstrumentationLog { /// lines in the [logContent] into a separate entry. The log contents should /// be the contents of the files whose paths are in the given list of /// [logFilePaths]. - InstrumentationLog(this.logFilePaths, List logContent) { + new(this.logFilePaths, List logContent) { _parseLogContent(logContent); } @@ -408,7 +403,7 @@ abstract class JsonBasedEntry extends LogEntry { /// Initialize a newly created log entry to have the given [timeStamp] and /// [data]. - JsonBasedEntry(super.index, super.timeStamp, this.data); + new(super.index, super.timeStamp, this.data); @override void _appendDetails(StringBuffer buffer) { @@ -493,12 +488,7 @@ abstract class JsonBasedPluginEntry extends JsonBasedEntry /// Initialize a newly created entry to have the given [timeStamp] and /// [notificationData] and to be associated with the plugin with the given /// [pluginData]. - JsonBasedPluginEntry( - super.index, - super.timeStamp, - super.notificationData, - this.pluginData, - ); + new(super.index, super.timeStamp, super.notificationData, this.pluginData); } /// A single entry in an instrumentation log. @@ -538,7 +528,7 @@ abstract class LogEntry { List? _problems; /// Initialize a newly created log entry with the given [timeStamp]. - LogEntry(this.index, this.timeStamp); + new(this.index, this.timeStamp); /// Return `true` if any problems were found while processing the log file. bool get hasProblems => _problems != null; @@ -708,7 +698,7 @@ abstract class LogEntry { class MalformedLogEntry extends LogEntry { final String entry; - MalformedLogEntry(int index, this.entry) : super(index, -1); + new(int index, this.entry) : super(index, -1); @override String get kind => 'Mal'; @@ -726,7 +716,7 @@ class MalformedLogEntry extends LogEntry { class NotificationEntry extends JsonBasedEntry { /// Initialize a newly created response to have the given [timeStamp] and /// [notificationData]. - NotificationEntry(super.index, super.timeStamp, super.notificationData); + new(super.index, super.timeStamp, super.notificationData); /// Return the event field of the request. String get event => data['event'] as String; @@ -778,7 +768,7 @@ mixin PluginEntryMixin { /// A log entry representing an PluginErr entry. class PluginErrorEntry extends GenericPluginEntry { /// Initialize a newly created log entry. - PluginErrorEntry( + new( super.index, super.timeStamp, super.entryKind, @@ -790,7 +780,7 @@ class PluginErrorEntry extends GenericPluginEntry { /// A log entry representing an PluginEx entry. class PluginExceptionEntry extends GenericPluginEntry { /// Initialize a newly created log entry. - PluginExceptionEntry( + new( super.index, super.timeStamp, super.entryKind, @@ -804,12 +794,7 @@ class PluginExceptionEntry extends GenericPluginEntry { class PluginNotificationEntry extends JsonBasedPluginEntry { /// Initialize a newly created notification to have the given [timeStamp] and /// [notificationData]. - PluginNotificationEntry( - super.index, - super.timeStamp, - super.notificationData, - super.pluginData, - ); + new(super.index, super.timeStamp, super.notificationData, super.pluginData); /// Return the event field of the notification. String get event => data['event'] as String; @@ -833,12 +818,7 @@ class PluginNotificationEntry extends JsonBasedPluginEntry { class PluginRequestEntry extends JsonBasedPluginEntry { /// Initialize a newly created response to have the given [timeStamp] and /// [requestData]. - PluginRequestEntry( - super.index, - super.timeStamp, - super.requestData, - super.pluginData, - ); + new(super.index, super.timeStamp, super.requestData, super.pluginData); /// Return the id field of the request. String get id => data['id'] as String; @@ -865,12 +845,7 @@ class PluginRequestEntry extends JsonBasedPluginEntry { class PluginResponseEntry extends JsonBasedPluginEntry { /// Initialize a newly created response to have the given [timeStamp] and /// [responseData]. - PluginResponseEntry( - super.index, - super.timeStamp, - super.responseData, - super.pluginData, - ); + new(super.index, super.timeStamp, super.responseData, super.pluginData); /// Return the id field of the response. String get id => data['id'] as String; @@ -894,7 +869,7 @@ class PluginResponseEntry extends JsonBasedPluginEntry { class RequestEntry extends JsonBasedEntry { /// Initialize a newly created response to have the given [timeStamp] and /// [requestData]. - RequestEntry(super.index, super.timeStamp, super.requestData); + new(super.index, super.timeStamp, super.requestData); /// Return the clientRequestTime field of the request. int get clientRequestTime => data['clientRequestTime'] as int; @@ -924,7 +899,7 @@ class RequestEntry extends JsonBasedEntry { class ResponseEntry extends JsonBasedEntry { /// Initialize a newly created response to have the given [timeStamp] and /// [responseData]. - ResponseEntry(super.index, super.timeStamp, super.responseData); + new(super.index, super.timeStamp, super.responseData); /// Return the id field of the response. String get id => '${data['id']}'; @@ -960,7 +935,7 @@ class TaskEntry extends LogEntry { /// Initialize a newly created entry with the given [index] and [timeStamp] to /// represent the execution of an analysis task in the given [context] that is /// described by the given [description]. - TaskEntry(super.index, super.timeStamp, this.context, this.description); + new(super.index, super.timeStamp, this.context, this.description); @override String get kind => 'Task'; diff --git a/pkg/analysis_server/tool/instrumentation/log_viewer.dart b/pkg/analysis_server/tool/instrumentation/log_viewer.dart index 7f7ae634b05..bd6eed102b5 100644 --- a/pkg/analysis_server/tool/instrumentation/log_viewer.dart +++ b/pkg/analysis_server/tool/instrumentation/log_viewer.dart @@ -38,7 +38,7 @@ class Driver { static int defaultPageLength = 25; /// Initialize a newly created driver. - Driver(); + new(); /// Create and return the parser used to parse the command-line arguments. ArgParser createParser() { diff --git a/pkg/analysis_server/tool/instrumentation/page/log_page.dart b/pkg/analysis_server/tool/instrumentation/page/log_page.dart index ba65971ac35..10ed36a7559 100644 --- a/pkg/analysis_server/tool/instrumentation/page/log_page.dart +++ b/pkg/analysis_server/tool/instrumentation/page/log_page.dart @@ -36,7 +36,7 @@ class LogPage extends PageWriter { /// Initialize a newly created writer to write the content of the given /// [instrumentationLog]. - LogPage(this.log); + new(this.log); /// Return the encoding for the given [pluginId] that is used to build /// anchors. diff --git a/pkg/analysis_server/tool/instrumentation/page/page_writer.dart b/pkg/analysis_server/tool/instrumentation/page/page_writer.dart index 05cef00a34d..46ad4f88559 100644 --- a/pkg/analysis_server/tool/instrumentation/page/page_writer.dart +++ b/pkg/analysis_server/tool/instrumentation/page/page_writer.dart @@ -15,7 +15,7 @@ abstract class PageWriter { static final HtmlEscape htmlEscape = HtmlEscape(); /// Initialize a newly create page writer. - PageWriter(); + new(); /// Return the length of the common prefix for time stamps associated with the /// given log [entries]. diff --git a/pkg/analysis_server/tool/instrumentation/page/stats_page.dart b/pkg/analysis_server/tool/instrumentation/page/stats_page.dart index 166693e7d19..e43961470e7 100644 --- a/pkg/analysis_server/tool/instrumentation/page/stats_page.dart +++ b/pkg/analysis_server/tool/instrumentation/page/stats_page.dart @@ -40,7 +40,7 @@ class StatsPage extends PageWriter { /// Initialize a newly created page writer to write information about the /// given instrumentation [log]. - StatsPage(this.log) { + new(this.log) { _processEntries(log.logEntries); } diff --git a/pkg/analysis_server/tool/instrumentation/server.dart b/pkg/analysis_server/tool/instrumentation/server.dart index 76dae31e932..28b5f158e2f 100644 --- a/pkg/analysis_server/tool/instrumentation/server.dart +++ b/pkg/analysis_server/tool/instrumentation/server.dart @@ -39,7 +39,7 @@ class WebServer { final int pageLength; /// Initialize a newly created server. - WebServer(this.log, {required this.pageLength}); + new(this.log, {required this.pageLength}); Map getParameterMap(HttpRequest request) { Map parameterMap = HashMap(); diff --git a/pkg/analysis_server/tool/log_player/log.dart b/pkg/analysis_server/tool/log_player/log.dart index feef600df4d..32b3523b4c5 100644 --- a/pkg/analysis_server/tool/log_player/log.dart +++ b/pkg/analysis_server/tool/log_player/log.dart @@ -18,7 +18,7 @@ class Log { /// /// [denormalizer] will be called on the content to reverse any normalization /// that was applied to the log. - factory Log.fromFile(File file, String Function(String) denormalizer) { + factory fromFile(File file, String Function(String) denormalizer) { return Log.fromString(file.readAsStringSync(), denormalizer); } @@ -29,7 +29,7 @@ class Log { /// /// [denormalizer] will be called on the content to reverse any normalization /// that was applied to the log. - factory Log.fromString( + factory fromString( String logContent, [ String Function(String)? denormalizer, ]) { @@ -42,5 +42,5 @@ class Log { ]); } - Log._(this.entries); + new _(this.entries); } diff --git a/pkg/analysis_server/tool/log_player/log_player.dart b/pkg/analysis_server/tool/log_player/log_player.dart index 00720d6fc56..639c4f80839 100644 --- a/pkg/analysis_server/tool/log_player/log_player.dart +++ b/pkg/analysis_server/tool/log_player/log_player.dart @@ -54,7 +54,7 @@ class LogPlayer { /// mismatches. final bool verbose; - LogPlayer({ + new({ required this.log, this.timeout = const Duration(seconds: 5), this.verbose = false, diff --git a/pkg/analysis_server/tool/log_player/message_equality.dart b/pkg/analysis_server/tool/log_player/message_equality.dart index 549e091b0f2..8049d633edd 100644 --- a/pkg/analysis_server/tool/log_player/message_equality.dart +++ b/pkg/analysis_server/tool/log_player/message_equality.dart @@ -16,7 +16,7 @@ import 'package:collection/collection.dart'; class MessageEquality implements Equality { final _CustomDeepCollectionEquality _recursiveEquality; - MessageEquality({Set ignoredKeys = const {}}) + new({Set ignoredKeys = const {}}) : _recursiveEquality = _CustomDeepCollectionEquality(ignoredKeys); /// If [skipMatchId] is `true`, then the top level `id` field is ignored @@ -49,7 +49,7 @@ class _CustomDeepCollectionEquality implements Equality { late final _orderedListEquality = ListEquality(this); late final _unorderedListEquality = UnorderedIterableEquality(this); - _CustomDeepCollectionEquality(this._ignoredKeys); + new(this._ignoredKeys); @override bool equals(Object? e1, Object? e2, {String? path}) { diff --git a/pkg/analysis_server/tool/log_player/server_driver.dart b/pkg/analysis_server/tool/log_player/server_driver.dart index f95921dadc8..30129d42dbb 100644 --- a/pkg/analysis_server/tool/log_player/server_driver.dart +++ b/pkg/analysis_server/tool/log_player/server_driver.dart @@ -38,7 +38,7 @@ class ServerDriver { /// The server is run in a separate process. // TODO(brianwilkerson): Add a flag controlling whether the server is in the // same process as the driver or in a separate process. - factory ServerDriver({required List arguments}) { + factory({required List arguments}) { var parsedArgs = Driver.createArgParser().parse(arguments); var protocolOption = parsedArgs.option(Driver.serverProtocolOption); @@ -67,7 +67,7 @@ class ServerDriver { /// When the server is [start]ed, it will use the given [_protocol]. /// /// The server is run in a separate process. - ServerDriver._({required this.arguments, required this._protocol}); + new _({required this.arguments, required this._protocol}); /// The messages read from the analysis server's stdout. Stream get serverMessages => _serverMessagesController.stream; @@ -222,5 +222,5 @@ enum ServerProtocol { lsp('lsp'); final String flagValue; - const ServerProtocol(this.flagValue); + new(this.flagValue); } diff --git a/pkg/analysis_server/tool/lsp_spec/meta_model.dart b/pkg/analysis_server/tool/lsp_spec/meta_model.dart index ffed2163dfc..bddebc1fd7f 100644 --- a/pkg/analysis_server/tool/lsp_spec/meta_model.dart +++ b/pkg/analysis_server/tool/lsp_spec/meta_model.dart @@ -30,7 +30,7 @@ bool _isPowerOfTwo(int x) { class AbstractGetter extends Member { final TypeBase type; - AbstractGetter({ + new({ required super.name, super.comment, super.isProposed, @@ -41,7 +41,7 @@ class AbstractGetter extends Member { class ArrayType extends TypeBase { final TypeBase elementType; - ArrayType(this.elementType); + new(this.elementType); @override String get dartType => 'List'; @@ -56,7 +56,7 @@ class ArrayType extends TypeBase { class Constant extends Member with LiteralValueMixin { TypeBase type; String value; - Constant({ + new({ required super.name, super.comment, super.isProposed, @@ -72,7 +72,7 @@ class Field extends Member { final TypeBase type; final bool allowsNull; final bool allowsUndefined; - Field({ + new({ required super.name, super.comment, super.isProposed, @@ -84,7 +84,7 @@ class Field extends Member { class FixedValueField extends Field { final String value; - FixedValueField({ + new({ required super.name, super.comment, required this.value, @@ -101,7 +101,7 @@ class Interface extends LspEntity { final bool abstract; final bool sealed; - Interface({ + new({ required super.name, super.comment, super.isProposed, @@ -114,7 +114,7 @@ class Interface extends LspEntity { members.sortBy((member) => member.name.toLowerCase()); } - Interface.inline(String name, List members) + new inline(String name, List members) : this(name: name, members: members); } @@ -123,7 +123,7 @@ class LiteralType extends TypeBase with LiteralValueMixin { final TypeBase type; final String _literal; - LiteralType(this.type, this._literal); + new(this.type, this._literal); @override String get dartType => type.dartType; @@ -145,7 +145,7 @@ class LiteralType extends TypeBase with LiteralValueMixin { class LiteralUnionType extends UnionType { final List literalTypes; - LiteralUnionType(this.literalTypes) : super(literalTypes); + new(this.literalTypes) : super(literalTypes); @override String get dartType => types.first.dartType; @@ -174,11 +174,8 @@ abstract class LspEntity { final String? comment; final bool isProposed; final bool isDeprecated; - LspEntity({ - required this.name, - required this.comment, - this.isProposed = false, - }) : isDeprecated = comment?.contains('@deprecated') ?? false; + new({required this.name, required this.comment, this.isProposed = false}) + : isDeprecated = comment?.contains('@deprecated') ?? false; } /// An enum parsed from the LSP JSON model. @@ -186,7 +183,7 @@ class LspEnum extends LspEntity { final TypeBase typeOfValues; final bool flags; final List constants; - LspEnum({ + new({ required super.name, super.comment, super.isProposed, @@ -235,7 +232,7 @@ class LspMetaModel { final List types; final List methods; - LspMetaModel({required this.types, required this.methods}); + new({required this.types, required this.methods}); } /// A [Map] type parsed from the LSP JSON model. @@ -243,7 +240,7 @@ class MapType extends TypeBase { final TypeBase indexType; final TypeBase valueType; - MapType(this.indexType, this.valueType); + new(this.indexType, this.valueType); @override String get dartType => 'Map'; @@ -256,13 +253,13 @@ class MapType extends TypeBase { /// Base class for members ([Constant] and [Field]s) parsed from the LSP JSON /// model. abstract class Member extends LspEntity { - Member({required super.name, super.comment, super.isProposed}); + new({required super.name, super.comment, super.isProposed}); } class NullableType extends TypeBase { final TypeBase baseType; - NullableType(this.baseType); + new(this.baseType); @override String get dartType => baseType.dartType; @@ -284,7 +281,7 @@ class TypeAlias extends LspEntity { /// Whether a typedef should be created for this alias. final bool generateTypeDef; - TypeAlias({ + new({ required super.name, super.comment, super.isProposed, @@ -322,7 +319,7 @@ class TypeReference extends TypeBase { final String name; final List typeArgs; - TypeReference(this.name, {this.typeArgs = const []}) { + new(this.name, {this.typeArgs = const []}) { if (name == 'Array' || name.endsWith('[]')) { throw 'Type should not be used for arrays, use ArrayType instead'; } @@ -378,7 +375,7 @@ class TypeReference extends TypeBase { class UnionType extends TypeBase { final List types; - UnionType(this.types) { + new(this.types) { // Ensure types are always sorted alphabetically to simplify sharing code // because `Either2` and `Either2` are not the same. types.sortBy((type) => type.dartTypeWithTypeArgs.toLowerCase()); diff --git a/pkg/analysis_server/tool/performance/project_generator/git_clone_project_generator.dart b/pkg/analysis_server/tool/performance/project_generator/git_clone_project_generator.dart index 50c0bfb9bb8..6aaabeda139 100644 --- a/pkg/analysis_server/tool/performance/project_generator/git_clone_project_generator.dart +++ b/pkg/analysis_server/tool/performance/project_generator/git_clone_project_generator.dart @@ -22,7 +22,7 @@ class GitCloneProjectGenerator implements ProjectGenerator { /// sub-directories of the repo to open in the workspace. final Iterable? openSubdirs; - GitCloneProjectGenerator(this.repo, this.ref, {Iterable? openSubdirs}) + new(this.repo, this.ref, {Iterable? openSubdirs}) : // Normalize any path separators to match the current platform. openSubdirs = openSubdirs?.map( (openSubdir) => openSubdir.replaceAll(RegExp(r'\/'), p.separator), diff --git a/pkg/analysis_server/tool/performance/project_generator/git_worktree_project_generator.dart b/pkg/analysis_server/tool/performance/project_generator/git_worktree_project_generator.dart index 76f1670532e..b345554523a 100644 --- a/pkg/analysis_server/tool/performance/project_generator/git_worktree_project_generator.dart +++ b/pkg/analysis_server/tool/performance/project_generator/git_worktree_project_generator.dart @@ -27,7 +27,7 @@ class GitWorktreeProjectGenerator implements ProjectGenerator { /// sub-directories of the repo to open in the workspace. final Iterable? openSubdirs; - GitWorktreeProjectGenerator( + new( this.originalRepo, this.ref, { this.isSdkRepo = false, diff --git a/pkg/analysis_server/tool/performance/project_generator/project_generator.dart b/pkg/analysis_server/tool/performance/project_generator/project_generator.dart index 1f08d62cf1f..8ddbc819bd1 100644 --- a/pkg/analysis_server/tool/performance/project_generator/project_generator.dart +++ b/pkg/analysis_server/tool/performance/project_generator/project_generator.dart @@ -119,7 +119,7 @@ class ContextRoot { /// The package config for this context root. final PackageConfig packageConfig; - ContextRoot(this.dir, this.packageConfig); + new(this.dir, this.packageConfig); } /// A [ProjectGenerator] represents a reproducible way to create a pristine @@ -161,7 +161,7 @@ class Workspace { /// These correspond directly to the `workspaceFolder` entries in LSP. final Iterable workspaceDirectories; - Workspace({ + new({ required this.contextRoots, required this.workspaceDirectories, Iterable? rootDirectories, diff --git a/pkg/analysis_server/tool/performance/scenarios/scenario.dart b/pkg/analysis_server/tool/performance/scenarios/scenario.dart index a6eda375940..bf84c667ad6 100644 --- a/pkg/analysis_server/tool/performance/scenarios/scenario.dart +++ b/pkg/analysis_server/tool/performance/scenarios/scenario.dart @@ -27,7 +27,7 @@ class Scenario { /// Handles project setup. final ProjectGenerator project; - Scenario({required this.name, required this.logFile, required this.project}); + new({required this.name, required this.logFile, required this.project}); Future run(Duration timeout, {bool verbose = false}) async { var watch = Stopwatch()..start(); diff --git a/pkg/analysis_server/tool/performance/utilities/analysis_tester.dart b/pkg/analysis_server/tool/performance/utilities/analysis_tester.dart index 92208783725..df8894dc744 100644 --- a/pkg/analysis_server/tool/performance/utilities/analysis_tester.dart +++ b/pkg/analysis_server/tool/performance/utilities/analysis_tester.dart @@ -32,7 +32,7 @@ class AnalysisTester { final Set packagePaths = {}; /// Initialize an analysis tester that uses a memory resource provider. - factory AnalysisTester.memory() { + factory memory() { var provider = MemoryResourceProvider(); var sdkPath = '/sdk'; var packageRootPath = '/test/pkgs'; @@ -48,7 +48,7 @@ class AnalysisTester { } /// Initialize an analysis tester that uses a physical resource provider. - factory AnalysisTester.physical() { + factory physical() { var provider = PhysicalResourceProvider(); var sdkPath = '/Users/brianwilkerson/dart-sdk'; var packageRootPath = '/Users/brianwilkerson/src/dart/samples/Overmorrow'; @@ -61,7 +61,7 @@ class AnalysisTester { /// Initialize an analysis tester that uses the given resource [provider], /// [sdkPath], and [packagePath]. - AnalysisTester._({ + new _({ required this.provider, required this.sdkPath, required this.packageRootPath, diff --git a/pkg/analysis_server/tool/spec/api.dart b/pkg/analysis_server/tool/spec/api.dart index 1878b1aa803..1c3c98d39e8 100644 --- a/pkg/analysis_server/tool/spec/api.dart +++ b/pkg/analysis_server/tool/spec/api.dart @@ -17,7 +17,7 @@ class Api extends ApiNode { final Types types; final Refactorings refactorings; - Api( + new( this.version, this.domains, this.types, @@ -38,7 +38,7 @@ class ApiNode { /// Html element representing this part of the API, `null` if built-in. final dom.Element? html; - ApiNode(this.html, {this.experimental = false, this.deprecated = false}); + new(this.html, {this.experimental = false, this.deprecated = false}); } /// Base class for visiting the API definition. @@ -60,7 +60,7 @@ class Domain extends ApiNode { final List requests; final List notifications; - Domain( + new( this.name, this.requests, this.notifications, @@ -78,7 +78,7 @@ class HierarchicalApiVisitor extends ApiVisitor { /// The API to visit. final Api api; - HierarchicalApiVisitor(this.api); + new(this.api); /// If [type] is a [TypeReference] that is defined in the API, follow the /// chain until a non-[TypeReference] is found, if possible. @@ -198,7 +198,7 @@ class Notification extends ApiNode { /// object, or null if the notification has no parameters. final TypeObject? params; - Notification( + new( this.domainName, this.event, this.params, @@ -244,7 +244,7 @@ class Refactoring extends ApiNode { /// options. final TypeObject? options; - Refactoring( + new( this.kind, this.feedback, this.options, @@ -257,11 +257,8 @@ class Refactoring extends ApiNode { class Refactorings extends ApiNode with IterableMixin { final List refactorings; - Refactorings( - this.refactorings, - dom.Element? html, { - super.experimental = false, - }) : super(html, deprecated: false); + new(this.refactorings, dom.Element? html, {super.experimental = false}) + : super(html, deprecated: false); @override Iterator get iterator => refactorings.iterator; @@ -283,7 +280,7 @@ class Request extends ApiNode { /// object, or `null` if the response has no results. final TypeObject? result; - Request( + new( this.domainName, this.method, this.params, @@ -341,7 +338,7 @@ class Request extends ApiNode { /// Base class for all possible types. sealed class TypeDecl extends ApiNode { - TypeDecl(super.html, {super.experimental, super.deprecated}); + new(super.html, {super.experimental, super.deprecated}); T accept(ApiVisitor visitor); } @@ -353,7 +350,7 @@ class TypeDefinition extends ApiNode { bool isExternal = false; - TypeDefinition( + new( this.name, this.type, dom.Element html, { @@ -367,7 +364,7 @@ class TypeDefinition extends ApiNode { class TypeEnum extends TypeDecl { final List values; - TypeEnum( + new( this.values, dom.Element html, { super.experimental = false, @@ -382,7 +379,7 @@ class TypeEnum extends TypeDecl { class TypeEnumValue extends ApiNode { final String value; - TypeEnumValue( + new( this.value, dom.Element html, { super.experimental = false, @@ -397,7 +394,7 @@ class TypeEnumValue extends ApiNode { class TypeList extends TypeDecl { final TypeDecl itemType; - TypeList(this.itemType, dom.Element html, {super.experimental = false}) + new(this.itemType, dom.Element html, {super.experimental = false}) : super(html, deprecated: false); @override @@ -415,7 +412,7 @@ class TypeMap extends TypeDecl { /// Type of map values. final TypeDecl valueType; - TypeMap( + new( this.keyType, this.valueType, dom.Element html, { @@ -430,7 +427,7 @@ class TypeMap extends TypeDecl { class TypeObject extends TypeDecl { final List fields; - TypeObject( + new( this.fields, dom.Element? html, { super.experimental = false, @@ -460,7 +457,7 @@ class TypeObjectField extends ApiNode { /// Value that the field is required to contain, or null if it may vary. final Object? value; - TypeObjectField( + new( this.name, this.type, dom.Element? html, { @@ -479,7 +476,7 @@ class TypeObjectField extends ApiNode { class TypeReference extends TypeDecl { final String typeName; - TypeReference(this.typeName, dom.Element? html, {super.experimental = false}) + new(this.typeName, dom.Element? html, {super.experimental = false}) : super(html, deprecated: false) { if (typeName.isEmpty) { throw Exception('Empty type name'); @@ -496,7 +493,7 @@ class Types extends ApiNode with IterableMixin { List importUris = []; - Types(this.types, dom.Element? html, {super.experimental = false}) + new(this.types, dom.Element? html, {super.experimental = false}) : super(html, deprecated: false); @override @@ -516,12 +513,8 @@ class TypeUnion extends TypeDecl { /// The field that is used to disambiguate this union final String field; - TypeUnion( - this.choices, - this.field, - dom.Element html, { - super.experimental = false, - }) : super(html, deprecated: false); + new(this.choices, this.field, dom.Element html, {super.experimental = false}) + : super(html, deprecated: false); @override T accept(ApiVisitor visitor) => visitor.visitTypeUnion(this); diff --git a/pkg/analysis_server/tool/spec/codegen_analysis_server.dart b/pkg/analysis_server/tool/spec/codegen_analysis_server.dart index 6c6908ca0e7..7d3dca72421 100644 --- a/pkg/analysis_server/tool/spec/codegen_analysis_server.dart +++ b/pkg/analysis_server/tool/spec/codegen_analysis_server.dart @@ -16,7 +16,7 @@ final GeneratedFile target = javaGeneratedFile( ); class CodegenAnalysisServer extends CodegenJavaVisitor { - CodegenAnalysisServer(super.api); + new(super.api); @override void visitApi() { diff --git a/pkg/analysis_server/tool/spec/codegen_dart.dart b/pkg/analysis_server/tool/spec/codegen_dart.dart index 158ff7d1b48..77c82d389f3 100644 --- a/pkg/analysis_server/tool/spec/codegen_dart.dart +++ b/pkg/analysis_server/tool/spec/codegen_dart.dart @@ -12,7 +12,7 @@ class DartCodegenVisitor extends HierarchicalApiVisitor { 'object': 'Object', }; - DartCodegenVisitor(super.api); + new(super.api); /// Convert the given [TypeDecl] to a Dart type. String dartType(TypeDecl type) { diff --git a/pkg/analysis_server/tool/spec/codegen_dart_notification_handler.dart b/pkg/analysis_server/tool/spec/codegen_dart_notification_handler.dart index 213e07fa59e..e7e8df1c216 100644 --- a/pkg/analysis_server/tool/spec/codegen_dart_notification_handler.dart +++ b/pkg/analysis_server/tool/spec/codegen_dart_notification_handler.dart @@ -38,7 +38,7 @@ String _generateParamTypeName(String domainName, String event) => /// Visitor which produces Dart code representing the API. class CodegenNotificationHandlerVisitor extends DartCodegenVisitor with CodeGenerator { - CodegenNotificationHandlerVisitor(super.api) { + new(super.api) { codeGeneratorSettings.commentLineLength = 79; codeGeneratorSettings.docCommentStartMarker = null; codeGeneratorSettings.docCommentLineLeader = '/// '; @@ -123,18 +123,13 @@ class _Notification { final String paramsTypeName; final List dartdoc; - _Notification( - this.constName, - this.methodName, - this.paramsTypeName, - this.dartdoc, - ); + new(this.constName, this.methodName, this.paramsTypeName, this.dartdoc); } class _NotificationVisitor extends HierarchicalApiVisitor { final notificationConstants = <_Notification>[]; - _NotificationVisitor(super.api); + new(super.api); @override void visitNotification(Notification notification) { diff --git a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart index 6326f0f0c07..d0282a3ec4d 100644 --- a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart +++ b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart @@ -107,7 +107,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator { /// notifications, etc. final Map impliedTypes; - CodegenProtocolVisitor( + new( this.packageName, this.responseRequiresRequestTime, this.clientUriConverterKind, @@ -1345,7 +1345,7 @@ class FromJsonFunction extends FromJsonCode { final String? castType; - FromJsonFunction(this.asClosure, {this.castType}); + new(this.asClosure, {this.castType}); @override bool get isIdentity => false; @@ -1358,7 +1358,7 @@ class FromJsonFunction extends FromJsonCode { /// Representation of FromJsonCode for the identity transformation. class FromJsonIdentity extends FromJsonSnippet { - FromJsonIdentity() : super((String jsonPath, String json) => json); + new() : super((String jsonPath, String json) => json); @override bool get isIdentity => true; @@ -1370,7 +1370,7 @@ class FromJsonSnippet extends FromJsonCode { /// of the [jsonPath] and [json] variables are known. final FromJsonSnippetCallback callback; - FromJsonSnippet(this.callback); + new(this.callback); @override String get asClosure => @@ -1402,7 +1402,7 @@ class ToJsonFunction extends ToJsonCode { @override final String asClosure; - ToJsonFunction(this.asClosure); + new(this.asClosure); @override bool get isIdentity => false; @@ -1413,7 +1413,7 @@ class ToJsonFunction extends ToJsonCode { /// Representation of FromJsonCode for the identity transformation. class ToJsonIdentity extends ToJsonSnippet { - ToJsonIdentity(String type) : super(type, (String value) => value); + new(String type) : super(type, (String value) => value); @override bool get isIdentity => true; @@ -1428,7 +1428,7 @@ class ToJsonSnippet extends ToJsonCode { /// Dart type of the [value] variable. final String type; - ToJsonSnippet(this.type, this.callback); + new(this.type, this.callback); @override String get asClosure => '($type value) => ${callback('value')}'; diff --git a/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart b/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart index a318c6e02d5..952646736ef 100644 --- a/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart +++ b/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart @@ -39,7 +39,7 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor /// for dispatching notifications. List notificationSwitchContents = []; - CodegenInttestMethodsVisitor(this.packageName, Api api) + new(this.packageName, Api api) : toHtmlVisitor = ToHtmlVisitor(api), super(api) { codeGeneratorSettings.commentLineLength = 79; diff --git a/pkg/analysis_server/tool/spec/codegen_java.dart b/pkg/analysis_server/tool/spec/codegen_java.dart index d5e2aa7df56..671bbf2c05c 100644 --- a/pkg/analysis_server/tool/spec/codegen_java.dart +++ b/pkg/analysis_server/tool/spec/codegen_java.dart @@ -55,7 +55,7 @@ class CodegenJavaVisitor extends HierarchicalApiVisitor with CodeGenerator { /// Visitor used to produce doc comments. final ToHtmlVisitor toHtmlVisitor; - CodegenJavaVisitor(super.api) : toHtmlVisitor = ToHtmlVisitor(api); + new(super.api) : toHtmlVisitor = ToHtmlVisitor(api); /// Create a constructor, using [callback] to create its contents. void constructor(String name, void Function() callback) { diff --git a/pkg/analysis_server/tool/spec/codegen_java_types.dart b/pkg/analysis_server/tool/spec/codegen_java_types.dart index 74f49f4d023..4e7eb4d1825 100644 --- a/pkg/analysis_server/tool/spec/codegen_java_types.dart +++ b/pkg/analysis_server/tool/spec/codegen_java_types.dart @@ -111,7 +111,7 @@ class CodegenJavaType extends CodegenJavaVisitor { final bool generateGetters; final bool generateSetters; - CodegenJavaType( + new( super.api, this.className, this.superclassName, diff --git a/pkg/analysis_server/tool/spec/codegen_matchers.dart b/pkg/analysis_server/tool/spec/codegen_matchers.dart index 4cb258f1468..30b9511e50a 100644 --- a/pkg/analysis_server/tool/spec/codegen_matchers.dart +++ b/pkg/analysis_server/tool/spec/codegen_matchers.dart @@ -28,7 +28,7 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator { /// created. late String context; - CodegenMatchersVisitor(super.api) : toHtmlVisitor = ToHtmlVisitor(api) { + new(super.api) : toHtmlVisitor = ToHtmlVisitor(api) { codeGeneratorSettings.commentLineLength = 79; codeGeneratorSettings.docCommentStartMarker = null; codeGeneratorSettings.docCommentLineLeader = '/// '; diff --git a/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart b/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart index 292ceb84b02..4fd66c20530 100644 --- a/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart +++ b/pkg/analysis_server/tool/spec/codegen_protocol_constants.dart @@ -58,7 +58,7 @@ Iterable _split(String first) { /// A visitor that produces Dart code defining constants associated with the /// API. class _CodegenVisitor extends DartCodegenVisitor with CodeGenerator { - _CodegenVisitor(super.api) { + new(super.api) { codeGeneratorSettings.commentLineLength = 79; codeGeneratorSettings.docCommentStartMarker = null; codeGeneratorSettings.docCommentLineLeader = '/// '; @@ -106,7 +106,7 @@ class _Constant { final String value; /// Initialize a newly created constant. - _Constant(this.name, this.value); + new(this.name, this.value); } /// A visitor that visits an API to compute a list of constants to be generated. @@ -115,7 +115,7 @@ class _ConstantVisitor extends HierarchicalApiVisitor { List<_Constant> constants = <_Constant>[]; /// Initialize a newly created visitor to visit the given [api]. - _ConstantVisitor(super.api); + new(super.api); @override void visitNotification(Notification notification) { diff --git a/pkg/analysis_server/tool/spec/from_html.dart b/pkg/analysis_server/tool/spec/from_html.dart index 789af7d3c17..c6daa366a7f 100644 --- a/pkg/analysis_server/tool/spec/from_html.dart +++ b/pkg/analysis_server/tool/spec/from_html.dart @@ -58,7 +58,7 @@ class ApiReader { /// Initialize a newly created API reader to read from the file with the given /// [filePath]. - ApiReader(this.filePath); + new(this.filePath); /// Create an [Api] object from an HTML representation such as: /// diff --git a/pkg/analysis_server/tool/spec/implied_types.dart b/pkg/analysis_server/tool/spec/implied_types.dart index f83bef70ac7..ad7423b5613 100644 --- a/pkg/analysis_server/tool/spec/implied_types.dart +++ b/pkg/analysis_server/tool/spec/implied_types.dart @@ -32,7 +32,7 @@ class ImpliedType { /// API node from which this type was inferred. final ApiNode apiNode; - ImpliedType( + new( this.camelName, this.humanReadableName, this.type, @@ -44,7 +44,7 @@ class ImpliedType { class _ImpliedTypesVisitor extends HierarchicalApiVisitor { Map impliedTypes = {}; - _ImpliedTypesVisitor(super.api); + new(super.api); void storeType( String name, diff --git a/pkg/analysis_server/tool/spec/to_html.dart b/pkg/analysis_server/tool/spec/to_html.dart index 9e6d535f15e..3805d8674ff 100644 --- a/pkg/analysis_server/tool/spec/to_html.dart +++ b/pkg/analysis_server/tool/spec/to_html.dart @@ -147,7 +147,7 @@ String _toTitleCase(String str) { class ApiMappings extends HierarchicalApiVisitor { Map domains = {}; - ApiMappings(super.api); + new(super.api); @override void visitDomain(Domain domain) { @@ -221,7 +221,7 @@ class ToHtmlVisitor extends HierarchicalApiVisitor /// Mappings from HTML elements to API nodes. ApiMappings apiMappings; - ToHtmlVisitor(super.api) : apiMappings = ApiMappings(api) { + new(super.api) : apiMappings = ApiMappings(api) { apiMappings.visitApi(); } @@ -739,7 +739,7 @@ class TypeVisitor extends HierarchicalApiVisitor /// objects are shown as simply "object", and enums are shown as "String". final bool short; - TypeVisitor(super.api, {this.fieldsToBold = const {}, this.short = false}); + new(super.api, {this.fieldsToBold = const {}, this.short = false}); @override void visitTypeEnum(TypeEnum typeEnum) { diff --git a/pkg/analysis_server_client/analysis_options.yaml b/pkg/analysis_server_client/analysis_options.yaml index 65b34cd2f63..e5b6a457be2 100644 --- a/pkg/analysis_server_client/analysis_options.yaml +++ b/pkg/analysis_server_client/analysis_options.yaml @@ -12,6 +12,8 @@ analyzer: linter: rules: + - unnecessary_type_name_in_constructor + - unnecessary_const_in_enum_constructor - always_declare_return_types - avoid_bool_literals_in_conditional_expressions - no_literal_bool_comparisons diff --git a/pkg/analysis_server_client/example/example.dart b/pkg/analysis_server_client/example/example.dart index f9f393ed594..72fffbbb37e 100644 --- a/pkg/analysis_server_client/example/example.dart +++ b/pkg/analysis_server_client/example/example.dart @@ -69,7 +69,7 @@ class _Handler with NotificationHandler, ConnectionHandler { final Server server; int errorCount = 0; - _Handler(this.server); + new(this.server); @override void onAnalysisErrors(AnalysisErrorsParams params) { diff --git a/pkg/analysis_server_client/lib/server.dart b/pkg/analysis_server_client/lib/server.dart index f4921203ebf..57d5f52df53 100644 --- a/pkg/analysis_server_client/lib/server.dart +++ b/pkg/analysis_server_client/lib/server.dart @@ -30,7 +30,7 @@ class Server extends ServerBase { /// [listenToOutput] has not been called or [stop] has been called. StreamSubscription? _stdoutSubscription; - Server({super.listener, this._process, super.stdioPassthrough}); + new({super.listener, this._process, super.stdioPassthrough}); /// Force kill the server. Returns exit code future. @override diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_base.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_base.dart index bdbd13ac3a9..d15b2d0673e 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_base.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_base.dart @@ -41,10 +41,10 @@ class Notification { /// Initialize a newly created [Notification] to have the given [event] name. /// If [params] is provided, it will be used as the params; otherwise no /// params will be used. - Notification(this.event, [this.params]); + new(this.event, [this.params]); /// Initialize a newly created instance based on the given JSON data. - factory Notification.fromJson(Map json) { + factory fromJson(Map json) { return Notification( json[Notification.EVENT], json[Notification.PARAMS] as Map, @@ -97,7 +97,7 @@ class Request { /// Initialize a newly created [Request] to have the given [id] and [method] /// name. If [params] is supplied, it is used as the "params" map for the /// request. Otherwise an empty "params" map is allocated. - Request( + new( this.id, this.method, [ Map? params, @@ -272,7 +272,7 @@ class RequestFailure implements Exception { final Response response; /// Initialize a newly created exception to return the given response. - RequestFailure(this.response); + new(this.response); } /// An object that can handle requests and produce responses for them. @@ -320,10 +320,10 @@ class Response { /// with the given [id]. If [result] is provided, it will be used as the /// result; otherwise an empty result will be used. If an [error] is provided /// then the response will represent an error condition. - Response(this.id, {this.result, this.error}); + new(this.id, {this.result, this.error}); /// Create and return the `DEBUG_PORT_COULD_NOT_BE_OPENED` error response. - Response.debugPortCouldNotBeOpened(Request request, dynamic error) + new debugPortCouldNotBeOpened(Request request, dynamic error) : this( request.id, error: RequestError( @@ -334,7 +334,7 @@ class Response { /// Initialize a newly created instance to represent the FILE_NOT_ANALYZED /// error condition. - Response.fileNotAnalyzed(Request request, String file) + new fileNotAnalyzed(Request request, String file) : this( request.id, error: RequestError( @@ -345,7 +345,7 @@ class Response { /// Initialize a newly created instance to represent the FORMAT_INVALID_FILE /// error condition. - Response.formatInvalidFile(Request request) + new formatInvalidFile(Request request) : this( request.id, error: RequestError( @@ -356,7 +356,7 @@ class Response { /// Initialize a newly created instance to represent the FORMAT_WITH_ERROR /// error condition. - Response.formatWithErrors(Request request) + new formatWithErrors(Request request) : this( request.id, error: RequestError( @@ -367,7 +367,7 @@ class Response { /// Initialize a newly created instance to represent the /// GET_ERRORS_INVALID_FILE error condition. - Response.getErrorsInvalidFile(Request request) + new getErrorsInvalidFile(Request request) : this( request.id, error: RequestError( @@ -378,7 +378,7 @@ class Response { /// Initialize a newly created instance to represent the /// GET_IMPORTED_ELEMENTS_INVALID_FILE error condition. - Response.getImportedElementsInvalidFile(Request request) + new getImportedElementsInvalidFile(Request request) : this( request.id, error: RequestError( @@ -389,7 +389,7 @@ class Response { /// Initialize a newly created instance to represent the /// GET_NAVIGATION_INVALID_FILE error condition. - Response.getNavigationInvalidFile(Request request) + new getNavigationInvalidFile(Request request) : this( request.id, error: RequestError( @@ -400,7 +400,7 @@ class Response { /// Initialize a newly created instance to represent the /// GET_REACHABLE_SOURCES_INVALID_FILE error condition. - Response.getReachableSourcesInvalidFile(Request request) + new getReachableSourcesInvalidFile(Request request) : this( request.id, error: RequestError( @@ -411,7 +411,7 @@ class Response { /// Initialize a newly created instance to represent the /// GET_SIGNATURE_INVALID_FILE error condition. - Response.getSignatureInvalidFile(Request request) + new getSignatureInvalidFile(Request request) : this( request.id, error: RequestError( @@ -422,7 +422,7 @@ class Response { /// Initialize a newly created instance to represent the /// GET_SIGNATURE_INVALID_OFFSET error condition. - Response.getSignatureInvalidOffset(Request request) + new getSignatureInvalidOffset(Request request) : this( request.id, error: RequestError( @@ -433,7 +433,7 @@ class Response { /// Initialize a newly created instance to represent the /// GET_SIGNATURE_UNKNOWN_FUNCTION error condition. - Response.getSignatureUnknownFunction(Request request) + new getSignatureUnknownFunction(Request request) : this( request.id, error: RequestError( @@ -444,7 +444,7 @@ class Response { /// Initialize a newly created instance to represent the /// IMPORT_ELEMENTS_INVALID_FILE error condition. - Response.importElementsInvalidFile(Request request) + new importElementsInvalidFile(Request request) : this( request.id, error: RequestError( @@ -456,7 +456,7 @@ class Response { /// Initialize a newly created instance to represent an error condition caused /// by an analysis.reanalyze [request] that specifies an analysis root that is /// not in the current list of analysis roots. - Response.invalidAnalysisRoot(Request request, String rootPath) + new invalidAnalysisRoot(Request request, String rootPath) : this( request.id, error: RequestError( @@ -468,7 +468,7 @@ class Response { /// Initialize a newly created instance to represent an error condition caused /// by a [request] that specifies an execution context whose context root does /// not exist. - Response.invalidExecutionContext(Request request, String contextId) + new invalidExecutionContext(Request request, String contextId) : this( request.id, error: RequestError( @@ -479,7 +479,7 @@ class Response { /// Initialize a newly created instance to represent the /// INVALID_FILE_PATH_FORMAT error condition. - Response.invalidFilePathFormat(Request request, path) + new invalidFilePathFormat(Request request, path) : this( request.id, error: RequestError( @@ -493,7 +493,7 @@ class Response { /// invalid parameter, in JavaScript notation (e.g. "foo.bar" means that the /// parameter "foo" contained a key "bar" whose value was the wrong type). /// [expectation] is a description of the type of data that was expected. - Response.invalidParameter(Request request, String path, String expectation) + new invalidParameter(Request request, String path, String expectation) : this( request.id, error: RequestError( @@ -504,7 +504,7 @@ class Response { /// Initialize a newly created instance to represent an error condition caused /// by a malformed request. - Response.invalidRequestFormat() + new invalidRequestFormat() : this( '', error: RequestError( @@ -515,7 +515,7 @@ class Response { /// Initialize a newly created instance to represent the /// ORGANIZE_DIRECTIVES_ERROR error condition. - Response.organizeDirectivesError(Request request, String message) + new organizeDirectivesError(Request request, String message) : this( request.id, error: RequestError( @@ -526,7 +526,7 @@ class Response { /// Initialize a newly created instance to represent the /// REFACTORING_REQUEST_CANCELLED error condition. - Response.refactoringRequestCancelled(Request request) + new refactoringRequestCancelled(Request request) : this( request.id, error: RequestError( @@ -537,7 +537,7 @@ class Response { /// Initialize a newly created instance to represent the SERVER_ERROR error /// condition. - factory Response.serverError(Request request, exception, stackTrace) { + factory serverError(Request request, exception, stackTrace) { var error = RequestError( RequestErrorCode.SERVER_ERROR, exception.toString(), @@ -550,7 +550,7 @@ class Response { /// Initialize a newly created instance to represent the /// SORT_MEMBERS_INVALID_FILE error condition. - Response.sortMembersInvalidFile(Request request) + new sortMembersInvalidFile(Request request) : this( request.id, error: RequestError( @@ -561,7 +561,7 @@ class Response { /// Initialize a newly created instance to represent the /// SORT_MEMBERS_PARSE_ERRORS error condition. - Response.sortMembersParseErrors(Request request, int numErrors) + new sortMembersParseErrors(Request request, int numErrors) : this( request.id, error: RequestError( @@ -572,7 +572,7 @@ class Response { /// Initialize a newly created instance to represent an error condition caused /// by a [request] that cannot be handled by any known handlers. - Response.unknownRequest(Request request) + new unknownRequest(Request request) : this( request.id, error: RequestError( @@ -583,7 +583,7 @@ class Response { /// Initialize a newly created instance to represent an error condition caused /// by a [request] for a service that is not supported. - Response.unsupportedFeature(String requestId, String message) + new unsupportedFeature(String requestId, String message) : this( requestId, error: RequestError(RequestErrorCode.UNSUPPORTED_FEATURE, message), diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart index 7465ccc2e08..73b6b8f3844 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart @@ -442,7 +442,7 @@ class RequestDecoder extends JsonDecoder { /// The request being deserialized. final Request _request; - RequestDecoder(this._request); + new(this._request); @override RefactoringKind? get refactoringKind { @@ -483,7 +483,7 @@ class ResponseDecoder extends JsonDecoder { @override final RefactoringKind? refactoringKind; - ResponseDecoder(this.refactoringKind); + new(this.refactoringKind); @override dynamic mismatch(String jsonPath, String expected, [Object? actual]) { diff --git a/pkg/analysis_server_client/lib/src/server_base.dart b/pkg/analysis_server_client/lib/src/server_base.dart index 75b5069df5e..d5acb16f29f 100644 --- a/pkg/analysis_server_client/lib/src/server_base.dart +++ b/pkg/analysis_server_client/lib/src/server_base.dart @@ -79,7 +79,7 @@ abstract class ServerBase { /// when acknowledgement is received. final _pendingCommands = ?>>{}; - ServerBase({this._listener, this._stdioPassthrough = false}); + new({this._listener, this._stdioPassthrough = false}); ServerListener? get listener => _listener; diff --git a/pkg/analysis_server_client/pubspec.yaml b/pkg/analysis_server_client/pubspec.yaml index ad04d03fcbb..7227b2f4b4e 100644 --- a/pkg/analysis_server_client/pubspec.yaml +++ b/pkg/analysis_server_client/pubspec.yaml @@ -10,7 +10,7 @@ repository: https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server_clien publish_to: none environment: - sdk: '^3.12.0-0' + sdk: '^3.13.0-0' resolution: workspace diff --git a/pkg/analysis_server_client/test/live_test.dart b/pkg/analysis_server_client/test/live_test.dart index 496da18a64b..87207ee26ec 100644 --- a/pkg/analysis_server_client/test/live_test.dart +++ b/pkg/analysis_server_client/test/live_test.dart @@ -37,7 +37,7 @@ class TestHandler with NotificationHandler, ConnectionHandler { @override final Server server; - TestHandler(this.server); + new(this.server); } class TestListener with ServerListener { diff --git a/pkg/analysis_server_client/test/verify_sorted_test.dart b/pkg/analysis_server_client/test/verify_sorted_test.dart index 3bfc3f70934..f04869f516f 100644 --- a/pkg/analysis_server_client/test/verify_sorted_test.dart +++ b/pkg/analysis_server_client/test/verify_sorted_test.dart @@ -110,7 +110,7 @@ class StatusHandler with NotificationHandler, ConnectionHandler { final Completer initialAnalysis = Completer(); - StatusHandler(this.server); + new(this.server); @override void onServerStatus(ServerStatusParams params) { diff --git a/pkg/linter/analysis_options.yaml b/pkg/linter/analysis_options.yaml index 5b508a14ab4..1fa31701215 100644 --- a/pkg/linter/analysis_options.yaml +++ b/pkg/linter/analysis_options.yaml @@ -12,6 +12,8 @@ analyzer: linter: rules: + - unnecessary_type_name_in_constructor + - unnecessary_const_in_enum_constructor - always_put_required_named_parameters_first - avoid_annotating_with_dynamic - avoid_bool_literals_in_conditional_expressions diff --git a/pkg/linter/lib/src/extensions.dart b/pkg/linter/lib/src/extensions.dart index ab9ca988bdb..726d5241bdc 100644 --- a/pkg/linter/lib/src/extensions.dart +++ b/pkg/linter/lib/src/extensions.dart @@ -15,7 +15,7 @@ import 'package:collection/collection.dart'; class EnumLikeClassDescription { final Map> _enumConstants; - EnumLikeClassDescription(this._enumConstants); + new(this._enumConstants); /// Returns a fresh map of the class's enum-like constant values. Map> get enumConstants => {..._enumConstants}; @@ -27,7 +27,7 @@ class InterfaceTypeDefinition { final String name; final String library; - InterfaceTypeDefinition(this.name, this.library); + new(this.name, this.library); @override int get hashCode => Object.hash(name, library); diff --git a/pkg/linter/lib/src/lint_codes.dart b/pkg/linter/lib/src/lint_codes.dart index acc5bbe9cd5..914a5d90169 100644 --- a/pkg/linter/lib/src/lint_codes.dart +++ b/pkg/linter/lib/src/lint_codes.dart @@ -5,7 +5,7 @@ import 'analyzer.dart'; class LinterLintCode extends LintCodeWithExpectedTypes { - const LinterLintCode({ + const new({ required super.name, required super.problemMessage, required super.uniqueName, @@ -29,7 +29,7 @@ final class LinterLintTemplate extends LinterLintCode final T withArguments; /// Initialize a newly created error code to have the given [name]. - const LinterLintTemplate({ + const new({ required super.name, required super.problemMessage, required this.withArguments, @@ -43,7 +43,7 @@ final class LinterLintTemplate extends LinterLintCode final class LinterLintWithoutArguments extends LinterLintCode with DiagnosticWithoutArguments { /// Initialize a newly created error code to have the given [name]. - const LinterLintWithoutArguments({ + const new({ required super.name, required super.problemMessage, required super.expectedTypes, diff --git a/pkg/linter/lib/src/rules/always_declare_return_types.dart b/pkg/linter/lib/src/rules/always_declare_return_types.dart index 40ded3b7dfe..5ec60ab78b3 100644 --- a/pkg/linter/lib/src/rules/always_declare_return_types.dart +++ b/pkg/linter/lib/src/rules/always_declare_return_types.dart @@ -17,7 +17,7 @@ import '../extensions.dart'; const _desc = r'Declare method return types.'; class AlwaysDeclareReturnTypes extends MultiAnalysisRule { - AlwaysDeclareReturnTypes() + new() : super(name: LintNames.always_declare_return_types, description: _desc); @override @@ -42,7 +42,7 @@ class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitFunctionDeclaration(FunctionDeclaration node) { diff --git a/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart b/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart index e60bb1ed26c..b1618e05b83 100644 --- a/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart +++ b/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Separate the control structure expression from its statement.'; class AlwaysPutControlBodyOnNewLine extends AnalysisRule { - AlwaysPutControlBodyOnNewLine() + new() : super( name: LintNames.always_put_control_body_on_new_line, description: _desc, @@ -40,7 +40,7 @@ class AlwaysPutControlBodyOnNewLine extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitDoStatement(DoStatement node) { diff --git a/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart b/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart index 9b68c36029e..bfec74ab079 100644 --- a/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart +++ b/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Put required named parameters first.'; class AlwaysPutRequiredNamedParametersFirst extends AnalysisRule { - AlwaysPutRequiredNamedParametersFirst() + new() : super( name: LintNames.always_put_required_named_parameters_first, description: _desc, @@ -38,7 +38,7 @@ class AlwaysPutRequiredNamedParametersFirst extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFormalParameterList(FormalParameterList node) { diff --git a/pkg/linter/lib/src/rules/always_specify_types.dart b/pkg/linter/lib/src/rules/always_specify_types.dart index 7a744c8a5c2..c8f05c1f010 100644 --- a/pkg/linter/lib/src/rules/always_specify_types.dart +++ b/pkg/linter/lib/src/rules/always_specify_types.dart @@ -19,8 +19,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Specify type annotations.'; class AlwaysSpecifyTypes extends MultiAnalysisRule { - AlwaysSpecifyTypes() - : super(name: LintNames.always_specify_types, description: _desc); + new() : super(name: LintNames.always_specify_types, description: _desc); @override List get diagnosticCodes => [ @@ -57,7 +56,7 @@ class AlwaysSpecifyTypes extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void checkLiteral(TypedLiteral literal) { if (literal.typeArguments == null) { diff --git a/pkg/linter/lib/src/rules/always_use_package_imports.dart b/pkg/linter/lib/src/rules/always_use_package_imports.dart index c09d0c1689f..f3b68aed9d5 100644 --- a/pkg/linter/lib/src/rules/always_use_package_imports.dart +++ b/pkg/linter/lib/src/rules/always_use_package_imports.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid relative imports for files in `lib/`.'; class AlwaysUsePackageImports extends AnalysisRule { - AlwaysUsePackageImports() - : super(name: LintNames.always_use_package_imports, description: _desc); + new() : super(name: LintNames.always_use_package_imports, description: _desc); @override DiagnosticCode get diagnosticCode => diag.alwaysUsePackageImports; @@ -43,7 +42,7 @@ class AlwaysUsePackageImports extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); bool isRelativeImport(ImportDirective node) { var uriContent = node.uri.stringValue; diff --git a/pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart b/pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart index b7bf88ad5f9..4ff88c53b41 100644 --- a/pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart +++ b/pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart @@ -19,7 +19,7 @@ const _desc = 'Specify element model tracking annotation.'; class AnalyzerElementModelTracking extends MultiAnalysisRule { static const ruleName = 'analyzer_element_model_tracking'; - AnalyzerElementModelTracking() + new() : super( name: ruleName, description: _desc, @@ -47,13 +47,13 @@ class _TrackingAnnotation { final Annotation node; final ElementAnnotation element; - _TrackingAnnotation({required this.node, required this.element}); + new({required this.node, required this.element}); } class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/analyzer_public_api.dart b/pkg/linter/lib/src/rules/analyzer_public_api.dart index 756ad19aa67..f463435e987 100644 --- a/pkg/linter/lib/src/rules/analyzer_public_api.dart +++ b/pkg/linter/lib/src/rules/analyzer_public_api.dart @@ -21,7 +21,7 @@ const _desc = class AnalyzerPublicApi extends MultiAnalysisRule { static const ruleName = 'analyzer_public_api'; - AnalyzerPublicApi() + new() : super( name: ruleName, description: _desc, @@ -63,7 +63,7 @@ enum _ProblematicTypeUseKind { class _PublicImport { final Element? Function(String name) lookup; - _PublicImport({required this.lookup}); + new({required this.lookup}); } class _Visitor extends SimpleAstVisitor { @@ -75,7 +75,7 @@ class _Visitor extends SimpleAstVisitor { /// Cache for [_isPubliclyImported]. Map _isImportedMemo = Map.identity(); - _Visitor(this.rule); + new(this.rule); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/annotate_overrides.dart b/pkg/linter/lib/src/rules/annotate_overrides.dart index 8539eb0989e..3c6c21e0a7c 100644 --- a/pkg/linter/lib/src/rules/annotate_overrides.dart +++ b/pkg/linter/lib/src/rules/annotate_overrides.dart @@ -18,8 +18,7 @@ import '../extensions.dart'; const _desc = r'Annotate overridden members.'; class AnnotateOverrides extends AnalysisRule { - AnnotateOverrides() - : super(name: LintNames.annotate_overrides, description: _desc); + new() : super(name: LintNames.annotate_overrides, description: _desc); @override DiagnosticCode get diagnosticCode => diag.annotateOverrides; @@ -40,7 +39,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); void check(Element? element, Token target) { if (element == null) return; diff --git a/pkg/linter/lib/src/rules/annotate_redeclares.dart b/pkg/linter/lib/src/rules/annotate_redeclares.dart index 864b16c595e..84911f5e3d7 100644 --- a/pkg/linter/lib/src/rules/annotate_redeclares.dart +++ b/pkg/linter/lib/src/rules/annotate_redeclares.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Annotate redeclared members.'; class AnnotateRedeclares extends AnalysisRule { - AnnotateRedeclares() + new() : super( name: LintNames.annotate_redeclares, description: _desc, @@ -40,7 +40,7 @@ class AnnotateRedeclares extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitExtensionTypeDeclaration(ExtensionTypeDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_annotating_with_dynamic.dart b/pkg/linter/lib/src/rules/avoid_annotating_with_dynamic.dart index 27169810d47..a2ad53dc6d3 100644 --- a/pkg/linter/lib/src/rules/avoid_annotating_with_dynamic.dart +++ b/pkg/linter/lib/src/rules/avoid_annotating_with_dynamic.dart @@ -17,7 +17,7 @@ import '../extensions.dart'; const _desc = r'Avoid annotating with `dynamic` when not required.'; class AvoidAnnotatingWithDynamic extends AnalysisRule { - AvoidAnnotatingWithDynamic() + new() : super(name: LintNames.avoid_annotating_with_dynamic, description: _desc); @override @@ -38,7 +38,7 @@ class AvoidAnnotatingWithDynamic extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldFormalParameter(FieldFormalParameter node) { diff --git a/pkg/linter/lib/src/rules/avoid_bool_literals_in_conditional_expressions.dart b/pkg/linter/lib/src/rules/avoid_bool_literals_in_conditional_expressions.dart index 94e73d5d405..9591e9203af 100644 --- a/pkg/linter/lib/src/rules/avoid_bool_literals_in_conditional_expressions.dart +++ b/pkg/linter/lib/src/rules/avoid_bool_literals_in_conditional_expressions.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid `bool` literals in conditional expressions.'; class AvoidBoolLiteralsInConditionalExpressions extends AnalysisRule { - AvoidBoolLiteralsInConditionalExpressions() + new() : super( name: LintNames.avoid_bool_literals_in_conditional_expressions, description: _desc, @@ -40,7 +40,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitConditionalExpression(ConditionalExpression node) { diff --git a/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart b/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart index 64555c060a8..f8db9672919 100644 --- a/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart +++ b/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart @@ -18,7 +18,7 @@ import '../extensions.dart'; const _desc = r'Avoid catches without on clauses.'; class AvoidCatchesWithoutOnClauses extends AnalysisRule { - AvoidCatchesWithoutOnClauses() + new() : super( name: LintNames.avoid_catches_without_on_clauses, description: _desc, @@ -42,7 +42,7 @@ class _CaughtExceptionUseVisitor extends RecursiveAstVisitor { var exceptionWasUsed = false; - _CaughtExceptionUseVisitor(this.caughtException); + new(this.caughtException); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -59,7 +59,7 @@ class _ValidUseVisitor extends RecursiveAstVisitor { var _canRethrow = true; - _ValidUseVisitor(this.caughtException); + new(this.caughtException); @override void visitCatchClause(CatchClause node) { @@ -137,7 +137,7 @@ class _ValidUseVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitCatchClause(CatchClause node) { diff --git a/pkg/linter/lib/src/rules/avoid_catching_errors.dart b/pkg/linter/lib/src/rules/avoid_catching_errors.dart index 03ebf73e366..a7f49eac952 100644 --- a/pkg/linter/lib/src/rules/avoid_catching_errors.dart +++ b/pkg/linter/lib/src/rules/avoid_catching_errors.dart @@ -16,8 +16,7 @@ import '../extensions.dart'; const _desc = r"Don't explicitly catch `Error` or types that implement it."; class AvoidCatchingErrors extends MultiAnalysisRule { - AvoidCatchingErrors() - : super(name: LintNames.avoid_catching_errors, description: _desc); + new() : super(name: LintNames.avoid_catching_errors, description: _desc); @override List get diagnosticCodes => [ @@ -38,7 +37,7 @@ class AvoidCatchingErrors extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitCatchClause(CatchClause node) { diff --git a/pkg/linter/lib/src/rules/avoid_classes_with_only_static_members.dart b/pkg/linter/lib/src/rules/avoid_classes_with_only_static_members.dart index 2713ece0467..34ea00e94e8 100644 --- a/pkg/linter/lib/src/rules/avoid_classes_with_only_static_members.dart +++ b/pkg/linter/lib/src/rules/avoid_classes_with_only_static_members.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid defining a class that contains only static members.'; class AvoidClassesWithOnlyStaticMembers extends AnalysisRule { - AvoidClassesWithOnlyStaticMembers() + new() : super( name: LintNames.avoid_classes_with_only_static_members, description: _desc, @@ -39,7 +39,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_double_and_int_checks.dart b/pkg/linter/lib/src/rules/avoid_double_and_int_checks.dart index 6a6ea44b7d1..65d01ef1294 100644 --- a/pkg/linter/lib/src/rules/avoid_double_and_int_checks.dart +++ b/pkg/linter/lib/src/rules/avoid_double_and_int_checks.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid `double` and `int` checks.'; class AvoidDoubleAndIntChecks extends AnalysisRule { - AvoidDoubleAndIntChecks() + new() : super(name: LintNames.avoid_double_and_int_checks, description: _desc); @override @@ -37,7 +37,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitIfStatement(IfStatement node) { diff --git a/pkg/linter/lib/src/rules/avoid_dynamic_calls.dart b/pkg/linter/lib/src/rules/avoid_dynamic_calls.dart index 66cea5ae97a..9f382c57224 100644 --- a/pkg/linter/lib/src/rules/avoid_dynamic_calls.dart +++ b/pkg/linter/lib/src/rules/avoid_dynamic_calls.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid method calls or property accesses on a `dynamic` target.'; class AvoidDynamicCalls extends AnalysisRule { - AvoidDynamicCalls() - : super(name: LintNames.avoid_dynamic_calls, description: _desc); + new() : super(name: LintNames.avoid_dynamic_calls, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidDynamicCalls; @@ -54,7 +53,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAssignmentExpression(AssignmentExpression node) { diff --git a/pkg/linter/lib/src/rules/avoid_empty_else.dart b/pkg/linter/lib/src/rules/avoid_empty_else.dart index a39bbb13859..b281b34fefd 100644 --- a/pkg/linter/lib/src/rules/avoid_empty_else.dart +++ b/pkg/linter/lib/src/rules/avoid_empty_else.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid empty statements in else clauses.'; class AvoidEmptyElse extends AnalysisRule { - AvoidEmptyElse() - : super(name: LintNames.avoid_empty_else, description: _desc); + new() : super(name: LintNames.avoid_empty_else, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidEmptyElse; @@ -34,7 +33,7 @@ class AvoidEmptyElse extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitIfStatement(IfStatement node) { diff --git a/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart b/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart index a18ac223f7a..03012eaf311 100644 --- a/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart +++ b/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart @@ -20,7 +20,7 @@ const _desc = r'Avoid overloading operator == and hashCode on classes not marked `@immutable`.'; class AvoidEqualsAndHashCodeOnMutableClasses extends AnalysisRule { - AvoidEqualsAndHashCodeOnMutableClasses() + new() : super( name: LintNames.avoid_equals_and_hash_code_on_mutable_classes, description: _desc, @@ -43,7 +43,7 @@ class AvoidEqualsAndHashCodeOnMutableClasses extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_escaping_inner_quotes.dart b/pkg/linter/lib/src/rules/avoid_escaping_inner_quotes.dart index eace041660b..d3f209be715 100644 --- a/pkg/linter/lib/src/rules/avoid_escaping_inner_quotes.dart +++ b/pkg/linter/lib/src/rules/avoid_escaping_inner_quotes.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid escaping inner quotes by converting surrounding quotes.'; class AvoidEscapingInnerQuotes extends AnalysisRule { - AvoidEscapingInnerQuotes() + new() : super(name: LintNames.avoid_escaping_inner_quotes, description: _desc); @override @@ -35,7 +35,7 @@ class AvoidEscapingInnerQuotes extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitSimpleStringLiteral(SimpleStringLiteral node) { diff --git a/pkg/linter/lib/src/rules/avoid_field_initializers_in_const_classes.dart b/pkg/linter/lib/src/rules/avoid_field_initializers_in_const_classes.dart index 427b178b322..fe70e608c80 100644 --- a/pkg/linter/lib/src/rules/avoid_field_initializers_in_const_classes.dart +++ b/pkg/linter/lib/src/rules/avoid_field_initializers_in_const_classes.dart @@ -17,7 +17,7 @@ import '../extensions.dart'; const _desc = r'Avoid field initializers in const classes.'; class AvoidFieldInitializersInConstClasses extends AnalysisRule { - AvoidFieldInitializersInConstClasses() + new() : super( name: LintNames.avoid_field_initializers_in_const_classes, description: _desc, @@ -43,7 +43,7 @@ class HasParameterReferenceVisitor extends RecursiveAstVisitor { bool useParameter = false; - HasParameterReferenceVisitor(this.parameters); + new(this.parameters); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -58,7 +58,7 @@ class HasParameterReferenceVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorFieldInitializer(ConstructorFieldInitializer node) { diff --git a/pkg/linter/lib/src/rules/avoid_final_parameters.dart b/pkg/linter/lib/src/rules/avoid_final_parameters.dart index 16b4355b0ef..b997c6887a6 100644 --- a/pkg/linter/lib/src/rules/avoid_final_parameters.dart +++ b/pkg/linter/lib/src/rules/avoid_final_parameters.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid `final` for parameter declarations.'; class AvoidFinalParameters extends AnalysisRule { - AvoidFinalParameters() - : super(name: LintNames.avoid_final_parameters, description: _desc); + new() : super(name: LintNames.avoid_final_parameters, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidFinalParameters; @@ -43,7 +42,7 @@ class AvoidFinalParameters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFormalParameterList(FormalParameterList node) { diff --git a/pkg/linter/lib/src/rules/avoid_function_literals_in_foreach_calls.dart b/pkg/linter/lib/src/rules/avoid_function_literals_in_foreach_calls.dart index 6159af143ae..fcae02d48c6 100644 --- a/pkg/linter/lib/src/rules/avoid_function_literals_in_foreach_calls.dart +++ b/pkg/linter/lib/src/rules/avoid_function_literals_in_foreach_calls.dart @@ -40,7 +40,7 @@ bool _isIterable(DartType? type) => type != null && type.implementsInterface('Iterable', 'dart.core'); class AvoidFunctionLiteralsInForeachCalls extends AnalysisRule { - AvoidFunctionLiteralsInForeachCalls() + new() : super( name: LintNames.avoid_function_literals_in_foreach_calls, description: _desc, @@ -62,7 +62,7 @@ class AvoidFunctionLiteralsInForeachCalls extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation node) { diff --git a/pkg/linter/lib/src/rules/avoid_futureor_void.dart b/pkg/linter/lib/src/rules/avoid_futureor_void.dart index 81c34f06619..e030fbdb409 100644 --- a/pkg/linter/lib/src/rules/avoid_futureor_void.dart +++ b/pkg/linter/lib/src/rules/avoid_futureor_void.dart @@ -18,7 +18,7 @@ import '../util/variance_checker.dart'; const _desc = r"Avoid using 'FutureOr' as the type of a result."; class AvoidFutureOrVoid extends AnalysisRule { - AvoidFutureOrVoid() + new() : super( name: LintNames.avoid_futureor_void, description: _desc, @@ -53,7 +53,7 @@ class AvoidFutureOrVoid extends AnalysisRule { class _FutureOrVarianceChecker extends VarianceChecker { final AnalysisRule rule; - _FutureOrVarianceChecker(this.rule); + new(this.rule); @override void checkNamedType( @@ -78,7 +78,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; final VarianceChecker checker; - _Visitor(this.rule, this.context) : checker = _FutureOrVarianceChecker(rule); + new(this.rule, this.context) : checker = _FutureOrVarianceChecker(rule); @override void visitAsExpression(AsExpression node) => checker.checkOut(node.type); diff --git a/pkg/linter/lib/src/rules/avoid_implementing_value_types.dart b/pkg/linter/lib/src/rules/avoid_implementing_value_types.dart index 0ead81df8f1..ede25433d82 100644 --- a/pkg/linter/lib/src/rules/avoid_implementing_value_types.dart +++ b/pkg/linter/lib/src/rules/avoid_implementing_value_types.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't implement classes that override `==`."; class AvoidImplementingValueTypes extends AnalysisRule { - AvoidImplementingValueTypes() + new() : super(name: LintNames.avoid_implementing_value_types, description: _desc); @override @@ -38,7 +38,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_init_to_null.dart b/pkg/linter/lib/src/rules/avoid_init_to_null.dart index 4332ceb0350..381fb2ec08c 100644 --- a/pkg/linter/lib/src/rules/avoid_init_to_null.dart +++ b/pkg/linter/lib/src/rules/avoid_init_to_null.dart @@ -18,8 +18,7 @@ import '../extensions.dart'; const _desc = r"Don't explicitly initialize variables to `null`."; class AvoidInitToNull extends AnalysisRule { - AvoidInitToNull() - : super(name: LintNames.avoid_init_to_null, description: _desc); + new() : super(name: LintNames.avoid_init_to_null, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidInitToNull; @@ -41,7 +40,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); bool isNullable(DartType type) => context.typeSystem.isNullable(type); diff --git a/pkg/linter/lib/src/rules/avoid_js_rounded_ints.dart b/pkg/linter/lib/src/rules/avoid_js_rounded_ints.dart index 3eec1375068..d34d7174005 100644 --- a/pkg/linter/lib/src/rules/avoid_js_rounded_ints.dart +++ b/pkg/linter/lib/src/rules/avoid_js_rounded_ints.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid JavaScript rounded ints.'; class AvoidJsRoundedInts extends AnalysisRule { - AvoidJsRoundedInts() - : super(name: LintNames.avoid_js_rounded_ints, description: _desc); + new() : super(name: LintNames.avoid_js_rounded_ints, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidJsRoundedInts; @@ -34,7 +33,7 @@ class AvoidJsRoundedInts extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); bool isRounded(int? value) => value?.toDouble().toInt() != value; @override diff --git a/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart b/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart index f1c464affff..9efc93eb95d 100644 --- a/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart +++ b/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't declare multiple variables on a single line."; class AvoidMultipleDeclarationsPerLine extends AnalysisRule { - AvoidMultipleDeclarationsPerLine() + new() : super( name: LintNames.avoid_multiple_declarations_per_line, description: _desc, @@ -37,7 +37,7 @@ class AvoidMultipleDeclarationsPerLine extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitVariableDeclarationList(VariableDeclarationList node) { diff --git a/pkg/linter/lib/src/rules/avoid_null_checks_in_equality_operators.dart b/pkg/linter/lib/src/rules/avoid_null_checks_in_equality_operators.dart index 46d46b36e59..f6370549260 100644 --- a/pkg/linter/lib/src/rules/avoid_null_checks_in_equality_operators.dart +++ b/pkg/linter/lib/src/rules/avoid_null_checks_in_equality_operators.dart @@ -41,7 +41,7 @@ bool _isParameterWithQuestionQuestion( _isParameter(node.leftOperand, parameter); class AvoidNullChecksInEqualityOperators extends AnalysisRule { - AvoidNullChecksInEqualityOperators() + new() : super( name: LintNames.avoid_null_checks_in_equality_operators, description: _desc, @@ -65,7 +65,7 @@ class _BodyVisitor extends RecursiveAstVisitor { final Element? parameter; final AnalysisRule rule; - _BodyVisitor(this.parameter, this.rule); + new(this.parameter, this.rule); @override visitBinaryExpression(BinaryExpression node) { @@ -98,7 +98,7 @@ class _BodyVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_positional_boolean_parameters.dart b/pkg/linter/lib/src/rules/avoid_positional_boolean_parameters.dart index caffde73e83..f8bbc7e09a5 100644 --- a/pkg/linter/lib/src/rules/avoid_positional_boolean_parameters.dart +++ b/pkg/linter/lib/src/rules/avoid_positional_boolean_parameters.dart @@ -19,7 +19,7 @@ import '../extensions.dart'; const _desc = r'Avoid positional boolean parameters.'; class AvoidPositionalBooleanParameters extends AnalysisRule { - AvoidPositionalBooleanParameters() + new() : super( name: LintNames.avoid_positional_boolean_parameters, description: _desc, @@ -46,7 +46,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); void checkParams(List? parameters) { var parameterToLint = parameters?.firstWhereOrNull(_isBoolean); diff --git a/pkg/linter/lib/src/rules/avoid_print.dart b/pkg/linter/lib/src/rules/avoid_print.dart index f6e9f9364ef..c86ca8e7746 100644 --- a/pkg/linter/lib/src/rules/avoid_print.dart +++ b/pkg/linter/lib/src/rules/avoid_print.dart @@ -18,7 +18,7 @@ import '../util/flutter_utils.dart'; const _desc = r'Avoid `print` calls in production code.'; class AvoidPrint extends AnalysisRule { - AvoidPrint() : super(name: LintNames.avoid_print, description: _desc); + new() : super(name: LintNames.avoid_print, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidPrint; @@ -36,7 +36,7 @@ class AvoidPrint extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation node) { diff --git a/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart b/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart index a7974a42276..494a0ba51bb 100644 --- a/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart +++ b/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid private typedef functions.'; class AvoidPrivateTypedefFunctions extends AnalysisRule { - AvoidPrivateTypedefFunctions() + new() : super( name: LintNames.avoid_private_typedef_functions, description: _desc, @@ -39,7 +39,7 @@ class AvoidPrivateTypedefFunctions extends AnalysisRule { class _CountVisitor extends RecursiveAstVisitor { final String type; int count = 0; - _CountVisitor(this.type); + new(this.type); @override void visitNamedType(NamedType node) { @@ -53,7 +53,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitFunctionTypeAlias(FunctionTypeAlias node) { diff --git a/pkg/linter/lib/src/rules/avoid_redundant_argument_values.dart b/pkg/linter/lib/src/rules/avoid_redundant_argument_values.dart index 372ce5a0dd6..a97b6174dde 100644 --- a/pkg/linter/lib/src/rules/avoid_redundant_argument_values.dart +++ b/pkg/linter/lib/src/rules/avoid_redundant_argument_values.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid redundant argument values.'; class AvoidRedundantArgumentValues extends AnalysisRule { - AvoidRedundantArgumentValues() + new() : super( name: LintNames.avoid_redundant_argument_values, description: _desc, @@ -43,7 +43,7 @@ class AvoidRedundantArgumentValues extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void check(ArgumentList argumentList) { var arguments = argumentList.arguments; diff --git a/pkg/linter/lib/src/rules/avoid_relative_lib_imports.dart b/pkg/linter/lib/src/rules/avoid_relative_lib_imports.dart index 9fc61a2dc81..fce856e9776 100644 --- a/pkg/linter/lib/src/rules/avoid_relative_lib_imports.dart +++ b/pkg/linter/lib/src/rules/avoid_relative_lib_imports.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid relative imports for files in `lib/`.'; class AvoidRelativeLibImports extends AnalysisRule { - AvoidRelativeLibImports() - : super(name: LintNames.avoid_relative_lib_imports, description: _desc); + new() : super(name: LintNames.avoid_relative_lib_imports, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidRelativeLibImports; @@ -34,7 +33,7 @@ class AvoidRelativeLibImports extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); bool isRelativeLibImport(ImportDirective node) { // Relative paths from within the `lib` folder are covered by the diff --git a/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart b/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart index 710addbe8c7..7b857ba7bba 100644 --- a/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart +++ b/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart @@ -20,7 +20,7 @@ import '../extensions.dart'; const _desc = r"Don't rename parameters of overridden methods."; class AvoidRenamingMethodParameters extends AnalysisRule { - AvoidRenamingMethodParameters() + new() : super( name: LintNames.avoid_renaming_method_parameters, description: _desc, @@ -47,7 +47,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule, RuleContext context) + new(this.rule, RuleContext context) : _wildCardVariablesEnabled = context.isFeatureEnabled( Feature.wildcard_variables, ); diff --git a/pkg/linter/lib/src/rules/avoid_return_types_on_setters.dart b/pkg/linter/lib/src/rules/avoid_return_types_on_setters.dart index d0f1fd15293..3838ff0903f 100644 --- a/pkg/linter/lib/src/rules/avoid_return_types_on_setters.dart +++ b/pkg/linter/lib/src/rules/avoid_return_types_on_setters.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid return types on setters.'; class AvoidReturnTypesOnSetters extends AnalysisRule { - AvoidReturnTypesOnSetters() + new() : super(name: LintNames.avoid_return_types_on_setters, description: _desc); @override @@ -38,7 +38,7 @@ class AvoidReturnTypesOnSetters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFunctionDeclaration(FunctionDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_returning_null_for_void.dart b/pkg/linter/lib/src/rules/avoid_returning_null_for_void.dart index 785ef1bdc12..bac5470a60c 100644 --- a/pkg/linter/lib/src/rules/avoid_returning_null_for_void.dart +++ b/pkg/linter/lib/src/rules/avoid_returning_null_for_void.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid returning `null` for `void`.'; class AvoidReturningNullForVoid extends MultiAnalysisRule { - AvoidReturningNullForVoid() + new() : super(name: LintNames.avoid_returning_null_for_void, description: _desc); @override @@ -39,7 +39,7 @@ class AvoidReturningNullForVoid extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitExpressionFunctionBody(ExpressionFunctionBody node) { diff --git a/pkg/linter/lib/src/rules/avoid_returning_this.dart b/pkg/linter/lib/src/rules/avoid_returning_this.dart index 312ddb92ba1..de94ce0018d 100644 --- a/pkg/linter/lib/src/rules/avoid_returning_this.dart +++ b/pkg/linter/lib/src/rules/avoid_returning_this.dart @@ -20,8 +20,7 @@ const _desc = bool _returnsThis(ReturnStatement node) => node.expression is ThisExpression; class AvoidReturningThis extends AnalysisRule { - AvoidReturningThis() - : super(name: LintNames.avoid_returning_this, description: _desc); + new() : super(name: LintNames.avoid_returning_this, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidReturningThis; @@ -69,7 +68,7 @@ class _BodyVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart b/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart index 27c3a80dee8..1a4b837a4cf 100644 --- a/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart +++ b/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid setters without getters.'; class AvoidSettersWithoutGetters extends AnalysisRule { - AvoidSettersWithoutGetters() + new() : super(name: LintNames.avoid_setters_without_getters, description: _desc); @override @@ -38,7 +38,7 @@ class AvoidSettersWithoutGetters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_shadowing_type_parameters.dart b/pkg/linter/lib/src/rules/avoid_shadowing_type_parameters.dart index 175a0b11104..c17262a4129 100644 --- a/pkg/linter/lib/src/rules/avoid_shadowing_type_parameters.dart +++ b/pkg/linter/lib/src/rules/avoid_shadowing_type_parameters.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid shadowing type parameters.'; class AvoidShadowingTypeParameters extends AnalysisRule { - AvoidShadowingTypeParameters() + new() : super( name: LintNames.avoid_shadowing_type_parameters, description: _desc, @@ -46,7 +46,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule, RuleContext context) + new(this.rule, RuleContext context) : _wildCardVariablesEnabled = context.isFeatureEnabled( Feature.wildcard_variables, ); diff --git a/pkg/linter/lib/src/rules/avoid_single_cascade_in_expression_statements.dart b/pkg/linter/lib/src/rules/avoid_single_cascade_in_expression_statements.dart index 4f4a2d23751..159ef1abd79 100644 --- a/pkg/linter/lib/src/rules/avoid_single_cascade_in_expression_statements.dart +++ b/pkg/linter/lib/src/rules/avoid_single_cascade_in_expression_statements.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid single cascade in expression statements.'; class AvoidSingleCascadeInExpressionStatements extends AnalysisRule { - AvoidSingleCascadeInExpressionStatements() + new() : super( name: LintNames.avoid_single_cascade_in_expression_statements, description: _desc, @@ -39,7 +39,7 @@ class AvoidSingleCascadeInExpressionStatements extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); String operatorFor(Expression section) { Token? operator; diff --git a/pkg/linter/lib/src/rules/avoid_slow_async_io.dart b/pkg/linter/lib/src/rules/avoid_slow_async_io.dart index 7a3cc4068f2..8a7b1ac9edc 100644 --- a/pkg/linter/lib/src/rules/avoid_slow_async_io.dart +++ b/pkg/linter/lib/src/rules/avoid_slow_async_io.dart @@ -25,8 +25,7 @@ const Set _fileSystemEntityMethodNames = { }; class AvoidSlowAsyncIo extends AnalysisRule { - AvoidSlowAsyncIo() - : super(name: LintNames.avoid_slow_async_io, description: _desc); + new() : super(name: LintNames.avoid_slow_async_io, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidSlowAsyncIo; @@ -44,7 +43,7 @@ class AvoidSlowAsyncIo extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation node) { diff --git a/pkg/linter/lib/src/rules/avoid_type_to_string.dart b/pkg/linter/lib/src/rules/avoid_type_to_string.dart index 6274c87ae8c..597eb6b4291 100644 --- a/pkg/linter/lib/src/rules/avoid_type_to_string.dart +++ b/pkg/linter/lib/src/rules/avoid_type_to_string.dart @@ -19,8 +19,7 @@ const _desc = r'Avoid .toString() in production code since results may be minified.'; class AvoidTypeToString extends AnalysisRule { - AvoidTypeToString() - : super(name: LintNames.avoid_type_to_string, description: _desc); + new() : super(name: LintNames.avoid_type_to_string, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidTypeToString; @@ -58,7 +57,7 @@ class _Visitor extends SimpleAstVisitor { // Null if there is no logical `this` in the given context. InterfaceType? thisType; - _Visitor(this.rule, this.typeSystem, this.typeType); + new(this.rule, this.typeSystem, this.typeType); @override void visitArgumentList(ArgumentList node) { diff --git a/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart b/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart index 1dfafbf158b..e0f1c306f24 100644 --- a/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart +++ b/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart @@ -20,7 +20,7 @@ import '../util/scope.dart'; const _desc = r'Avoid types as parameter names.'; class AvoidTypesAsParameterNames extends MultiAnalysisRule { - AvoidTypesAsParameterNames() + new() : super(name: LintNames.avoid_types_as_parameter_names, description: _desc); @override @@ -45,7 +45,7 @@ class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitCatchClause(CatchClause node) { diff --git a/pkg/linter/lib/src/rules/avoid_types_on_closure_parameters.dart b/pkg/linter/lib/src/rules/avoid_types_on_closure_parameters.dart index 44c661da226..2a3608e9b0b 100644 --- a/pkg/linter/lib/src/rules/avoid_types_on_closure_parameters.dart +++ b/pkg/linter/lib/src/rules/avoid_types_on_closure_parameters.dart @@ -17,7 +17,7 @@ import '../extensions.dart'; const _desc = r'Avoid annotating types for function expression parameters.'; class AvoidTypesOnClosureParameters extends AnalysisRule { - AvoidTypesOnClosureParameters() + new() : super( name: LintNames.avoid_types_on_closure_parameters, description: _desc, @@ -42,7 +42,7 @@ class AvoidTypesOnClosureParameters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFunctionExpression(FunctionExpression node) { diff --git a/pkg/linter/lib/src/rules/avoid_unnecessary_containers.dart b/pkg/linter/lib/src/rules/avoid_unnecessary_containers.dart index e2b6fac32d3..492246aadc4 100644 --- a/pkg/linter/lib/src/rules/avoid_unnecessary_containers.dart +++ b/pkg/linter/lib/src/rules/avoid_unnecessary_containers.dart @@ -16,7 +16,7 @@ import '../util/flutter_utils.dart'; const _desc = r'Avoid unnecessary containers.'; class AvoidUnnecessaryContainers extends AnalysisRule { - AvoidUnnecessaryContainers() + new() : super(name: LintNames.avoid_unnecessary_containers, description: _desc); @override @@ -36,7 +36,7 @@ class AvoidUnnecessaryContainers extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/avoid_unused_constructor_parameters.dart b/pkg/linter/lib/src/rules/avoid_unused_constructor_parameters.dart index e13b8e9412c..782d10809de 100644 --- a/pkg/linter/lib/src/rules/avoid_unused_constructor_parameters.dart +++ b/pkg/linter/lib/src/rules/avoid_unused_constructor_parameters.dart @@ -18,7 +18,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Avoid defining unused parameters in constructors.'; class AvoidUnusedConstructorParameters extends AnalysisRule { - AvoidUnusedConstructorParameters() + new() : super( name: LintNames.avoid_unused_constructor_parameters, description: _desc, @@ -42,7 +42,7 @@ class _ConstructorVisitor extends RecursiveAstVisitor { final FormalParameterList parameterList; final Set unusedParameters; - _ConstructorVisitor(this.parameterList) + new(this.parameterList) : unusedParameters = parameterList.parameters.where((p) { var element = p.declaredFragment?.element; return element != null && @@ -63,7 +63,7 @@ class _ConstructorVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_void_async.dart b/pkg/linter/lib/src/rules/avoid_void_async.dart index 45e1c3c66a9..6df05fc447e 100644 --- a/pkg/linter/lib/src/rules/avoid_void_async.dart +++ b/pkg/linter/lib/src/rules/avoid_void_async.dart @@ -18,8 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid `async` functions that return `void`.'; class AvoidVoidAsync extends AnalysisRule { - AvoidVoidAsync() - : super(name: LintNames.avoid_void_async, description: _desc); + new() : super(name: LintNames.avoid_void_async, description: _desc); @override DiagnosticCode get diagnosticCode => diag.avoidVoidAsync; @@ -38,7 +37,7 @@ class AvoidVoidAsync extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFunctionDeclaration(FunctionDeclaration node) { diff --git a/pkg/linter/lib/src/rules/avoid_web_libraries_in_flutter.dart b/pkg/linter/lib/src/rules/avoid_web_libraries_in_flutter.dart index b4294d86e59..2ee122f1e4d 100644 --- a/pkg/linter/lib/src/rules/avoid_web_libraries_in_flutter.dart +++ b/pkg/linter/lib/src/rules/avoid_web_libraries_in_flutter.dart @@ -37,7 +37,7 @@ class AvoidWebLibrariesInFlutter extends AnalysisRule { /// Cache of most recent analysis root to parsed "hasFlutter" state. static final Map _rootHasFlutterCache = {}; - AvoidWebLibrariesInFlutter() + new() : super(name: LintNames.avoid_web_libraries_in_flutter, description: _desc); @override @@ -107,7 +107,7 @@ class AvoidWebLibrariesInFlutter extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); bool isWebUri(String uri) { var uriLength = uri.length; diff --git a/pkg/linter/lib/src/rules/await_only_futures.dart b/pkg/linter/lib/src/rules/await_only_futures.dart index f28f2d7c036..4db020fb56d 100644 --- a/pkg/linter/lib/src/rules/await_only_futures.dart +++ b/pkg/linter/lib/src/rules/await_only_futures.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Await only futures.'; class AwaitOnlyFutures extends AnalysisRule { - AwaitOnlyFutures() - : super(name: LintNames.await_only_futures, description: _desc); + new() : super(name: LintNames.await_only_futures, description: _desc); @override DiagnosticCode get diagnosticCode => diag.awaitOnlyFutures; @@ -38,7 +37,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitAwaitExpression(AwaitExpression node) { diff --git a/pkg/linter/lib/src/rules/camel_case_extensions.dart b/pkg/linter/lib/src/rules/camel_case_extensions.dart index a9238ad77e2..b47077423c6 100644 --- a/pkg/linter/lib/src/rules/camel_case_extensions.dart +++ b/pkg/linter/lib/src/rules/camel_case_extensions.dart @@ -16,8 +16,7 @@ import '../utils.dart'; const _desc = r'Name extensions using UpperCamelCase.'; class CamelCaseExtensions extends AnalysisRule { - CamelCaseExtensions() - : super(name: LintNames.camel_case_extensions, description: _desc); + new() : super(name: LintNames.camel_case_extensions, description: _desc); @override DiagnosticCode get diagnosticCode => diag.camelCaseExtensions; @@ -35,7 +34,7 @@ class CamelCaseExtensions extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitExtensionDeclaration(ExtensionDeclaration node) { diff --git a/pkg/linter/lib/src/rules/camel_case_types.dart b/pkg/linter/lib/src/rules/camel_case_types.dart index fc2675ec3ac..086d1a3da3c 100644 --- a/pkg/linter/lib/src/rules/camel_case_types.dart +++ b/pkg/linter/lib/src/rules/camel_case_types.dart @@ -18,8 +18,7 @@ import '../utils.dart'; const _desc = r'Name types using UpperCamelCase.'; class CamelCaseTypes extends AnalysisRule { - CamelCaseTypes() - : super(name: LintNames.camel_case_types, description: _desc); + new() : super(name: LintNames.camel_case_types, description: _desc); @override DiagnosticCode get diagnosticCode => diag.camelCaseTypes; @@ -43,7 +42,7 @@ class CamelCaseTypes extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void check(Token name) { var lexeme = name.lexeme; diff --git a/pkg/linter/lib/src/rules/cancel_subscriptions.dart b/pkg/linter/lib/src/rules/cancel_subscriptions.dart index 62866567d38..57fe4f856da 100644 --- a/pkg/linter/lib/src/rules/cancel_subscriptions.dart +++ b/pkg/linter/lib/src/rules/cancel_subscriptions.dart @@ -16,8 +16,7 @@ import '../util/leak_detector_visitor.dart'; const _desc = r'Cancel instances of `dart:async` `StreamSubscription`.'; class CancelSubscriptions extends AnalysisRule { - CancelSubscriptions() - : super(name: LintNames.cancel_subscriptions, description: _desc); + new() : super(name: LintNames.cancel_subscriptions, description: _desc); @override DiagnosticCode get diagnosticCode => diag.cancelSubscriptions; @@ -37,7 +36,7 @@ class CancelSubscriptions extends AnalysisRule { class _Visitor extends LeakDetectorProcessors { static final _predicates = {_isSubscription: 'cancel'}; - _Visitor(super.rule); + new(super.rule); @override Map get predicates => _predicates; diff --git a/pkg/linter/lib/src/rules/cascade_invocations.dart b/pkg/linter/lib/src/rules/cascade_invocations.dart index 0c2d93d6e93..27ec6ef2f4a 100644 --- a/pkg/linter/lib/src/rules/cascade_invocations.dart +++ b/pkg/linter/lib/src/rules/cascade_invocations.dart @@ -73,8 +73,7 @@ bool _isInvokedWithoutNullAwareOperator(Token? token) => /// reference that could be done with the cascade operator. class CascadeInvocations extends AnalysisRule { /// Default constructor. - CascadeInvocations() - : super(name: LintNames.cascade_invocations, description: _desc); + new() : super(name: LintNames.cascade_invocations, description: _desc); @override DiagnosticCode get diagnosticCode => diag.cascadeInvocations; @@ -137,9 +136,7 @@ class _CascadableExpression { final Element? element; final List criticalNodes; - factory _CascadableExpression.fromExpressionStatement( - ExpressionStatement statement, - ) { + factory fromExpressionStatement(ExpressionStatement statement) { var expression = statement.expression.unParenthesized; if (expression is AssignmentExpression) { return _CascadableExpression._fromAssignmentExpression(expression); @@ -160,9 +157,7 @@ class _CascadableExpression { return nullCascadableExpression; } - factory _CascadableExpression.fromVariableDeclarationStatement( - VariableDeclarationStatement node, - ) { + factory fromVariableDeclarationStatement(VariableDeclarationStatement node) { var element = _getElementFromVariableDeclarationStatement(node); return _CascadableExpression._( element, @@ -172,7 +167,7 @@ class _CascadableExpression { ); } - _CascadableExpression._( + new _( this.element, this.criticalNodes, { this.canJoin = false, @@ -181,9 +176,7 @@ class _CascadableExpression { this.isCritical = false, }); - factory _CascadableExpression._fromAssignmentExpression( - AssignmentExpression node, - ) { + factory _fromAssignmentExpression(AssignmentExpression node) { var leftExpression = node.leftHandSide.unParenthesized; if (leftExpression is SimpleIdentifier) { return _CascadableExpression._( @@ -208,7 +201,7 @@ class _CascadableExpression { ); } - factory _CascadableExpression._fromCascadeExpression(CascadeExpression node) { + factory _fromCascadeExpression(CascadeExpression node) { var targetIsSimple = node.target is SimpleIdentifier; return _CascadableExpression._( _getTargetElementFromCascadeExpression(node), @@ -219,7 +212,7 @@ class _CascadableExpression { ); } - factory _CascadableExpression._fromMethodInvocation(MethodInvocation node) { + factory _fromMethodInvocation(MethodInvocation node) { var executableElement = _getExecutableElementFromMethodInvocation(node); var isNonStatic = executableElement?.isStatic == false; if (isNonStatic) { @@ -235,17 +228,16 @@ class _CascadableExpression { return nullCascadableExpression; } - factory _CascadableExpression._fromPrefixedIdentifier( - PrefixedIdentifier node, - ) => _CascadableExpression._( - node.prefix.canonicalElement, - [node.identifier], - canJoin: true, - canReceive: true, - canBeCascaded: true, - ); + factory _fromPrefixedIdentifier(PrefixedIdentifier node) => + _CascadableExpression._( + node.prefix.canonicalElement, + [node.identifier], + canJoin: true, + canReceive: true, + canBeCascaded: true, + ); - factory _CascadableExpression._fromPropertyAccess(PropertyAccess node) { + factory _fromPropertyAccess(PropertyAccess node) { var targetIsSimple = node.target is SimpleIdentifier; return _CascadableExpression._( node.target.canonicalElement, @@ -283,7 +275,7 @@ class _CriticalDependencyVisitor extends UnifyingAstVisitor { bool foundCriticalNode = false; - _CriticalDependencyVisitor(this.expressionBox); + new(this.expressionBox); bool isOrHasCriticalNode(AstNode node) { node.accept(this); @@ -335,7 +327,7 @@ class _CriticalDependencyVisitor extends UnifyingAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBlock(Block node) { diff --git a/pkg/linter/lib/src/rules/cast_nullable_to_non_nullable.dart b/pkg/linter/lib/src/rules/cast_nullable_to_non_nullable.dart index b45fe7c8aba..aa820ddedf2 100644 --- a/pkg/linter/lib/src/rules/cast_nullable_to_non_nullable.dart +++ b/pkg/linter/lib/src/rules/cast_nullable_to_non_nullable.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't cast a nullable value to a non nullable type."; class CastNullableToNonNullable extends AnalysisRule { - CastNullableToNonNullable() + new() : super(name: LintNames.cast_nullable_to_non_nullable, description: _desc); @override @@ -36,7 +36,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitAsExpression(AsExpression node) { diff --git a/pkg/linter/lib/src/rules/close_sinks.dart b/pkg/linter/lib/src/rules/close_sinks.dart index 67da390c2bb..684d6f37d36 100644 --- a/pkg/linter/lib/src/rules/close_sinks.dart +++ b/pkg/linter/lib/src/rules/close_sinks.dart @@ -16,7 +16,7 @@ import '../util/leak_detector_visitor.dart'; const _desc = r'Close instances of `dart:core` `Sink`.'; class CloseSinks extends AnalysisRule { - CloseSinks() : super(name: LintNames.close_sinks, description: _desc); + new() : super(name: LintNames.close_sinks, description: _desc); @override DiagnosticCode get diagnosticCode => diag.closeSinks; @@ -39,7 +39,7 @@ class _Visitor extends LeakDetectorProcessors { _isSocket: 'destroy', }; - _Visitor(super.rule); + new(super.rule); @override Map get predicates => _predicates; diff --git a/pkg/linter/lib/src/rules/collection_methods_unrelated_type.dart b/pkg/linter/lib/src/rules/collection_methods_unrelated_type.dart index 02c55d73be6..8ce9c077a6e 100644 --- a/pkg/linter/lib/src/rules/collection_methods_unrelated_type.dart +++ b/pkg/linter/lib/src/rules/collection_methods_unrelated_type.dart @@ -22,7 +22,7 @@ const _desc = 'unrelated types.'; class CollectionMethodsUnrelatedType extends AnalysisRule { - CollectionMethodsUnrelatedType() + new() : super( name: LintNames.collection_methods_unrelated_type, description: _desc, @@ -63,11 +63,7 @@ abstract class _MethodDefinition { final _ExpectedArgumentKind expectedArgumentKind; - _MethodDefinition( - this.methodName, - this.expectedArgumentKind, { - this.typeArgumentIndex = 0, - }); + new(this.methodName, this.expectedArgumentKind, {this.typeArgumentIndex = 0}); InterfaceType? collectionTypeFor(InterfaceType targetType); } @@ -76,7 +72,7 @@ class _MethodDefinitionForElement extends _MethodDefinition { /// The element on which this method is declared. final ClassElement element; - _MethodDefinitionForElement( + new( this.element, super.methodName, super.expectedArgumentKind, { @@ -93,7 +89,7 @@ class _MethodDefinitionForName extends _MethodDefinition { final String interfaceName; - _MethodDefinitionForName( + new( this.libraryName, this.interfaceName, super.methodName, @@ -118,7 +114,7 @@ class _Visitor extends SimpleAstVisitor { final TypeSystem typeSystem; final TypeProvider typeProvider; - _Visitor(this.rule, this.typeSystem, this.typeProvider); + new(this.rule, this.typeSystem, this.typeProvider); List<_MethodDefinition> get indexOperators => [ // Argument to `Map.[]` should be assignable to `K`. diff --git a/pkg/linter/lib/src/rules/combinators_ordering.dart b/pkg/linter/lib/src/rules/combinators_ordering.dart index aee48279485..9c58cc16733 100644 --- a/pkg/linter/lib/src/rules/combinators_ordering.dart +++ b/pkg/linter/lib/src/rules/combinators_ordering.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Sort combinator names alphabetically.'; class CombinatorsOrdering extends AnalysisRule { - CombinatorsOrdering() - : super(name: LintNames.combinators_ordering, description: _desc); + new() : super(name: LintNames.combinators_ordering, description: _desc); @override DiagnosticCode get diagnosticCode => diag.combinatorsOrdering; @@ -36,7 +35,7 @@ class CombinatorsOrdering extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitHideCombinator(HideCombinator node) { diff --git a/pkg/linter/lib/src/rules/comment_references.dart b/pkg/linter/lib/src/rules/comment_references.dart index 019c4fca4bd..29fbf85a189 100644 --- a/pkg/linter/lib/src/rules/comment_references.dart +++ b/pkg/linter/lib/src/rules/comment_references.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Only reference in-scope identifiers in doc comments.'; class CommentReferences extends AnalysisRule { - CommentReferences() - : super(name: LintNames.comment_references, description: _desc); + new() : super(name: LintNames.comment_references, description: _desc); @override DiagnosticCode get diagnosticCode => diag.commentReferences; @@ -41,7 +40,7 @@ class _Visitor extends SimpleAstVisitor { /// https://spec.commonmark.org/0.31.2/#link-reference-definitions). final linkReferences = []; - _Visitor(this.rule); + new(this.rule); @override void visitComment(Comment node) { diff --git a/pkg/linter/lib/src/rules/conditional_uri_does_not_exist.dart b/pkg/linter/lib/src/rules/conditional_uri_does_not_exist.dart index ba1909838dd..719465f3082 100644 --- a/pkg/linter/lib/src/rules/conditional_uri_does_not_exist.dart +++ b/pkg/linter/lib/src/rules/conditional_uri_does_not_exist.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Missing conditional import.'; class ConditionalUriDoesNotExist extends AnalysisRule { - ConditionalUriDoesNotExist() + new() : super(name: LintNames.conditional_uri_does_not_exist, description: _desc); @override @@ -35,7 +35,7 @@ class ConditionalUriDoesNotExist extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConfiguration(Configuration configuration) { diff --git a/pkg/linter/lib/src/rules/constant_identifier_names.dart b/pkg/linter/lib/src/rules/constant_identifier_names.dart index d971c1bef4d..ee349a50cc8 100644 --- a/pkg/linter/lib/src/rules/constant_identifier_names.dart +++ b/pkg/linter/lib/src/rules/constant_identifier_names.dart @@ -18,8 +18,7 @@ import '../utils.dart'; const _desc = r'Prefer using lowerCamelCase for constant names.'; class ConstantIdentifierNames extends AnalysisRule { - ConstantIdentifierNames() - : super(name: LintNames.constant_identifier_names, description: _desc); + new() : super(name: LintNames.constant_identifier_names, description: _desc); @override DiagnosticCode get diagnosticCode => diag.constantIdentifierNames; @@ -40,7 +39,7 @@ class ConstantIdentifierNames extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void checkIdentifier(Token id) { var name = id.lexeme; diff --git a/pkg/linter/lib/src/rules/control_flow_in_finally.dart b/pkg/linter/lib/src/rules/control_flow_in_finally.dart index 3d3c7e7e5a8..13968c9ec58 100644 --- a/pkg/linter/lib/src/rules/control_flow_in_finally.dart +++ b/pkg/linter/lib/src/rules/control_flow_in_finally.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid control flow in `finally` blocks.'; class ControlFlowInFinally extends AnalysisRule { - ControlFlowInFinally() - : super(name: LintNames.control_flow_in_finally, description: _desc); + new() : super(name: LintNames.control_flow_in_finally, description: _desc); @override DiagnosticCode get diagnosticCode => diag.controlFlowInFinally; @@ -90,7 +89,7 @@ class _Visitor extends SimpleAstVisitor @override final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBreakStatement(BreakStatement node) { diff --git a/pkg/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart b/pkg/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart index c9295984c81..87f014e3969 100644 --- a/pkg/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart +++ b/pkg/linter/lib/src/rules/curly_braces_in_flow_control_structures.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'DO use curly braces for all flow control structures.'; class CurlyBracesInFlowControlStructures extends AnalysisRule { - CurlyBracesInFlowControlStructures() + new() : super( name: LintNames.curly_braces_in_flow_control_structures, description: _desc, @@ -43,7 +43,7 @@ class CurlyBracesInFlowControlStructures extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitDoStatement(DoStatement node) { diff --git a/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart b/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart index a9bc0f8a345..a13ab04e307 100644 --- a/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart +++ b/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Attach library doc comments to library directives.'; class DanglingLibraryDocComments extends AnalysisRule { - DanglingLibraryDocComments() + new() : super(name: LintNames.dangling_library_doc_comments, description: _desc); @override @@ -36,7 +36,7 @@ class DanglingLibraryDocComments extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final DanglingLibraryDocComments rule; - _Visitor(this.rule); + new(this.rule); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/deprecated_consistency.dart b/pkg/linter/lib/src/rules/deprecated_consistency.dart index a060ec8e008..09d8d8ba2fc 100644 --- a/pkg/linter/lib/src/rules/deprecated_consistency.dart +++ b/pkg/linter/lib/src/rules/deprecated_consistency.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Missing deprecated annotation.'; class DeprecatedConsistency extends MultiAnalysisRule { - DeprecatedConsistency() - : super(name: LintNames.deprecated_consistency, description: _desc); + new() : super(name: LintNames.deprecated_consistency, description: _desc); @override List get diagnosticCodes => [ @@ -42,7 +41,7 @@ class DeprecatedConsistency extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/deprecated_member_use_from_same_package.dart b/pkg/linter/lib/src/rules/deprecated_member_use_from_same_package.dart index f7d544df361..d285bfba9c4 100644 --- a/pkg/linter/lib/src/rules/deprecated_member_use_from_same_package.dart +++ b/pkg/linter/lib/src/rules/deprecated_member_use_from_same_package.dart @@ -30,7 +30,7 @@ const _desc = 'declared.'; class DeprecatedMemberUseFromSamePackage extends MultiAnalysisRule { - DeprecatedMemberUseFromSamePackage() + new() : super( name: LintNames.deprecated_member_use_from_same_package, description: _desc, @@ -55,7 +55,7 @@ class DeprecatedMemberUseFromSamePackage extends MultiAnalysisRule { class _DeprecatedElementUsageReporter extends ElementUsageReporter { final MultiAnalysisRule _rule; - _DeprecatedElementUsageReporter({required this._rule}); + new({required this._rule}); @override void report( @@ -91,7 +91,7 @@ class _DeprecatedElementUsageReporter extends ElementUsageReporter { class _RecursiveVisitor extends RecursiveAstVisitor { final ElementUsageFrontierDetector _deprecatedVerifier; - _RecursiveVisitor(MultiAnalysisRule rule, WorkspacePackage package) + new(MultiAnalysisRule rule, WorkspacePackage package) : _deprecatedVerifier = ElementUsageFrontierDetector( workspacePackage: package, usagesAndReporters: [ @@ -369,7 +369,7 @@ class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule _rule; final RuleContext _context; - _Visitor(this._rule, this._context); + new(this._rule, this._context); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart b/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart index e4c290362de..913a15cb0ec 100644 --- a/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart +++ b/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart @@ -20,7 +20,7 @@ import '../util/flutter_utils.dart'; const _desc = r'DO reference all public properties in debug methods.'; class DiagnosticDescribeAllProperties extends AnalysisRule { - DiagnosticDescribeAllProperties() + new() : super( name: LintNames.diagnostic_describe_all_properties, description: _desc, @@ -41,7 +41,7 @@ class DiagnosticDescribeAllProperties extends AnalysisRule { class _IdentifierVisitor extends RecursiveAstVisitor { final List properties; - _IdentifierVisitor(this.properties); + new(this.properties); @override visitSimpleIdentifier(SimpleIdentifier node) { @@ -70,7 +70,7 @@ class _IdentifierVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void removeReferences(MethodDeclaration? method, List properties) { method?.body.accept(_IdentifierVisitor(properties)); diff --git a/pkg/linter/lib/src/rules/directives_ordering.dart b/pkg/linter/lib/src/rules/directives_ordering.dart index 7a3ae2ab538..3f313dc2a4a 100644 --- a/pkg/linter/lib/src/rules/directives_ordering.dart +++ b/pkg/linter/lib/src/rules/directives_ordering.dart @@ -69,8 +69,7 @@ class DirectivesOrdering extends MultiAnalysisRule { diag.directivesOrderingPackageBeforeRelative, ]; - DirectivesOrdering() - : super(name: LintNames.directives_ordering, description: _desc); + new() : super(name: LintNames.directives_ordering, description: _desc); @override List get diagnosticCodes => allCodes; @@ -117,7 +116,7 @@ class DirectivesOrdering extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final DirectivesOrdering rule; - _Visitor(this.rule); + new(this.rule); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/discarded_futures.dart b/pkg/linter/lib/src/rules/discarded_futures.dart index 0224924fd95..2c4e7a916ae 100644 --- a/pkg/linter/lib/src/rules/discarded_futures.dart +++ b/pkg/linter/lib/src/rules/discarded_futures.dart @@ -16,8 +16,7 @@ const _desc = 'are assigned or returned.'; class DiscardedFutures extends AnalysisRule { - DiscardedFutures() - : super(name: LintNames.discarded_futures, description: _desc); + new() : super(name: LintNames.discarded_futures, description: _desc); @override DiagnosticCode get diagnosticCode => diag.discardedFutures; diff --git a/pkg/linter/lib/src/rules/do_not_use_environment.dart b/pkg/linter/lib/src/rules/do_not_use_environment.dart index 9e6da07b511..785e1ac164e 100644 --- a/pkg/linter/lib/src/rules/do_not_use_environment.dart +++ b/pkg/linter/lib/src/rules/do_not_use_environment.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Do not use environment declared variables.'; class DoNotUseEnvironment extends AnalysisRule { - DoNotUseEnvironment() - : super(name: LintNames.do_not_use_environment, description: _desc); + new() : super(name: LintNames.do_not_use_environment, description: _desc); @override DiagnosticCode get diagnosticCode => diag.doNotUseEnvironment; @@ -36,7 +35,7 @@ class DoNotUseEnvironment extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void reportIfUsingEnvironment( AstNode node, diff --git a/pkg/linter/lib/src/rules/document_ignores.dart b/pkg/linter/lib/src/rules/document_ignores.dart index 9d990754ca4..8702deaa523 100644 --- a/pkg/linter/lib/src/rules/document_ignores.dart +++ b/pkg/linter/lib/src/rules/document_ignores.dart @@ -22,8 +22,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Document ignore comments.'; class DocumentIgnores extends AnalysisRule { - DocumentIgnores() - : super(name: LintNames.document_ignores, description: _desc); + new() : super(name: LintNames.document_ignores, description: _desc); @override DiagnosticCode get diagnosticCode => diag.documentIgnores; @@ -42,7 +41,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/empty_catches.dart b/pkg/linter/lib/src/rules/empty_catches.dart index 0e920b71cf0..7c56c435d84 100644 --- a/pkg/linter/lib/src/rules/empty_catches.dart +++ b/pkg/linter/lib/src/rules/empty_catches.dart @@ -16,7 +16,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Avoid empty catch blocks.'; class EmptyCatches extends AnalysisRule { - EmptyCatches() : super(name: LintNames.empty_catches, description: _desc); + new() : super(name: LintNames.empty_catches, description: _desc); @override DiagnosticCode get diagnosticCode => diag.emptyCatches; @@ -34,7 +34,7 @@ class EmptyCatches extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitCatchClause(CatchClause node) { diff --git a/pkg/linter/lib/src/rules/empty_constructor_bodies.dart b/pkg/linter/lib/src/rules/empty_constructor_bodies.dart index 5a6bce7b28b..aa88c37e403 100644 --- a/pkg/linter/lib/src/rules/empty_constructor_bodies.dart +++ b/pkg/linter/lib/src/rules/empty_constructor_bodies.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use `;` instead of `{}` for empty constructor bodies.'; class EmptyConstructorBodies extends AnalysisRule { - EmptyConstructorBodies() - : super(name: LintNames.empty_constructor_bodies, description: _desc); + new() : super(name: LintNames.empty_constructor_bodies, description: _desc); @override DiagnosticCode get diagnosticCode => diag.emptyConstructorBodies; @@ -35,7 +34,7 @@ class EmptyConstructorBodies extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/empty_container_bodies.dart b/pkg/linter/lib/src/rules/empty_container_bodies.dart index 6e655f0b9f6..bc041d0d0d9 100644 --- a/pkg/linter/lib/src/rules/empty_container_bodies.dart +++ b/pkg/linter/lib/src/rules/empty_container_bodies.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use `;` instead of `{}` for empty container bodies.'; class EmptyContainerBodies extends AnalysisRule { - EmptyContainerBodies() - : super(name: LintNames.empty_container_bodies, description: _desc); + new() : super(name: LintNames.empty_container_bodies, description: _desc); @override DiagnosticCode get diagnosticCode => diag.emptyContainerBodies; @@ -37,7 +36,7 @@ class EmptyContainerBodies extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBlockClassBody(BlockClassBody node) { diff --git a/pkg/linter/lib/src/rules/empty_statements.dart b/pkg/linter/lib/src/rules/empty_statements.dart index 2f165193259..d5995006033 100644 --- a/pkg/linter/lib/src/rules/empty_statements.dart +++ b/pkg/linter/lib/src/rules/empty_statements.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid empty statements.'; class EmptyStatements extends AnalysisRule { - EmptyStatements() - : super(name: LintNames.empty_statements, description: _desc); + new() : super(name: LintNames.empty_statements, description: _desc); @override DiagnosticCode get diagnosticCode => diag.emptyStatements; @@ -34,7 +33,7 @@ class EmptyStatements extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); bool definesSemantics(EmptyStatement node) { var parent = node.parent; diff --git a/pkg/linter/lib/src/rules/eol_at_end_of_file.dart b/pkg/linter/lib/src/rules/eol_at_end_of_file.dart index 4c7022d242d..0adb36fb57d 100644 --- a/pkg/linter/lib/src/rules/eol_at_end_of_file.dart +++ b/pkg/linter/lib/src/rules/eol_at_end_of_file.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Put a single newline at end of file.'; class EolAtEndOfFile extends AnalysisRule { - EolAtEndOfFile() - : super(name: LintNames.eol_at_end_of_file, description: _desc); + new() : super(name: LintNames.eol_at_end_of_file, description: _desc); @override DiagnosticCode get diagnosticCode => diag.eolAtEndOfFile; @@ -35,7 +34,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/erase_dart_type_extension_types.dart b/pkg/linter/lib/src/rules/erase_dart_type_extension_types.dart index 143aecbdc87..9334942ded2 100644 --- a/pkg/linter/lib/src/rules/erase_dart_type_extension_types.dart +++ b/pkg/linter/lib/src/rules/erase_dart_type_extension_types.dart @@ -18,7 +18,7 @@ import '../extensions.dart'; const _desc = r"Don't do 'is' checks on DartTypes."; class EraseDartTypeExtensionTypes extends AnalysisRule { - EraseDartTypeExtensionTypes() + new() : super( name: LintNames.erase_dart_type_extension_types, description: _desc, @@ -42,7 +42,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override visitIsExpression(IsExpression node) { diff --git a/pkg/linter/lib/src/rules/exhaustive_cases.dart b/pkg/linter/lib/src/rules/exhaustive_cases.dart index 844e8929f6c..e488f092ac3 100644 --- a/pkg/linter/lib/src/rules/exhaustive_cases.dart +++ b/pkg/linter/lib/src/rules/exhaustive_cases.dart @@ -18,8 +18,7 @@ import '../extensions.dart'; const _desc = r'Define case clauses for all constants in enum-like classes.'; class ExhaustiveCases extends AnalysisRule { - ExhaustiveCases() - : super(name: LintNames.exhaustive_cases, description: _desc); + new() : super(name: LintNames.exhaustive_cases, description: _desc); @override DiagnosticCode get diagnosticCode => diag.exhaustiveCases; @@ -37,7 +36,7 @@ class ExhaustiveCases extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitSwitchStatement(SwitchStatement statement) { diff --git a/pkg/linter/lib/src/rules/file_names.dart b/pkg/linter/lib/src/rules/file_names.dart index db8f7bb4014..6038e677c7e 100644 --- a/pkg/linter/lib/src/rules/file_names.dart +++ b/pkg/linter/lib/src/rules/file_names.dart @@ -16,7 +16,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Name source files using `lowercase_with_underscores`.'; class FileNames extends AnalysisRule { - FileNames() : super(name: LintNames.file_names, description: _desc); + new() : super(name: LintNames.file_names, description: _desc); @override DiagnosticCode get diagnosticCode => diag.fileNames; @@ -34,7 +34,7 @@ class FileNames extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/flutter_style_todos.dart b/pkg/linter/lib/src/rules/flutter_style_todos.dart index e62e7ba62b5..d9481f69365 100644 --- a/pkg/linter/lib/src/rules/flutter_style_todos.dart +++ b/pkg/linter/lib/src/rules/flutter_style_todos.dart @@ -24,8 +24,7 @@ class FlutterStyleTodos extends AnalysisRule { r'//\s*TODO\([a-zA-Z0-9][-a-zA-Z0-9\.]*\): ', ); - FlutterStyleTodos() - : super(name: LintNames.flutter_style_todos, description: _desc); + new() : super(name: LintNames.flutter_style_todos, description: _desc); @override DiagnosticCode get diagnosticCode => diag.flutterStyleTodos; @@ -48,7 +47,7 @@ class FlutterStyleTodos extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void checkComments(Token token) { Token? comment = token.precedingComments; diff --git a/pkg/linter/lib/src/rules/hash_and_equals.dart b/pkg/linter/lib/src/rules/hash_and_equals.dart index ef3cf7a90ff..5af2486a2d8 100644 --- a/pkg/linter/lib/src/rules/hash_and_equals.dart +++ b/pkg/linter/lib/src/rules/hash_and_equals.dart @@ -18,7 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Always override `hashCode` if overriding `==`.'; class HashAndEquals extends AnalysisRule { - HashAndEquals() : super(name: LintNames.hash_and_equals, description: _desc); + new() : super(name: LintNames.hash_and_equals, description: _desc); @override DiagnosticCode get diagnosticCode => diag.hashAndEquals; @@ -36,7 +36,7 @@ class HashAndEquals extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/implementation_imports.dart b/pkg/linter/lib/src/rules/implementation_imports.dart index 4a92373bc1e..49f8c2e6a27 100644 --- a/pkg/linter/lib/src/rules/implementation_imports.dart +++ b/pkg/linter/lib/src/rules/implementation_imports.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't import implementation files from another package."; class ImplementationImports extends AnalysisRule { - ImplementationImports() - : super(name: LintNames.implementation_imports, description: _desc); + new() : super(name: LintNames.implementation_imports, description: _desc); @override DiagnosticCode get diagnosticCode => diag.implementationImports; @@ -43,7 +42,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final Uri sourceUri; - _Visitor(this.rule, this.sourceUri); + new(this.rule, this.sourceUri); @override void visitImportDirective(ImportDirective node) { diff --git a/pkg/linter/lib/src/rules/implicit_call_tearoffs.dart b/pkg/linter/lib/src/rules/implicit_call_tearoffs.dart index 265a68f0d08..d54360e4a44 100644 --- a/pkg/linter/lib/src/rules/implicit_call_tearoffs.dart +++ b/pkg/linter/lib/src/rules/implicit_call_tearoffs.dart @@ -16,8 +16,7 @@ const _desc = r'Explicitly tear-off `call` methods when using an object as a Function.'; class ImplicitCallTearoffs extends AnalysisRule { - ImplicitCallTearoffs() - : super(name: LintNames.implicit_call_tearoffs, description: _desc); + new() : super(name: LintNames.implicit_call_tearoffs, description: _desc); @override DiagnosticCode get diagnosticCode => diag.implicitCallTearoffs; @@ -35,7 +34,7 @@ class ImplicitCallTearoffs extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitImplicitCallReference(ImplicitCallReference node) { diff --git a/pkg/linter/lib/src/rules/implicit_reopen.dart b/pkg/linter/lib/src/rules/implicit_reopen.dart index 3b917a99000..225d3107cf0 100644 --- a/pkg/linter/lib/src/rules/implicit_reopen.dart +++ b/pkg/linter/lib/src/rules/implicit_reopen.dart @@ -18,7 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't implicitly reopen classes."; class ImplicitReopen extends AnalysisRule { - ImplicitReopen() + new() : super( name: LintNames.implicit_reopen, description: _desc, @@ -42,7 +42,7 @@ class ImplicitReopen extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void checkElement({ required InterfaceElement? element, diff --git a/pkg/linter/lib/src/rules/initialize_in_field_declaration.dart b/pkg/linter/lib/src/rules/initialize_in_field_declaration.dart index e25c7e727a5..d5f3d7987b0 100644 --- a/pkg/linter/lib/src/rules/initialize_in_field_declaration.dart +++ b/pkg/linter/lib/src/rules/initialize_in_field_declaration.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Initialize the field in the field's initializer."; class InitializeInFieldDeclaration extends AnalysisRule { - InitializeInFieldDeclaration() + new() : super( name: LintNames.initialize_in_field_declaration, description: _desc, @@ -41,7 +41,7 @@ class _ParameterReferenceVisitor extends RecursiveAstVisitor { final ConstructorElement constructorElement; bool referencesParameter = false; - _ParameterReferenceVisitor(this.constructorElement); + new(this.constructorElement); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -57,7 +57,7 @@ class _ParameterReferenceVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitPrimaryConstructorBody(PrimaryConstructorBody node) { diff --git a/pkg/linter/lib/src/rules/invalid_case_patterns.dart b/pkg/linter/lib/src/rules/invalid_case_patterns.dart index 8aa9c227406..8043874ce1d 100644 --- a/pkg/linter/lib/src/rules/invalid_case_patterns.dart +++ b/pkg/linter/lib/src/rules/invalid_case_patterns.dart @@ -19,7 +19,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use case expressions that are valid in Dart 3.0.'; class InvalidCasePatterns extends AnalysisRule { - InvalidCasePatterns() + new() : super( name: LintNames.invalid_case_patterns, description: _desc, @@ -48,7 +48,7 @@ class InvalidCasePatterns extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override visitSwitchCase(SwitchCase node) { diff --git a/pkg/linter/lib/src/rules/invalid_runtime_check_with_js_interop_types.dart b/pkg/linter/lib/src/rules/invalid_runtime_check_with_js_interop_types.dart index 8abb08fd2f6..b79051c1724 100644 --- a/pkg/linter/lib/src/rules/invalid_runtime_check_with_js_interop_types.dart +++ b/pkg/linter/lib/src/rules/invalid_runtime_check_with_js_interop_types.dart @@ -205,7 +205,7 @@ class InteropTypeChecker extends RecursiveTypeVisitor { bool _hasInteropType = false; final _visitedTypes = {}; - InteropTypeChecker() : super(includeTypeAliasArguments: false); + new() : super(includeTypeAliasArguments: false); bool hasInteropType(DartType type) { _hasInteropType = false; @@ -229,7 +229,7 @@ class InteropTypeChecker extends RecursiveTypeVisitor { } class InvalidRuntimeCheckWithJSInteropTypes extends MultiAnalysisRule { - InvalidRuntimeCheckWithJSInteropTypes() + new() : super( name: LintNames.invalid_runtime_check_with_js_interop_types, description: _desc, @@ -276,7 +276,7 @@ class _Visitor extends SimpleAstVisitor { EraseNonJSInteropTypes(); final InteropTypeChecker interopTypeChecker = InteropTypeChecker(); - _Visitor(this.rule, TypeSystem typeSystem) + new(this.rule, TypeSystem typeSystem) : typeSystem = typeSystem as TypeSystemImpl; /// Determines if a type test from [leftType] to [rightType] is a valid test diff --git a/pkg/linter/lib/src/rules/join_return_with_assignment.dart b/pkg/linter/lib/src/rules/join_return_with_assignment.dart index 5dba28d2612..702b79e9a7d 100644 --- a/pkg/linter/lib/src/rules/join_return_with_assignment.dart +++ b/pkg/linter/lib/src/rules/join_return_with_assignment.dart @@ -33,7 +33,7 @@ Expression? _getExpressionFromReturnStatement(Statement node) => node is ReturnStatement ? node.expression : null; class JoinReturnWithAssignment extends AnalysisRule { - JoinReturnWithAssignment() + new() : super(name: LintNames.join_return_with_assignment, description: _desc); @override @@ -52,7 +52,7 @@ class JoinReturnWithAssignment extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBlock(Block node) { diff --git a/pkg/linter/lib/src/rules/leading_newlines_in_multiline_strings.dart b/pkg/linter/lib/src/rules/leading_newlines_in_multiline_strings.dart index f64149a5a89..bc0e3832ef2 100644 --- a/pkg/linter/lib/src/rules/leading_newlines_in_multiline_strings.dart +++ b/pkg/linter/lib/src/rules/leading_newlines_in_multiline_strings.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Start multiline strings with a newline.'; class LeadingNewlinesInMultilineStrings extends AnalysisRule { - LeadingNewlinesInMultilineStrings() + new() : super( name: LintNames.leading_newlines_in_multiline_strings, description: _desc, @@ -42,7 +42,7 @@ class _Visitor extends SimpleAstVisitor { late LineInfo lineInfo; - _Visitor(this.rule); + new(this.rule); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/library_annotations.dart b/pkg/linter/lib/src/rules/library_annotations.dart index aeaf42d6492..55a716c8153 100644 --- a/pkg/linter/lib/src/rules/library_annotations.dart +++ b/pkg/linter/lib/src/rules/library_annotations.dart @@ -19,8 +19,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Attach library annotations to library directives.'; class LibraryAnnotations extends AnalysisRule { - LibraryAnnotations() - : super(name: LintNames.library_annotations, description: _desc); + new() : super(name: LintNames.library_annotations, description: _desc); @override DiagnosticCode get diagnosticCode => diag.libraryAnnotations; @@ -40,7 +39,7 @@ class _Visitor extends SimpleAstVisitor { Directive? firstDirective; - _Visitor(this.rule); + new(this.rule); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/library_names.dart b/pkg/linter/lib/src/rules/library_names.dart index 21e6160ab34..c0a7ec86a25 100644 --- a/pkg/linter/lib/src/rules/library_names.dart +++ b/pkg/linter/lib/src/rules/library_names.dart @@ -16,7 +16,7 @@ import '../utils.dart'; const _desc = r'Name libraries using `lowercase_with_underscores`.'; class LibraryNames extends AnalysisRule { - LibraryNames() : super(name: LintNames.library_names, description: _desc); + new() : super(name: LintNames.library_names, description: _desc); @override DiagnosticCode get diagnosticCode => diag.libraryNames; @@ -34,7 +34,7 @@ class LibraryNames extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitLibraryDirective(LibraryDirective node) { diff --git a/pkg/linter/lib/src/rules/library_prefixes.dart b/pkg/linter/lib/src/rules/library_prefixes.dart index efe3d598212..8ad985f02c4 100644 --- a/pkg/linter/lib/src/rules/library_prefixes.dart +++ b/pkg/linter/lib/src/rules/library_prefixes.dart @@ -18,8 +18,7 @@ const _desc = r'Use `lowercase_with_underscores` when specifying a library prefix.'; class LibraryPrefixes extends AnalysisRule { - LibraryPrefixes() - : super(name: LintNames.library_prefixes, description: _desc); + new() : super(name: LintNames.library_prefixes, description: _desc); @override DiagnosticCode get diagnosticCode => diag.libraryPrefixes; @@ -40,7 +39,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule, RuleContext context) + new(this.rule, RuleContext context) : _wildCardVariablesEnabled = context.isFeatureEnabled( Feature.wildcard_variables, ); diff --git a/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart b/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart index 913e58f467f..645ef2d3261 100644 --- a/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart +++ b/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart @@ -18,7 +18,7 @@ import '../extensions.dart'; const _desc = r'Avoid using private types in public APIs.'; class LibraryPrivateTypesInPublicApi extends AnalysisRule { - LibraryPrivateTypesInPublicApi() + new() : super( name: LintNames.library_private_types_in_public_api, description: _desc, @@ -40,7 +40,7 @@ class LibraryPrivateTypesInPublicApi extends AnalysisRule { class Validator extends SimpleAstVisitor { AnalysisRule rule; - Validator(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { @@ -306,7 +306,7 @@ class Validator extends SimpleAstVisitor { class Visitor extends SimpleAstVisitor { AnalysisRule rule; - Visitor(this.rule); + new(this.rule); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/lines_longer_than_80_chars.dart b/pkg/linter/lib/src/rules/lines_longer_than_80_chars.dart index 96dba773fd5..710383799da 100644 --- a/pkg/linter/lib/src/rules/lines_longer_than_80_chars.dart +++ b/pkg/linter/lib/src/rules/lines_longer_than_80_chars.dart @@ -32,8 +32,7 @@ bool _looksLikeUriOrPath(String value) { } class LinesLongerThan80Chars extends AnalysisRule { - LinesLongerThan80Chars() - : super(name: LintNames.lines_longer_than_80_chars, description: _desc); + new() : super(name: LintNames.lines_longer_than_80_chars, description: _desc); @override DiagnosticCode get diagnosticCode => diag.linesLongerThan80Chars; @@ -52,7 +51,7 @@ class _AllowedCommentVisitor extends SimpleAstVisitor { final LineInfo lineInfo; final allowedLines = []; - _AllowedCommentVisitor(this.lineInfo); + new(this.lineInfo); @override void visitCompilationUnit(CompilationUnit node) { @@ -104,7 +103,7 @@ class _AllowedLongLineVisitor extends RecursiveAstVisitor { final LineInfo lineInfo; final allowedLines = []; - _AllowedLongLineVisitor(this.lineInfo); + new(this.lineInfo); @override void visitSimpleStringLiteral(SimpleStringLiteral node) { @@ -151,7 +150,7 @@ class _LineInfo { final int index; final int offset; final int end; - _LineInfo({required this.index, required this.offset, required this.end}); + new({required this.index, required this.offset, required this.end}); int get length => end - offset; } @@ -160,7 +159,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/literal_only_boolean_expressions.dart b/pkg/linter/lib/src/rules/literal_only_boolean_expressions.dart index fdeb45d7797..f1a2c91390c 100644 --- a/pkg/linter/lib/src/rules/literal_only_boolean_expressions.dart +++ b/pkg/linter/lib/src/rules/literal_only_boolean_expressions.dart @@ -40,7 +40,7 @@ bool _onlyLiterals(Expression? rawExpression) { } class LiteralOnlyBooleanExpressions extends AnalysisRule { - LiteralOnlyBooleanExpressions() + new() : super( name: LintNames.literal_only_boolean_expressions, description: _desc, @@ -66,7 +66,7 @@ class LiteralOnlyBooleanExpressions extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitDoStatement(DoStatement node) { diff --git a/pkg/linter/lib/src/rules/matching_super_parameters.dart b/pkg/linter/lib/src/rules/matching_super_parameters.dart index fc5ca318b4a..fa4f573f393 100644 --- a/pkg/linter/lib/src/rules/matching_super_parameters.dart +++ b/pkg/linter/lib/src/rules/matching_super_parameters.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use matching super parameter names.'; class MatchingSuperParameters extends AnalysisRule { - MatchingSuperParameters() - : super(name: LintNames.matching_super_parameters, description: _desc); + new() : super(name: LintNames.matching_super_parameters, description: _desc); @override DiagnosticCode get diagnosticCode => diag.matchingSuperParameters; @@ -36,7 +35,7 @@ class MatchingSuperParameters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - const _Visitor(this.rule); + const new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/missing_code_block_language_in_doc_comment.dart b/pkg/linter/lib/src/rules/missing_code_block_language_in_doc_comment.dart index f3263b8e27e..ef75b75b297 100644 --- a/pkg/linter/lib/src/rules/missing_code_block_language_in_doc_comment.dart +++ b/pkg/linter/lib/src/rules/missing_code_block_language_in_doc_comment.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'A code block is missing a specified language.'; class MissingCodeBlockLanguageInDocComment extends AnalysisRule { - MissingCodeBlockLanguageInDocComment() + new() : super( name: LintNames.missing_code_block_language_in_doc_comment, description: _desc, @@ -39,7 +39,7 @@ class MissingCodeBlockLanguageInDocComment extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitComment(Comment node) { diff --git a/pkg/linter/lib/src/rules/missing_whitespace_between_adjacent_strings.dart b/pkg/linter/lib/src/rules/missing_whitespace_between_adjacent_strings.dart index bbf8881b232..b087ce8b7a4 100644 --- a/pkg/linter/lib/src/rules/missing_whitespace_between_adjacent_strings.dart +++ b/pkg/linter/lib/src/rules/missing_whitespace_between_adjacent_strings.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Missing whitespace between adjacent strings.'; class MissingWhitespaceBetweenAdjacentStrings extends AnalysisRule { - MissingWhitespaceBetweenAdjacentStrings() + new() : super( name: LintNames.missing_whitespace_between_adjacent_strings, description: _desc, @@ -38,7 +38,7 @@ class MissingWhitespaceBetweenAdjacentStrings extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAdjacentStrings(AdjacentStrings node) { diff --git a/pkg/linter/lib/src/rules/no_adjacent_strings_in_list.dart b/pkg/linter/lib/src/rules/no_adjacent_strings_in_list.dart index dee4ce751db..9135c98ba27 100644 --- a/pkg/linter/lib/src/rules/no_adjacent_strings_in_list.dart +++ b/pkg/linter/lib/src/rules/no_adjacent_strings_in_list.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't use adjacent strings in list."; class NoAdjacentStringsInList extends AnalysisRule { - NoAdjacentStringsInList() + new() : super(name: LintNames.no_adjacent_strings_in_list, description: _desc); @override @@ -38,7 +38,7 @@ class NoAdjacentStringsInList extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void check(AstNode? element) { if (element is AdjacentStrings) { diff --git a/pkg/linter/lib/src/rules/no_default_cases.dart b/pkg/linter/lib/src/rules/no_default_cases.dart index 261e8c67143..f532c0932d8 100644 --- a/pkg/linter/lib/src/rules/no_default_cases.dart +++ b/pkg/linter/lib/src/rules/no_default_cases.dart @@ -19,7 +19,7 @@ import '../extensions.dart'; const _desc = r'No default cases.'; class NoDefaultCases extends AnalysisRule { - NoDefaultCases() + new() : super( name: LintNames.no_default_cases, description: _desc, @@ -42,7 +42,7 @@ class NoDefaultCases extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitSwitchStatement(SwitchStatement statement) { diff --git a/pkg/linter/lib/src/rules/no_duplicate_case_values.dart b/pkg/linter/lib/src/rules/no_duplicate_case_values.dart index 1ddd3238bc7..58bd2edca2c 100644 --- a/pkg/linter/lib/src/rules/no_duplicate_case_values.dart +++ b/pkg/linter/lib/src/rules/no_duplicate_case_values.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't use more than one case with same value."; class NoDuplicateCaseValues extends AnalysisRule { - NoDuplicateCaseValues() - : super(name: LintNames.no_duplicate_case_values, description: _desc); + new() : super(name: LintNames.no_duplicate_case_values, description: _desc); @override DiagnosticCode get diagnosticCode => diag.noDuplicateCaseValues; @@ -35,7 +34,7 @@ class NoDuplicateCaseValues extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final NoDuplicateCaseValues rule; - _Visitor(this.rule); + new(this.rule); @override void visitSwitchStatement(SwitchStatement node) { diff --git a/pkg/linter/lib/src/rules/no_leading_underscores_for_library_prefixes.dart b/pkg/linter/lib/src/rules/no_leading_underscores_for_library_prefixes.dart index ee37f5d81bf..485b9c49ffc 100644 --- a/pkg/linter/lib/src/rules/no_leading_underscores_for_library_prefixes.dart +++ b/pkg/linter/lib/src/rules/no_leading_underscores_for_library_prefixes.dart @@ -17,7 +17,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Avoid leading underscores for library prefixes.'; class NoLeadingUnderscoresForLibraryPrefixes extends AnalysisRule { - NoLeadingUnderscoresForLibraryPrefixes() + new() : super( name: LintNames.no_leading_underscores_for_library_prefixes, description: _desc, @@ -43,7 +43,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule, RuleContext context) + new(this.rule, RuleContext context) : _wildCardVariablesEnabled = context.isFeatureEnabled( Feature.wildcard_variables, ); diff --git a/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart b/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart index 0d06800c2a2..afa805454d2 100644 --- a/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart +++ b/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart @@ -19,7 +19,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Avoid leading underscores for local identifiers.'; class NoLeadingUnderscoresForLocalIdentifiers extends AnalysisRule { - NoLeadingUnderscoresForLocalIdentifiers() + new() : super( name: LintNames.no_leading_underscores_for_local_identifiers, description: _desc, @@ -48,7 +48,7 @@ class NoLeadingUnderscoresForLocalIdentifiers extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void checkIdentifier(Token? id) { if (id == null) return; diff --git a/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart b/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart index 4f6c9e53159..566e4de0530 100644 --- a/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart +++ b/pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't compare boolean expressions to boolean literals."; class NoLiteralBoolComparisons extends AnalysisRule { - NoLiteralBoolComparisons() + new() : super(name: LintNames.no_literal_bool_comparisons, description: _desc); @override @@ -37,7 +37,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); bool isBool(DartType? type) => type != null && diff --git a/pkg/linter/lib/src/rules/no_logic_in_create_state.dart b/pkg/linter/lib/src/rules/no_logic_in_create_state.dart index 7380b9ce453..a5d8d6c6bec 100644 --- a/pkg/linter/lib/src/rules/no_logic_in_create_state.dart +++ b/pkg/linter/lib/src/rules/no_logic_in_create_state.dart @@ -16,8 +16,7 @@ import '../util/flutter_utils.dart'; const _desc = r"Don't put any logic in createState."; class NoLogicInCreateState extends AnalysisRule { - NoLogicInCreateState() - : super(name: LintNames.no_logic_in_create_state, description: _desc); + new() : super(name: LintNames.no_logic_in_create_state, description: _desc); @override DiagnosticCode get diagnosticCode => diag.noLogicInCreateState; @@ -35,7 +34,7 @@ class NoLogicInCreateState extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/no_runtimeType_toString.dart b/pkg/linter/lib/src/rules/no_runtimeType_toString.dart index 031316cf878..35fe0302345 100644 --- a/pkg/linter/lib/src/rules/no_runtimeType_toString.dart +++ b/pkg/linter/lib/src/rules/no_runtimeType_toString.dart @@ -18,8 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid calling `toString()` on `runtimeType`.'; class NoRuntimeTypeToString extends AnalysisRule { - NoRuntimeTypeToString() - : super(name: LintNames.no_runtimetype_tostring, description: _desc); + new() : super(name: LintNames.no_runtimetype_tostring, description: _desc); @override DiagnosticCode get diagnosticCode => diag.noRuntimetypeTostring; @@ -38,7 +37,7 @@ class NoRuntimeTypeToString extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInterpolationExpression(InterpolationExpression node) { diff --git a/pkg/linter/lib/src/rules/no_self_assignments.dart b/pkg/linter/lib/src/rules/no_self_assignments.dart index 05300223a2f..ed6ee1c56a5 100644 --- a/pkg/linter/lib/src/rules/no_self_assignments.dart +++ b/pkg/linter/lib/src/rules/no_self_assignments.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't assign a variable to itself."; class NoSelfAssignments extends AnalysisRule { - NoSelfAssignments() - : super(name: LintNames.no_self_assignments, description: _desc); + new() : super(name: LintNames.no_self_assignments, description: _desc); @override DiagnosticCode get diagnosticCode => diag.noSelfAssignments; @@ -35,7 +34,7 @@ class NoSelfAssignments extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAssignmentExpression(AssignmentExpression node) { diff --git a/pkg/linter/lib/src/rules/no_wildcard_variable_uses.dart b/pkg/linter/lib/src/rules/no_wildcard_variable_uses.dart index 6d73b5b9ae9..dd0c01cd1c1 100644 --- a/pkg/linter/lib/src/rules/no_wildcard_variable_uses.dart +++ b/pkg/linter/lib/src/rules/no_wildcard_variable_uses.dart @@ -18,8 +18,7 @@ import '../util/ascii_utils.dart'; const _desc = r"Don't use wildcard parameters or variables."; class NoWildcardVariableUses extends AnalysisRule { - NoWildcardVariableUses() - : super(name: LintNames.no_wildcard_variable_uses, description: _desc); + new() : super(name: LintNames.no_wildcard_variable_uses, description: _desc); @override DiagnosticCode get diagnosticCode => diag.noWildcardVariableUses; @@ -39,7 +38,7 @@ class NoWildcardVariableUses extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitSimpleIdentifier(SimpleIdentifier node) { diff --git a/pkg/linter/lib/src/rules/non_constant_identifier_names.dart b/pkg/linter/lib/src/rules/non_constant_identifier_names.dart index a5a354bd2bb..66874f44bf2 100644 --- a/pkg/linter/lib/src/rules/non_constant_identifier_names.dart +++ b/pkg/linter/lib/src/rules/non_constant_identifier_names.dart @@ -19,7 +19,7 @@ import '../utils.dart'; const _desc = r'Name non-constant identifiers using lowerCamelCase.'; class NonConstantIdentifierNames extends AnalysisRule { - NonConstantIdentifierNames() + new() : super(name: LintNames.non_constant_identifier_names, description: _desc); @override @@ -51,7 +51,7 @@ class NonConstantIdentifierNames extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void checkIdentifier(Token? id, {bool underscoresOk = false}) { if (id == null) { diff --git a/pkg/linter/lib/src/rules/noop_primitive_operations.dart b/pkg/linter/lib/src/rules/noop_primitive_operations.dart index 4294ca946d8..5f3934b7eee 100644 --- a/pkg/linter/lib/src/rules/noop_primitive_operations.dart +++ b/pkg/linter/lib/src/rules/noop_primitive_operations.dart @@ -16,8 +16,7 @@ import '../extensions.dart'; const _desc = r'Noop primitive operations.'; class NoopPrimitiveOperations extends AnalysisRule { - NoopPrimitiveOperations() - : super(name: LintNames.noop_primitive_operations, description: _desc); + new() : super(name: LintNames.noop_primitive_operations, description: _desc); @override DiagnosticCode get diagnosticCode => diag.noopPrimitiveOperations; @@ -38,7 +37,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitAdjacentStrings(AdjacentStrings node) { diff --git a/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart b/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart index 16c62fe03dc..38b9a996125 100644 --- a/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart +++ b/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart @@ -19,7 +19,7 @@ const _desc = r"Don't use `null` check on a potentially nullable type parameter."; class NullCheckOnNullableTypeParameter extends AnalysisRule { - NullCheckOnNullableTypeParameter() + new() : super( name: LintNames.null_check_on_nullable_type_parameter, description: _desc, @@ -43,7 +43,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); bool isNullableTypeParameterType(DartType? type) => type is TypeParameterType && context.typeSystem.isNullable(type); diff --git a/pkg/linter/lib/src/rules/null_closures.dart b/pkg/linter/lib/src/rules/null_closures.dart index 2082853715b..b8e0aaa3ceb 100644 --- a/pkg/linter/lib/src/rules/null_closures.dart +++ b/pkg/linter/lib/src/rules/null_closures.dart @@ -170,7 +170,7 @@ class NonNullableFunction { final List positional; final List named; - NonNullableFunction( + new( this.library, this.type, this.name, { @@ -191,7 +191,7 @@ class NonNullableFunction { } class NullClosures extends AnalysisRule { - NullClosures() : super(name: LintNames.null_closures, description: _desc); + new() : super(name: LintNames.null_closures, description: _desc); @override DiagnosticCode get diagnosticCode => diag.nullClosures; @@ -210,7 +210,7 @@ class NullClosures extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/omit_local_variable_types.dart b/pkg/linter/lib/src/rules/omit_local_variable_types.dart index b10ab6cdd93..01a6a652a67 100644 --- a/pkg/linter/lib/src/rules/omit_local_variable_types.dart +++ b/pkg/linter/lib/src/rules/omit_local_variable_types.dart @@ -18,8 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Omit type annotations for local variables.'; class OmitLocalVariableTypes extends AnalysisRule { - OmitLocalVariableTypes() - : super(name: LintNames.omit_local_variable_types, description: _desc); + new() : super(name: LintNames.omit_local_variable_types, description: _desc); @override DiagnosticCode get diagnosticCode => diag.omitLocalVariableTypes; @@ -46,7 +45,7 @@ class _Visitor extends SimpleAstVisitor { final TypeProvider typeProvider; - _Visitor(this.rule, this.typeProvider); + new(this.rule, this.typeProvider); @override void visitForStatement(ForStatement node) { diff --git a/pkg/linter/lib/src/rules/omit_obvious_local_variable_types.dart b/pkg/linter/lib/src/rules/omit_obvious_local_variable_types.dart index e9eb8a3019c..5e414c2f631 100644 --- a/pkg/linter/lib/src/rules/omit_obvious_local_variable_types.dart +++ b/pkg/linter/lib/src/rules/omit_obvious_local_variable_types.dart @@ -19,7 +19,7 @@ import '../util/obvious_types.dart'; const _desc = r'Omit obvious type annotations for local variables.'; class OmitObviousLocalVariableTypes extends AnalysisRule { - OmitObviousLocalVariableTypes() + new() : super( name: LintNames.omit_obvious_local_variable_types, description: _desc, @@ -46,7 +46,7 @@ class OmitObviousLocalVariableTypes extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitForStatement(ForStatement node) { diff --git a/pkg/linter/lib/src/rules/omit_obvious_property_types.dart b/pkg/linter/lib/src/rules/omit_obvious_property_types.dart index 2c74b2a36cb..4aa78aaf6de 100644 --- a/pkg/linter/lib/src/rules/omit_obvious_property_types.dart +++ b/pkg/linter/lib/src/rules/omit_obvious_property_types.dart @@ -18,7 +18,7 @@ const _desc = r'Omit obvious type annotations for top-level and static variables.'; class OmitObviousPropertyTypes extends AnalysisRule { - OmitObviousPropertyTypes() + new() : super( name: 'omit_obvious_property_types', description: _desc, @@ -48,7 +48,7 @@ class OmitObviousPropertyTypes extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldDeclaration(FieldDeclaration node) => diff --git a/pkg/linter/lib/src/rules/one_member_abstracts.dart b/pkg/linter/lib/src/rules/one_member_abstracts.dart index e5634c4b153..f60280f1289 100644 --- a/pkg/linter/lib/src/rules/one_member_abstracts.dart +++ b/pkg/linter/lib/src/rules/one_member_abstracts.dart @@ -17,8 +17,7 @@ const _desc = r'Avoid defining a one-member abstract class when a simple function will do.'; class OneMemberAbstracts extends AnalysisRule { - OneMemberAbstracts() - : super(name: LintNames.one_member_abstracts, description: _desc); + new() : super(name: LintNames.one_member_abstracts, description: _desc); @override DiagnosticCode get diagnosticCode => diag.oneMemberAbstracts; @@ -36,7 +35,7 @@ class OneMemberAbstracts extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/only_throw_errors.dart b/pkg/linter/lib/src/rules/only_throw_errors.dart index a7834f09a95..8ca17a6cab6 100644 --- a/pkg/linter/lib/src/rules/only_throw_errors.dart +++ b/pkg/linter/lib/src/rules/only_throw_errors.dart @@ -31,8 +31,7 @@ bool _isThrowable(DartType? type) { } class OnlyThrowErrors extends AnalysisRule { - OnlyThrowErrors() - : super(name: LintNames.only_throw_errors, description: _desc); + new() : super(name: LintNames.only_throw_errors, description: _desc); @override DiagnosticCode get diagnosticCode => diag.onlyThrowErrors; @@ -50,7 +49,7 @@ class OnlyThrowErrors extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitThrowExpression(ThrowExpression node) { diff --git a/pkg/linter/lib/src/rules/overridden_fields.dart b/pkg/linter/lib/src/rules/overridden_fields.dart index 7aeaf69c9a7..f4564d11e57 100644 --- a/pkg/linter/lib/src/rules/overridden_fields.dart +++ b/pkg/linter/lib/src/rules/overridden_fields.dart @@ -18,8 +18,7 @@ import '../extensions.dart'; const _desc = r"Don't override fields."; class OverriddenFields extends AnalysisRule { - OverriddenFields() - : super(name: LintNames.overridden_fields, description: _desc); + new() : super(name: LintNames.overridden_fields, description: _desc); @override DiagnosticCode get diagnosticCode => diag.overriddenFields; @@ -38,7 +37,7 @@ class OverriddenFields extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldDeclaration(FieldDeclaration node) { diff --git a/pkg/linter/lib/src/rules/package_prefixed_library_names.dart b/pkg/linter/lib/src/rules/package_prefixed_library_names.dart index 0386094b1db..b01b64a91c7 100644 --- a/pkg/linter/lib/src/rules/package_prefixed_library_names.dart +++ b/pkg/linter/lib/src/rules/package_prefixed_library_names.dart @@ -21,7 +21,7 @@ bool matchesOrIsPrefixedBy(String name, String prefix) => name == prefix || name.startsWith('$prefix.'); class PackagePrefixedLibraryNames extends AnalysisRule { - PackagePrefixedLibraryNames() + new() : super(name: LintNames.package_prefixed_library_names, description: _desc); @override @@ -40,7 +40,7 @@ class PackagePrefixedLibraryNames extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final PackagePrefixedLibraryNames rule; - _Visitor(this.rule); + new(this.rule); @override void visitLibraryDirective(LibraryDirective node) { diff --git a/pkg/linter/lib/src/rules/parameter_assignments.dart b/pkg/linter/lib/src/rules/parameter_assignments.dart index 8ff4cfc4777..70738379f43 100644 --- a/pkg/linter/lib/src/rules/parameter_assignments.dart +++ b/pkg/linter/lib/src/rules/parameter_assignments.dart @@ -27,8 +27,7 @@ bool _isFormalParameterReassigned( } class ParameterAssignments extends AnalysisRule { - ParameterAssignments() - : super(name: LintNames.parameter_assignments, description: _desc); + new() : super(name: LintNames.parameter_assignments, description: _desc); @override DiagnosticCode get diagnosticCode => diag.parameterAssignments; @@ -53,7 +52,7 @@ class _DeclarationVisitor extends RecursiveAstVisitor { bool hasBeenAssigned = false; - _DeclarationVisitor(this._parameter, this.rule); + new(this._parameter, this.rule); Element? get parameterElement => _parameter.declaredFragment?.element; @@ -155,7 +154,7 @@ class _DeclarationVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart b/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart index 81fe4751ec9..89a1f9e8c7b 100644 --- a/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart +++ b/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use adjacent strings to concatenate string literals.'; class PreferAdjacentStringConcatenation extends AnalysisRule { - PreferAdjacentStringConcatenation() + new() : super( name: LintNames.prefer_adjacent_string_concatenation, description: _desc, @@ -37,7 +37,7 @@ class PreferAdjacentStringConcatenation extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart b/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart index 9dd3890d1c4..18d9d512a20 100644 --- a/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart +++ b/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer putting asserts in initializer lists.'; class PreferAssertsInInitializerLists extends AnalysisRule { - PreferAssertsInInitializerLists() + new() : super( name: LintNames.prefer_asserts_in_initializer_lists, description: _desc, @@ -44,7 +44,7 @@ class _AssertVisitor extends RecursiveAstVisitor { bool needInstance = false; - _AssertVisitor(this.constructorElement, this.classAndSuperClasses); + new(this.constructorElement, this.classAndSuperClasses); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -104,7 +104,7 @@ class _ClassAndSuperClasses { final ClassElement? element; final Set _classes = {}; - _ClassAndSuperClasses(this.element); + new(this.element); /// The [element] and its super classes, including mixins. Set get classes { @@ -130,7 +130,7 @@ class _Visitor extends SimpleAstVisitor { _ClassAndSuperClasses? _classAndSuperClasses; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_asserts_with_message.dart b/pkg/linter/lib/src/rules/prefer_asserts_with_message.dart index 63ece8fa3aa..391fd5fcd08 100644 --- a/pkg/linter/lib/src/rules/prefer_asserts_with_message.dart +++ b/pkg/linter/lib/src/rules/prefer_asserts_with_message.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer asserts with message.'; class PreferAssertsWithMessage extends AnalysisRule { - PreferAssertsWithMessage() + new() : super(name: LintNames.prefer_asserts_with_message, description: _desc); @override @@ -35,7 +35,7 @@ class PreferAssertsWithMessage extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAssertInitializer(AssertInitializer node) { diff --git a/pkg/linter/lib/src/rules/prefer_collection_literals.dart b/pkg/linter/lib/src/rules/prefer_collection_literals.dart index 2ea3cf8e755..3b4ae35876c 100644 --- a/pkg/linter/lib/src/rules/prefer_collection_literals.dart +++ b/pkg/linter/lib/src/rules/prefer_collection_literals.dart @@ -19,8 +19,7 @@ import '../extensions.dart'; const _desc = r'Use collection literals when possible.'; class PreferCollectionLiterals extends AnalysisRule { - PreferCollectionLiterals() - : super(name: LintNames.prefer_collection_literals, description: _desc); + new() : super(name: LintNames.prefer_collection_literals, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferCollectionLiterals; @@ -39,7 +38,7 @@ class PreferCollectionLiterals extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final TypeProvider typeProvider; - _Visitor(this.rule, this.typeProvider); + new(this.rule, this.typeProvider); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_conditional_assignment.dart b/pkg/linter/lib/src/rules/prefer_conditional_assignment.dart index c5fade0c1a4..5d362c4d8ba 100644 --- a/pkg/linter/lib/src/rules/prefer_conditional_assignment.dart +++ b/pkg/linter/lib/src/rules/prefer_conditional_assignment.dart @@ -49,7 +49,7 @@ Expression? _getExpressionCondition(Expression rawExpression) { } class PreferConditionalAssignment extends AnalysisRule { - PreferConditionalAssignment() + new() : super(name: LintNames.prefer_conditional_assignment, description: _desc); @override @@ -68,7 +68,7 @@ class PreferConditionalAssignment extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitIfStatement(IfStatement node) { diff --git a/pkg/linter/lib/src/rules/prefer_const_constructors.dart b/pkg/linter/lib/src/rules/prefer_const_constructors.dart index f5d74c3758e..4dc21ad30f0 100644 --- a/pkg/linter/lib/src/rules/prefer_const_constructors.dart +++ b/pkg/linter/lib/src/rules/prefer_const_constructors.dart @@ -18,8 +18,7 @@ import '../extensions.dart'; const _desc = r'Prefer `const` with constant constructors.'; class PreferConstConstructors extends AnalysisRule { - PreferConstConstructors() - : super(name: LintNames.prefer_const_constructors, description: _desc); + new() : super(name: LintNames.prefer_const_constructors, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferConstConstructors; @@ -38,7 +37,7 @@ class PreferConstConstructors extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitDotShorthandConstructorInvocation( diff --git a/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart b/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart index bf9ae1cd5e4..c37a1a6d157 100644 --- a/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart +++ b/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart @@ -18,7 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer declaring `const` constructors on `@immutable` classes.'; class PreferConstConstructorsInImmutables extends AnalysisRule { - PreferConstConstructorsInImmutables() + new() : super( name: LintNames.prefer_const_constructors_in_immutables, description: _desc, @@ -41,7 +41,7 @@ class PreferConstConstructorsInImmutables extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_const_declarations.dart b/pkg/linter/lib/src/rules/prefer_const_declarations.dart index 7ed0e3b3375..d3d14bc86fe 100644 --- a/pkg/linter/lib/src/rules/prefer_const_declarations.dart +++ b/pkg/linter/lib/src/rules/prefer_const_declarations.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer `const` over `final` for declarations.'; class PreferConstDeclarations extends AnalysisRule { - PreferConstDeclarations() - : super(name: LintNames.prefer_const_declarations, description: _desc); + new() : super(name: LintNames.prefer_const_declarations, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferConstDeclarations; @@ -38,7 +37,7 @@ class PreferConstDeclarations extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldDeclaration(FieldDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_const_literals_to_create_immutables.dart b/pkg/linter/lib/src/rules/prefer_const_literals_to_create_immutables.dart index b12734cc273..e7fcffa8542 100644 --- a/pkg/linter/lib/src/rules/prefer_const_literals_to_create_immutables.dart +++ b/pkg/linter/lib/src/rules/prefer_const_literals_to_create_immutables.dart @@ -17,7 +17,7 @@ const desc = 'Prefer const literals as parameters of constructors on @immutable classes.'; class PreferConstLiteralsToCreateImmutables extends AnalysisRule { - PreferConstLiteralsToCreateImmutables() + new() : super( name: LintNames.prefer_const_literals_to_create_immutables, description: desc, @@ -41,7 +41,7 @@ class PreferConstLiteralsToCreateImmutables extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitListLiteral(ListLiteral node) => _visitTypedLiteral(node); diff --git a/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart b/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart index a34270d07fa..5745197ed79 100644 --- a/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart +++ b/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart @@ -21,7 +21,7 @@ bool _hasNewInvocation(DartType returnType, FunctionBody body) => _BodyVisitor(returnType).containsInstanceCreation(body); class PreferConstructorsOverStaticMethods extends AnalysisRule { - PreferConstructorsOverStaticMethods() + new() : super( name: LintNames.prefer_constructors_over_static_methods, description: _desc, @@ -44,7 +44,7 @@ class _BodyVisitor extends RecursiveAstVisitor { bool found = false; final DartType returnType; - _BodyVisitor(this.returnType); + new(this.returnType); bool containsInstanceCreation(FunctionBody body) { body.accept(this); @@ -66,7 +66,7 @@ class _BodyVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_contains.dart b/pkg/linter/lib/src/rules/prefer_contains.dart index 815840246ca..1a9ef006623 100644 --- a/pkg/linter/lib/src/rules/prefer_contains.dart +++ b/pkg/linter/lib/src/rules/prefer_contains.dart @@ -18,7 +18,7 @@ import '../extensions.dart'; const _desc = r'Use contains for `List` and `String` instances.'; class PreferContains extends MultiAnalysisRule { - PreferContains() : super(name: LintNames.prefer_contains, description: _desc); + new() : super(name: LintNames.prefer_contains, description: _desc); // TODO(brianwilkerson): Both `alwaysFalse` and `alwaysTrue` should be warnings // rather than lints because they represent a bug rather than a style @@ -45,7 +45,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_double_quotes.dart b/pkg/linter/lib/src/rules/prefer_double_quotes.dart index cbab83022fa..fbd479c38d3 100644 --- a/pkg/linter/lib/src/rules/prefer_double_quotes.dart +++ b/pkg/linter/lib/src/rules/prefer_double_quotes.dart @@ -15,8 +15,7 @@ const _desc = r"Prefer double quotes where they won't require escape sequences."; class PreferDoubleQuotes extends AnalysisRule { - PreferDoubleQuotes() - : super(name: LintNames.prefer_double_quotes, description: _desc); + new() : super(name: LintNames.prefer_double_quotes, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferDoubleQuotes; diff --git a/pkg/linter/lib/src/rules/prefer_expression_function_bodies.dart b/pkg/linter/lib/src/rules/prefer_expression_function_bodies.dart index 356150e38dd..77eab76be62 100644 --- a/pkg/linter/lib/src/rules/prefer_expression_function_bodies.dart +++ b/pkg/linter/lib/src/rules/prefer_expression_function_bodies.dart @@ -16,7 +16,7 @@ const _desc = r'Use => for short members whose body is a single return statement.'; class PreferExpressionFunctionBodies extends AnalysisRule { - PreferExpressionFunctionBodies() + new() : super( name: LintNames.prefer_expression_function_bodies, description: _desc, @@ -38,7 +38,7 @@ class PreferExpressionFunctionBodies extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBlockFunctionBody(BlockFunctionBody node) { diff --git a/pkg/linter/lib/src/rules/prefer_final_fields.dart b/pkg/linter/lib/src/rules/prefer_final_fields.dart index 2404f1bede0..fbde6540005 100644 --- a/pkg/linter/lib/src/rules/prefer_final_fields.dart +++ b/pkg/linter/lib/src/rules/prefer_final_fields.dart @@ -18,8 +18,7 @@ import '../extensions.dart'; const _desc = r'Private field could be `final`.'; class PreferFinalFields extends AnalysisRule { - PreferFinalFields() - : super(name: LintNames.prefer_final_fields, description: _desc); + new() : super(name: LintNames.prefer_final_fields, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferFinalFields; @@ -103,7 +102,7 @@ class _FieldMutationFinder extends RecursiveAstVisitor { /// This visitor removes a field when it finds that it is assigned anywhere. final Map _fieldsFromParameters; - _FieldMutationFinder(this._fields, this._fieldsFromParameters); + new(this._fields, this._fieldsFromParameters); @override void visitAssignmentExpression(AssignmentExpression node) { @@ -143,7 +142,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart b/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart index d38b70d6159..3db34a764bf 100644 --- a/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart +++ b/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart @@ -17,8 +17,7 @@ const _desc = r'Prefer final in for-each loop variable if reference is not reassigned.'; class PreferFinalInForEach extends MultiAnalysisRule { - PreferFinalInForEach() - : super(name: LintNames.prefer_final_in_for_each, description: _desc); + new() : super(name: LintNames.prefer_final_in_for_each, description: _desc); @override List get diagnosticCodes => [ @@ -43,7 +42,7 @@ class PreferFinalInForEach extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_final_locals.dart b/pkg/linter/lib/src/rules/prefer_final_locals.dart index e56d83f7bb1..abade00d0a6 100644 --- a/pkg/linter/lib/src/rules/prefer_final_locals.dart +++ b/pkg/linter/lib/src/rules/prefer_final_locals.dart @@ -21,8 +21,7 @@ const _desc = r'Prefer final for variable declarations if they are not reassigned.'; class PreferFinalLocals extends AnalysisRule { - PreferFinalLocals() - : super(name: LintNames.prefer_final_locals, description: _desc); + new() : super(name: LintNames.prefer_final_locals, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferFinalLocals; @@ -61,7 +60,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final String currentFilePath; - _Visitor(this.rule, {required this.currentFilePath}); + new(this.rule, {required this.currentFilePath}); bool isPotentiallyMutated(AstNode pattern, FunctionBody function) { if (pattern is DeclaredVariablePattern) { diff --git a/pkg/linter/lib/src/rules/prefer_final_parameters.dart b/pkg/linter/lib/src/rules/prefer_final_parameters.dart index 2c2ee649c0d..2691e4cd282 100644 --- a/pkg/linter/lib/src/rules/prefer_final_parameters.dart +++ b/pkg/linter/lib/src/rules/prefer_final_parameters.dart @@ -21,7 +21,7 @@ const _desc = r'Prefer final for parameter declarations if they are not reassigned.'; class PreferFinalParameters extends AnalysisRule { - PreferFinalParameters() + new() : super( name: LintNames.prefer_final_parameters, description: _desc, @@ -57,7 +57,7 @@ class PreferFinalParameters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) => diff --git a/pkg/linter/lib/src/rules/prefer_for_elements_to_map_fromIterable.dart b/pkg/linter/lib/src/rules/prefer_for_elements_to_map_fromIterable.dart index e8f44ef7460..888b27f0091 100644 --- a/pkg/linter/lib/src/rules/prefer_for_elements_to_map_fromIterable.dart +++ b/pkg/linter/lib/src/rules/prefer_for_elements_to_map_fromIterable.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer `for` elements when building maps from iterables.'; class PreferForElementsToMapFromIterable extends AnalysisRule { - PreferForElementsToMapFromIterable() + new() : super( name: LintNames.prefer_for_elements_to_map_fromiterable, description: _desc, @@ -39,7 +39,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitInstanceCreationExpression(InstanceCreationExpression creation) { diff --git a/pkg/linter/lib/src/rules/prefer_foreach.dart b/pkg/linter/lib/src/rules/prefer_foreach.dart index d2e1d2a74a4..e33705412e1 100644 --- a/pkg/linter/lib/src/rules/prefer_foreach.dart +++ b/pkg/linter/lib/src/rules/prefer_foreach.dart @@ -17,7 +17,7 @@ import '../extensions.dart'; const _desc = r'Use `forEach` to only apply a function to all the elements.'; class PreferForeach extends AnalysisRule { - PreferForeach() : super(name: LintNames.prefer_foreach, description: _desc); + new() : super(name: LintNames.prefer_foreach, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferForeach; @@ -37,7 +37,7 @@ class _PreferForEachVisitor extends SimpleAstVisitor { LocalVariableElement? element; ForStatement? forEachStatement; - _PreferForEachVisitor(this.rule); + new(this.rule); @override void visitBlock(Block node) { @@ -92,7 +92,7 @@ class _PreferForEachVisitor extends SimpleAstVisitor { class _ReferenceFinder extends UnifyingAstVisitor { bool found = false; final LocalVariableElement? element; - _ReferenceFinder(this.element); + new(this.element); bool references(Expression target) { if (target.canonicalElement == element) return true; @@ -114,7 +114,7 @@ class _ReferenceFinder extends UnifyingAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitForStatement(ForStatement node) { diff --git a/pkg/linter/lib/src/rules/prefer_function_declarations_over_variables.dart b/pkg/linter/lib/src/rules/prefer_function_declarations_over_variables.dart index 7f5127898cf..a4dd8943544 100644 --- a/pkg/linter/lib/src/rules/prefer_function_declarations_over_variables.dart +++ b/pkg/linter/lib/src/rules/prefer_function_declarations_over_variables.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use a function declaration to bind a function to a name.'; class PreferFunctionDeclarationsOverVariables extends AnalysisRule { - PreferFunctionDeclarationsOverVariables() + new() : super( name: LintNames.prefer_function_declarations_over_variables, description: _desc, @@ -38,7 +38,7 @@ class PreferFunctionDeclarationsOverVariables extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitVariableDeclaration(VariableDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart b/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart index 8845852b76d..41b40da52cc 100644 --- a/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart +++ b/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer generic function type aliases.'; class PreferGenericFunctionTypeAliases extends AnalysisRule { - PreferGenericFunctionTypeAliases() + new() : super( name: LintNames.prefer_generic_function_type_aliases, description: _desc, @@ -40,7 +40,7 @@ class PreferGenericFunctionTypeAliases extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFunctionTypeAlias(FunctionTypeAlias node) { diff --git a/pkg/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart b/pkg/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart index 62d6cfb8f2b..bc9972fabb3 100644 --- a/pkg/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart +++ b/pkg/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer if elements to conditional expressions where possible.'; class PreferIfElementsToConditionalExpressions extends AnalysisRule { - PreferIfElementsToConditionalExpressions() + new() : super( name: LintNames.prefer_if_elements_to_conditional_expressions, description: _desc, @@ -38,7 +38,7 @@ class PreferIfElementsToConditionalExpressions extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConditionalExpression(ConditionalExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_if_null_operators.dart b/pkg/linter/lib/src/rules/prefer_if_null_operators.dart index e67348070a8..6ab46a72fec 100644 --- a/pkg/linter/lib/src/rules/prefer_if_null_operators.dart +++ b/pkg/linter/lib/src/rules/prefer_if_null_operators.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer using `??` operators.'; class PreferIfNullOperators extends AnalysisRule { - PreferIfNullOperators() - : super(name: LintNames.prefer_if_null_operators, description: _desc); + new() : super(name: LintNames.prefer_if_null_operators, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferIfNullOperators; @@ -35,7 +34,7 @@ class PreferIfNullOperators extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConditionalExpression(ConditionalExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_initializing_formals.dart b/pkg/linter/lib/src/rules/prefer_initializing_formals.dart index e778814f01b..118057f35bf 100644 --- a/pkg/linter/lib/src/rules/prefer_initializing_formals.dart +++ b/pkg/linter/lib/src/rules/prefer_initializing_formals.dart @@ -18,7 +18,7 @@ import '../extensions.dart'; const _desc = r'Use initializing formals when possible.'; class PreferInitializingFormals extends AnalysisRule { - PreferInitializingFormals() + new() : super(name: LintNames.prefer_initializing_formals, description: _desc); @override @@ -64,7 +64,7 @@ class _ConstructorChecker { /// surrounding library. final bool _privateNamedParametersEnabled; - _ConstructorChecker( + new( this._rule, this._constructorFragment, this._parameterList, @@ -208,7 +208,7 @@ class _ReferenceCounter extends RecursiveAstVisitor { int count = 0; - _ReferenceCounter(this.parameterElement); + new(this.parameterElement); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -222,7 +222,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule _rule; final RuleContext _context; - _Visitor(this._rule, this._context); + new(this._rule, this._context); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/prefer_inlined_adds.dart b/pkg/linter/lib/src/rules/prefer_inlined_adds.dart index 2cf78eee4a0..4ba80ee5db9 100644 --- a/pkg/linter/lib/src/rules/prefer_inlined_adds.dart +++ b/pkg/linter/lib/src/rules/prefer_inlined_adds.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Inline list item declarations where possible.'; class PreferInlinedAdds extends MultiAnalysisRule { - PreferInlinedAdds() - : super(name: LintNames.prefer_inlined_adds, description: _desc); + new() : super(name: LintNames.prefer_inlined_adds, description: _desc); @override List get diagnosticCodes => [ @@ -37,7 +36,7 @@ class PreferInlinedAdds extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation invocation) { diff --git a/pkg/linter/lib/src/rules/prefer_int_literals.dart b/pkg/linter/lib/src/rules/prefer_int_literals.dart index 14e33a5790f..efdb7746015 100644 --- a/pkg/linter/lib/src/rules/prefer_int_literals.dart +++ b/pkg/linter/lib/src/rules/prefer_int_literals.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = 'Prefer int literals over double literals.'; class PreferIntLiterals extends AnalysisRule { - PreferIntLiterals() - : super(name: LintNames.prefer_int_literals, description: _desc); + new() : super(name: LintNames.prefer_int_literals, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferIntLiterals; @@ -34,7 +33,7 @@ class PreferIntLiterals extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); /// Determine if the given literal can be replaced by an int literal. bool canReplaceWithIntLiteral(DoubleLiteral literal) { diff --git a/pkg/linter/lib/src/rules/prefer_interpolation_to_compose_strings.dart b/pkg/linter/lib/src/rules/prefer_interpolation_to_compose_strings.dart index 892adc6ede1..8f0f1ad0104 100644 --- a/pkg/linter/lib/src/rules/prefer_interpolation_to_compose_strings.dart +++ b/pkg/linter/lib/src/rules/prefer_interpolation_to_compose_strings.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use interpolation to compose strings and values.'; class PreferInterpolationToComposeStrings extends AnalysisRule { - PreferInterpolationToComposeStrings() + new() : super( name: LintNames.prefer_interpolation_to_compose_strings, description: _desc, @@ -41,7 +41,7 @@ class _Visitor extends SimpleAstVisitor { final skippedNodes = {}; - _Visitor(this.rule); + new(this.rule); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_is_empty.dart b/pkg/linter/lib/src/rules/prefer_is_empty.dart index e638295989d..d975c9620aa 100644 --- a/pkg/linter/lib/src/rules/prefer_is_empty.dart +++ b/pkg/linter/lib/src/rules/prefer_is_empty.dart @@ -19,7 +19,7 @@ import '../extensions.dart'; const _desc = r'Use `isEmpty` for `Iterable`s and `Map`s.'; class PreferIsEmpty extends MultiAnalysisRule { - PreferIsEmpty() : super(name: LintNames.prefer_is_empty, description: _desc); + new() : super(name: LintNames.prefer_is_empty, description: _desc); // TODO(brianwilkerson): Both `alwaysFalse` and `alwaysTrue` should be warnings // rather than lints because they represent a bug rather than a style @@ -47,7 +47,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_is_not_empty.dart b/pkg/linter/lib/src/rules/prefer_is_not_empty.dart index 5687b2a9773..0a75ba63824 100644 --- a/pkg/linter/lib/src/rules/prefer_is_not_empty.dart +++ b/pkg/linter/lib/src/rules/prefer_is_not_empty.dart @@ -18,8 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use `isNotEmpty` for `Iterable`s and `Map`s.'; class PreferIsNotEmpty extends AnalysisRule { - PreferIsNotEmpty() - : super(name: LintNames.prefer_is_not_empty, description: _desc); + new() : super(name: LintNames.prefer_is_not_empty, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferIsNotEmpty; @@ -37,7 +36,7 @@ class PreferIsNotEmpty extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitPrefixExpression(PrefixExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_is_not_operator.dart b/pkg/linter/lib/src/rules/prefer_is_not_operator.dart index 442851072b4..be83d32a99d 100644 --- a/pkg/linter/lib/src/rules/prefer_is_not_operator.dart +++ b/pkg/linter/lib/src/rules/prefer_is_not_operator.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer is! operator.'; class PreferIsNotOperator extends AnalysisRule { - PreferIsNotOperator() - : super(name: LintNames.prefer_is_not_operator, description: _desc); + new() : super(name: LintNames.prefer_is_not_operator, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferIsNotOperator; @@ -35,7 +34,7 @@ class PreferIsNotOperator extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitIsExpression(IsExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_iterable_whereType.dart b/pkg/linter/lib/src/rules/prefer_iterable_whereType.dart index 0235498ec77..1fdbbc16fa8 100644 --- a/pkg/linter/lib/src/rules/prefer_iterable_whereType.dart +++ b/pkg/linter/lib/src/rules/prefer_iterable_whereType.dart @@ -17,8 +17,7 @@ import '../extensions.dart'; const _desc = r'Prefer to use `whereType` on iterable.'; class PreferIterableWhereType extends AnalysisRule { - PreferIterableWhereType() - : super(name: LintNames.prefer_iterable_wheretype, description: _desc); + new() : super(name: LintNames.prefer_iterable_wheretype, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferIterableWheretype; @@ -36,7 +35,7 @@ class PreferIterableWhereType extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation node) { diff --git a/pkg/linter/lib/src/rules/prefer_mixin.dart b/pkg/linter/lib/src/rules/prefer_mixin.dart index 6017ddf629a..9341d7a6ecf 100644 --- a/pkg/linter/lib/src/rules/prefer_mixin.dart +++ b/pkg/linter/lib/src/rules/prefer_mixin.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer using mixins.'; class PreferMixin extends AnalysisRule { - PreferMixin() : super(name: LintNames.prefer_mixin, description: _desc); + new() : super(name: LintNames.prefer_mixin, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferMixin; @@ -35,7 +35,7 @@ class PreferMixin extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitWithClause(WithClause node) { diff --git a/pkg/linter/lib/src/rules/prefer_null_aware_method_calls.dart b/pkg/linter/lib/src/rules/prefer_null_aware_method_calls.dart index 0397e1c097a..5746801c9a7 100644 --- a/pkg/linter/lib/src/rules/prefer_null_aware_method_calls.dart +++ b/pkg/linter/lib/src/rules/prefer_null_aware_method_calls.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer `null`-aware method calls.'; class PreferNullAwareMethodCalls extends AnalysisRule { - PreferNullAwareMethodCalls() + new() : super(name: LintNames.prefer_null_aware_method_calls, description: _desc); @override @@ -36,7 +36,7 @@ class PreferNullAwareMethodCalls extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConditionalExpression(ConditionalExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_null_aware_operators.dart b/pkg/linter/lib/src/rules/prefer_null_aware_operators.dart index e454aa3370b..384c85c7b31 100644 --- a/pkg/linter/lib/src/rules/prefer_null_aware_operators.dart +++ b/pkg/linter/lib/src/rules/prefer_null_aware_operators.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer using `null`-aware operators.'; class PreferNullAwareOperators extends AnalysisRule { - PreferNullAwareOperators() + new() : super(name: LintNames.prefer_null_aware_operators, description: _desc); @override @@ -35,7 +35,7 @@ class PreferNullAwareOperators extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConditionalExpression(ConditionalExpression node) { diff --git a/pkg/linter/lib/src/rules/prefer_relative_imports.dart b/pkg/linter/lib/src/rules/prefer_relative_imports.dart index c8da184b2f2..3725e27aa47 100644 --- a/pkg/linter/lib/src/rules/prefer_relative_imports.dart +++ b/pkg/linter/lib/src/rules/prefer_relative_imports.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Prefer relative imports for files in `lib/`.'; class PreferRelativeImports extends AnalysisRule { - PreferRelativeImports() - : super(name: LintNames.prefer_relative_imports, description: _desc); + new() : super(name: LintNames.prefer_relative_imports, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferRelativeImports; @@ -48,7 +47,7 @@ class _Visitor extends SimpleAstVisitor { final Uri sourceUri; final RuleContext context; - _Visitor(this.rule, this.sourceUri, this.context); + new(this.rule, this.sourceUri, this.context); bool isPackageSelfReference(ImportDirective node) { if (node.libraryImport?.uri case DirectiveUriWithSource importedLibrary) { diff --git a/pkg/linter/lib/src/rules/prefer_single_quotes.dart b/pkg/linter/lib/src/rules/prefer_single_quotes.dart index 4fd2d33f546..5e4b1f77172 100644 --- a/pkg/linter/lib/src/rules/prefer_single_quotes.dart +++ b/pkg/linter/lib/src/rules/prefer_single_quotes.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Only use double quotes for strings containing single quotes.'; class PreferSingleQuotes extends AnalysisRule { - PreferSingleQuotes() - : super(name: LintNames.prefer_single_quotes, description: _desc); + new() : super(name: LintNames.prefer_single_quotes, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferSingleQuotes; @@ -39,7 +38,7 @@ class QuoteVisitor extends SimpleAstVisitor { final AnalysisRule rule; final bool useSingle; - QuoteVisitor(this.rule, {required this.useSingle}); + new(this.rule, {required this.useSingle}); /// Strings interpolations can contain other string nodes. Check like this. bool containsString(StringInterpolation string) { diff --git a/pkg/linter/lib/src/rules/prefer_spread_collections.dart b/pkg/linter/lib/src/rules/prefer_spread_collections.dart index fa32056809d..df648678013 100644 --- a/pkg/linter/lib/src/rules/prefer_spread_collections.dart +++ b/pkg/linter/lib/src/rules/prefer_spread_collections.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use spread collections when possible.'; class PreferSpreadCollections extends AnalysisRule { - PreferSpreadCollections() - : super(name: LintNames.prefer_spread_collections, description: _desc); + new() : super(name: LintNames.prefer_spread_collections, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferSpreadCollections; @@ -34,7 +33,7 @@ class PreferSpreadCollections extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation invocation) { diff --git a/pkg/linter/lib/src/rules/prefer_typing_uninitialized_variables.dart b/pkg/linter/lib/src/rules/prefer_typing_uninitialized_variables.dart index 761618152fc..dbbfbaaeaaf 100644 --- a/pkg/linter/lib/src/rules/prefer_typing_uninitialized_variables.dart +++ b/pkg/linter/lib/src/rules/prefer_typing_uninitialized_variables.dart @@ -16,7 +16,7 @@ import '../extensions.dart'; const _desc = r'Prefer typing uninitialized variables and fields.'; class PreferTypingUninitializedVariables extends MultiAnalysisRule { - PreferTypingUninitializedVariables() + new() : super( name: LintNames.prefer_typing_uninitialized_variables, description: _desc, @@ -41,7 +41,7 @@ class PreferTypingUninitializedVariables extends MultiAnalysisRule { class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitVariableDeclarationList(VariableDeclarationList node) { diff --git a/pkg/linter/lib/src/rules/prefer_void_to_null.dart b/pkg/linter/lib/src/rules/prefer_void_to_null.dart index 45455c410c9..e8870fc2bdd 100644 --- a/pkg/linter/lib/src/rules/prefer_void_to_null.dart +++ b/pkg/linter/lib/src/rules/prefer_void_to_null.dart @@ -18,8 +18,7 @@ const _desc = r"Don't use the Null type, unless you are positive that you don't want void."; class PreferVoidToNull extends AnalysisRule { - PreferVoidToNull() - : super(name: LintNames.prefer_void_to_null, description: _desc); + new() : super(name: LintNames.prefer_void_to_null, description: _desc); @override DiagnosticCode get diagnosticCode => diag.preferVoidToNull; @@ -37,7 +36,7 @@ class PreferVoidToNull extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); bool isFutureOrVoid(DartType type) { if (!type.isDartAsyncFutureOr) return false; diff --git a/pkg/linter/lib/src/rules/provide_deprecation_message.dart b/pkg/linter/lib/src/rules/provide_deprecation_message.dart index 314183a79a7..17056babc55 100644 --- a/pkg/linter/lib/src/rules/provide_deprecation_message.dart +++ b/pkg/linter/lib/src/rules/provide_deprecation_message.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Provide a deprecation message, via `@Deprecated("message")`.'; class ProvideDeprecationMessage extends AnalysisRule { - ProvideDeprecationMessage() + new() : super(name: LintNames.provide_deprecation_message, description: _desc); @override @@ -34,7 +34,7 @@ class ProvideDeprecationMessage extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAnnotation(Annotation node) { diff --git a/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart b/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart index 65bb08a2ef4..6456aa5edab 100644 --- a/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart +++ b/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart @@ -17,7 +17,7 @@ import '../../diagnostic.dart' as diag; const _desc = r'Depend on referenced packages.'; class DependOnReferencedPackages extends AnalysisRule { - DependOnReferencedPackages() + new() : super(name: LintNames.depend_on_referenced_packages, description: _desc); @override @@ -66,7 +66,7 @@ class _Visitor extends SimpleAstVisitor { final DependOnReferencedPackages rule; final List availableDeps; - _Visitor(this.rule, this.availableDeps); + new(this.rule, this.availableDeps); @override void visitExportDirective(ExportDirective node) => _checkDirective(node); diff --git a/pkg/linter/lib/src/rules/pub/package_names.dart b/pkg/linter/lib/src/rules/pub/package_names.dart index d85efffaa80..8ea6c480de1 100644 --- a/pkg/linter/lib/src/rules/pub/package_names.dart +++ b/pkg/linter/lib/src/rules/pub/package_names.dart @@ -13,7 +13,7 @@ import '../../utils.dart'; const _desc = r'Use `lowercase_with_underscores` for package names.'; class PackageNames extends AnalysisRule { - PackageNames() : super(name: LintNames.package_names, description: _desc); + new() : super(name: LintNames.package_names, description: _desc); @override DiagnosticCode get diagnosticCode => diag.packageNames; @@ -25,7 +25,7 @@ class PackageNames extends AnalysisRule { class Visitor extends PubspecVisitor { final AnalysisRule rule; - Visitor(this.rule); + new(this.rule); @override void visitPackageName(PubspecEntry name) { diff --git a/pkg/linter/lib/src/rules/pub/secure_pubspec_urls.dart b/pkg/linter/lib/src/rules/pub/secure_pubspec_urls.dart index 425ee4d955c..f35a904d81c 100644 --- a/pkg/linter/lib/src/rules/pub/secure_pubspec_urls.dart +++ b/pkg/linter/lib/src/rules/pub/secure_pubspec_urls.dart @@ -12,8 +12,7 @@ import '../../diagnostic.dart' as diag; const _desc = r'Use secure urls in `pubspec.yaml`.'; class SecurePubspecUrls extends AnalysisRule { - SecurePubspecUrls() - : super(name: LintNames.secure_pubspec_urls, description: _desc); + new() : super(name: LintNames.secure_pubspec_urls, description: _desc); @override DiagnosticCode get diagnosticCode => diag.securePubspecUrls; @@ -25,7 +24,7 @@ class SecurePubspecUrls extends AnalysisRule { class Visitor extends PubspecVisitor { final AnalysisRule rule; - Visitor(this.rule); + new(this.rule); @override void visitPackageDependencies(PubspecDependencyList dependencies) { diff --git a/pkg/linter/lib/src/rules/pub/sort_pub_dependencies.dart b/pkg/linter/lib/src/rules/pub/sort_pub_dependencies.dart index fe37a5e253c..736f4f5dc1d 100644 --- a/pkg/linter/lib/src/rules/pub/sort_pub_dependencies.dart +++ b/pkg/linter/lib/src/rules/pub/sort_pub_dependencies.dart @@ -13,8 +13,7 @@ import '../../diagnostic.dart' as diag; const _desc = r'Sort pub dependencies alphabetically.'; class SortPubDependencies extends AnalysisRule { - SortPubDependencies() - : super(name: LintNames.sort_pub_dependencies, description: _desc); + new() : super(name: LintNames.sort_pub_dependencies, description: _desc); @override DiagnosticCode get diagnosticCode => diag.sortPubDependencies; @@ -26,7 +25,7 @@ class SortPubDependencies extends AnalysisRule { class Visitor extends PubspecVisitor { final AnalysisRule rule; - Visitor(this.rule); + new(this.rule); @override void visitPackageDependencies(PubspecDependencyList dependencies) { diff --git a/pkg/linter/lib/src/rules/public_member_api_docs.dart b/pkg/linter/lib/src/rules/public_member_api_docs.dart index 13303909068..7ef491c44fa 100644 --- a/pkg/linter/lib/src/rules/public_member_api_docs.dart +++ b/pkg/linter/lib/src/rules/public_member_api_docs.dart @@ -22,8 +22,7 @@ const _desc = r'Document all public members.'; // exports - and linting against that. class PublicMemberApiDocs extends AnalysisRule { - PublicMemberApiDocs() - : super(name: LintNames.public_member_api_docs, description: _desc); + new() : super(name: LintNames.public_member_api_docs, description: _desc); @override DiagnosticCode get diagnosticCode => diag.publicMemberApiDocs; @@ -62,7 +61,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); bool check(Declaration node) { if (node.isInternal) return false; diff --git a/pkg/linter/lib/src/rules/recursive_getters.dart b/pkg/linter/lib/src/rules/recursive_getters.dart index e16261faf53..dde4d26d15b 100644 --- a/pkg/linter/lib/src/rules/recursive_getters.dart +++ b/pkg/linter/lib/src/rules/recursive_getters.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Property getter recursively returns itself.'; class RecursiveGetters extends AnalysisRule { - RecursiveGetters() - : super(name: LintNames.recursive_getters, description: _desc); + new() : super(name: LintNames.recursive_getters, description: _desc); @override DiagnosticCode get diagnosticCode => diag.recursiveGetters; @@ -36,7 +35,7 @@ class RecursiveGetters extends AnalysisRule { class _BodyVisitor extends RecursiveAstVisitor { final AnalysisRule rule; final ExecutableElement element; - _BodyVisitor(this.element, this.rule); + new(this.element, this.rule); bool isSelfReference(SimpleIdentifier node) { if (node.element != element) return false; @@ -73,7 +72,7 @@ class _BodyVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFunctionDeclaration(FunctionDeclaration node) { diff --git a/pkg/linter/lib/src/rules/remove_deprecations_in_breaking_version.dart b/pkg/linter/lib/src/rules/remove_deprecations_in_breaking_version.dart index 4afd8b5babe..bcd7ed619fb 100644 --- a/pkg/linter/lib/src/rules/remove_deprecations_in_breaking_version.dart +++ b/pkg/linter/lib/src/rules/remove_deprecations_in_breaking_version.dart @@ -24,7 +24,7 @@ bool isBreakingVersion(Version version) => (version.major == 0 && version.patch == 0)); class RemoveDeprecationsInBreakingVersion extends AnalysisRule { - RemoveDeprecationsInBreakingVersion() + new() : super( name: LintNames.remove_deprecations_in_breaking_versions, description: _desc, @@ -63,7 +63,7 @@ class RemoveDeprecationsInBreakingVersion extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAnnotation(Annotation node) { diff --git a/pkg/linter/lib/src/rules/require_trailing_commas.dart b/pkg/linter/lib/src/rules/require_trailing_commas.dart index 70f57ac7fc5..20ffc3a068b 100644 --- a/pkg/linter/lib/src/rules/require_trailing_commas.dart +++ b/pkg/linter/lib/src/rules/require_trailing_commas.dart @@ -22,8 +22,7 @@ class RequireTrailingCommas extends AnalysisRule { /// The version when tall-style was introduced in the formatter. static final Version language37 = Version(3, 7, 0); - RequireTrailingCommas() - : super(name: LintNames.require_trailing_commas, description: _desc); + new() : super(name: LintNames.require_trailing_commas, description: _desc); @override DiagnosticCode get diagnosticCode => diag.requireTrailingCommas; @@ -54,7 +53,7 @@ class _Visitor extends SimpleAstVisitor { late LineInfo _lineInfo; - _Visitor(this.rule); + new(this.rule); @override void visitArgumentList(ArgumentList node) { diff --git a/pkg/linter/lib/src/rules/simple_directive_paths.dart b/pkg/linter/lib/src/rules/simple_directive_paths.dart index 9dd4b66fc03..37c97d83d3e 100644 --- a/pkg/linter/lib/src/rules/simple_directive_paths.dart +++ b/pkg/linter/lib/src/rules/simple_directive_paths.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use simple directive paths.'; class SimpleDirectivePaths extends AnalysisRule { - SimpleDirectivePaths() - : super(name: LintNames.simple_directive_paths, description: _desc); + new() : super(name: LintNames.simple_directive_paths, description: _desc); @override DiagnosticCode get diagnosticCode => diag.simpleDirectivePaths; @@ -40,7 +39,7 @@ class _Visitor extends SimpleAstVisitor { final SimpleDirectivePaths rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitConfiguration(Configuration node) { diff --git a/pkg/linter/lib/src/rules/simplify_variable_pattern.dart b/pkg/linter/lib/src/rules/simplify_variable_pattern.dart index 1fe9c676249..ea7081bfc67 100644 --- a/pkg/linter/lib/src/rules/simplify_variable_pattern.dart +++ b/pkg/linter/lib/src/rules/simplify_variable_pattern.dart @@ -19,8 +19,7 @@ import '../diagnostic.dart' as diag; const _desc = 'Avoid unnecessary member names in variable patterns.'; class SimplifyVariablePattern extends AnalysisRule { - SimplifyVariablePattern() - : super(name: LintNames.simplify_variable_pattern, description: _desc); + new() : super(name: LintNames.simplify_variable_pattern, description: _desc); @override DiagnosticCode get diagnosticCode => diag.simplifyVariablePattern; @@ -41,7 +40,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitPatternField(PatternField node) { diff --git a/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart b/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart index 53fc31f8f53..ce56d591990 100644 --- a/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart +++ b/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart @@ -16,8 +16,7 @@ import '../util/flutter_utils.dart'; const _desc = r'`SizedBox` for whitespace.'; class SizedBoxForWhitespace extends AnalysisRule { - SizedBoxForWhitespace() - : super(name: LintNames.sized_box_for_whitespace, description: _desc); + new() : super(name: LintNames.sized_box_for_whitespace, description: _desc); @override DiagnosticCode get diagnosticCode => diag.sizedBoxForWhitespace; @@ -36,7 +35,7 @@ class SizedBoxForWhitespace extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart b/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart index fb7806d7f4d..8691db126e3 100644 --- a/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart +++ b/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart @@ -14,7 +14,7 @@ import '../diagnostic.dart' as diag; import '../util/flutter_utils.dart'; class SizedBoxShrinkExpand extends AnalysisRule { - SizedBoxShrinkExpand() + new() : super( name: LintNames.sized_box_shrink_expand, description: 'Use SizedBox shrink and expand named constructors.', @@ -37,7 +37,7 @@ class SizedBoxShrinkExpand extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final SizedBoxShrinkExpand rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/slash_for_doc_comments.dart b/pkg/linter/lib/src/rules/slash_for_doc_comments.dart index 4b13cc617a0..58bec3d4b2f 100644 --- a/pkg/linter/lib/src/rules/slash_for_doc_comments.dart +++ b/pkg/linter/lib/src/rules/slash_for_doc_comments.dart @@ -18,8 +18,7 @@ bool isJavaStyle(Comment comment) => comment.tokens.isNotEmpty && comment.tokens.first.lexeme.startsWith('/**'); class SlashForDocComments extends AnalysisRule { - SlashForDocComments() - : super(name: LintNames.slash_for_doc_comments, description: _desc); + new() : super(name: LintNames.slash_for_doc_comments, description: _desc); @override bool get canUseParsedResult => true; @@ -55,7 +54,7 @@ class SlashForDocComments extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void checkComment(Comment? comment) { if (comment != null && isJavaStyle(comment)) { diff --git a/pkg/linter/lib/src/rules/sort_child_properties_last.dart b/pkg/linter/lib/src/rules/sort_child_properties_last.dart index 25a0faf2970..3829fc364b7 100644 --- a/pkg/linter/lib/src/rules/sort_child_properties_last.dart +++ b/pkg/linter/lib/src/rules/sort_child_properties_last.dart @@ -16,8 +16,7 @@ import '../util/flutter_utils.dart'; const _desc = r'Sort child properties last in widget instance creations.'; class SortChildPropertiesLast extends AnalysisRule { - SortChildPropertiesLast() - : super(name: LintNames.sort_child_properties_last, description: _desc); + new() : super(name: LintNames.sort_child_properties_last, description: _desc); @override DiagnosticCode get diagnosticCode => diag.sortChildPropertiesLast; @@ -35,7 +34,7 @@ class SortChildPropertiesLast extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/sort_constructors_first.dart b/pkg/linter/lib/src/rules/sort_constructors_first.dart index 48f57c75e52..d842db0942a 100644 --- a/pkg/linter/lib/src/rules/sort_constructors_first.dart +++ b/pkg/linter/lib/src/rules/sort_constructors_first.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Sort constructor declarations before other members.'; class SortConstructorsFirst extends AnalysisRule { - SortConstructorsFirst() - : super(name: LintNames.sort_constructors_first, description: _desc); + new() : super(name: LintNames.sort_constructors_first, description: _desc); @override DiagnosticCode get diagnosticCode => diag.sortConstructorsFirst; @@ -36,7 +35,7 @@ class SortConstructorsFirst extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void check(NodeList members) { var other = false; diff --git a/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart b/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart index e887e040933..e2559f7b5d6 100644 --- a/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart +++ b/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Sort unnamed constructor declarations first.'; class SortUnnamedConstructorsFirst extends AnalysisRule { - SortUnnamedConstructorsFirst() + new() : super( name: LintNames.sort_unnamed_constructors_first, description: _desc, @@ -39,7 +39,7 @@ class SortUnnamedConstructorsFirst extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void check(NodeList members) { var seenNamedConstructor = false; diff --git a/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart b/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart index d32ff0a29fe..d7c41abb0e5 100644 --- a/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart +++ b/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart @@ -19,7 +19,7 @@ import '../util/obvious_types.dart'; const _desc = r'Specify non-obvious type annotations for local variables.'; class SpecifyNonObviousLocalVariableTypes extends AnalysisRule { - SpecifyNonObviousLocalVariableTypes() + new() : super( name: LintNames.specify_nonobvious_local_variable_types, description: _desc, @@ -51,7 +51,7 @@ class SpecifyNonObviousLocalVariableTypes extends AnalysisRule { class _PatternVisitor extends GeneralizingAstVisitor { final AnalysisRule rule; - _PatternVisitor(this.rule); + new(this.rule); @override void visitDeclaredVariablePattern(DeclaredVariablePattern node) { @@ -68,7 +68,7 @@ class _PatternVisitor extends GeneralizingAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitForStatement(ForStatement node) { diff --git a/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart b/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart index 8f6ae4b06de..69019409641 100644 --- a/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart +++ b/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart @@ -20,7 +20,7 @@ const _desc = r'Specify non-obvious type annotations for top-level and static variables.'; class SpecifyNonObviousPropertyTypes extends AnalysisRule { - SpecifyNonObviousPropertyTypes() + new() : super( name: LintNames.specify_nonobvious_property_types, description: _desc, @@ -47,7 +47,7 @@ class SpecifyNonObviousPropertyTypes extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldDeclaration(FieldDeclaration node) => diff --git a/pkg/linter/lib/src/rules/strict_top_level_inference.dart b/pkg/linter/lib/src/rules/strict_top_level_inference.dart index e3915264952..ebd4d676a40 100644 --- a/pkg/linter/lib/src/rules/strict_top_level_inference.dart +++ b/pkg/linter/lib/src/rules/strict_top_level_inference.dart @@ -22,8 +22,7 @@ import '../extensions.dart'; const _desc = r'Specify type annotations.'; class StrictTopLevelInference extends MultiAnalysisRule { - StrictTopLevelInference() - : super(name: LintNames.strict_top_level_inference, description: _desc); + new() : super(name: LintNames.strict_top_level_inference, description: _desc); @override List get diagnosticCodes => [ @@ -53,7 +52,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context) + new(this.rule, this.context) : _wildCardVariablesEnabled = context.isFeatureEnabled( Feature.wildcard_variables, ); diff --git a/pkg/linter/lib/src/rules/switch_on_type.dart b/pkg/linter/lib/src/rules/switch_on_type.dart index 80019bfe45c..35edcd5d83f 100644 --- a/pkg/linter/lib/src/rules/switch_on_type.dart +++ b/pkg/linter/lib/src/rules/switch_on_type.dart @@ -21,7 +21,7 @@ const _desc = "Avoid switch statements on a 'Type'."; const _objectToStringName = 'toString'; class SwitchOnType extends AnalysisRule { - SwitchOnType() : super(name: LintNames.switch_on_type, description: _desc); + new() : super(name: LintNames.switch_on_type, description: _desc); @override DiagnosticCode get diagnosticCode => diag.switchOnType; @@ -46,7 +46,7 @@ class _Visitor extends SimpleAstVisitor { /// The node where the lint will be reported. late AstNode node; - _Visitor(this.rule, this.context); + new(this.rule, this.context); /// A reference to the [Type] type. /// diff --git a/pkg/linter/lib/src/rules/test_types_in_equals.dart b/pkg/linter/lib/src/rules/test_types_in_equals.dart index 5b7d9785957..903e6b254d8 100644 --- a/pkg/linter/lib/src/rules/test_types_in_equals.dart +++ b/pkg/linter/lib/src/rules/test_types_in_equals.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Test type of argument in `operator ==(Object other)`.'; class TestTypesInEquals extends AnalysisRule { - TestTypesInEquals() - : super(name: LintNames.test_types_in_equals, description: _desc); + new() : super(name: LintNames.test_types_in_equals, description: _desc); @override DiagnosticCode get diagnosticCode => diag.testTypesInEquals; @@ -34,7 +33,7 @@ class TestTypesInEquals extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAsExpression(AsExpression node) { diff --git a/pkg/linter/lib/src/rules/throw_in_finally.dart b/pkg/linter/lib/src/rules/throw_in_finally.dart index 826a390648a..827e02a8f24 100644 --- a/pkg/linter/lib/src/rules/throw_in_finally.dart +++ b/pkg/linter/lib/src/rules/throw_in_finally.dart @@ -16,8 +16,7 @@ import '../rules/control_flow_in_finally.dart'; const _desc = r'Avoid `throw` in `finally` block.'; class ThrowInFinally extends AnalysisRule { - ThrowInFinally() - : super(name: LintNames.throw_in_finally, description: _desc); + new() : super(name: LintNames.throw_in_finally, description: _desc); @override DiagnosticCode get diagnosticCode => diag.throwInFinally; @@ -37,7 +36,7 @@ class _Visitor extends SimpleAstVisitor @override final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitThrowExpression(ThrowExpression node) { diff --git a/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart b/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart index 57f4fdcc679..8be001d19c5 100644 --- a/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart +++ b/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Tighten type of initializing formal.'; class TightenTypeOfInitializingFormals extends AnalysisRule { - TightenTypeOfInitializingFormals() + new() : super( name: LintNames.tighten_type_of_initializing_formals, description: _desc, @@ -41,7 +41,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/type_annotate_public_apis.dart b/pkg/linter/lib/src/rules/type_annotate_public_apis.dart index 05d723d2895..4444cb278ba 100644 --- a/pkg/linter/lib/src/rules/type_annotate_public_apis.dart +++ b/pkg/linter/lib/src/rules/type_annotate_public_apis.dart @@ -20,8 +20,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Type annotate public APIs.'; class TypeAnnotatePublicApis extends AnalysisRule { - TypeAnnotatePublicApis() - : super(name: LintNames.type_annotate_public_apis, description: _desc); + new() : super(name: LintNames.type_annotate_public_apis, description: _desc); @override DiagnosticCode get diagnosticCode => diag.typeAnnotatePublicApis; @@ -49,7 +48,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final _VisitorHelper v; - _Visitor(this.rule) : v = _VisitorHelper(rule); + new(this.rule) : v = _VisitorHelper(rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { @@ -142,7 +141,7 @@ class _Visitor extends SimpleAstVisitor { class _VisitorHelper extends RecursiveAstVisitor { final AnalysisRule rule; - _VisitorHelper(this.rule); + new(this.rule); bool hasInferredType(VariableDeclaration node) { var staticType = node.initializer?.staticType; diff --git a/pkg/linter/lib/src/rules/type_init_formals.dart b/pkg/linter/lib/src/rules/type_init_formals.dart index b189d24cc60..c74c1dd257e 100644 --- a/pkg/linter/lib/src/rules/type_init_formals.dart +++ b/pkg/linter/lib/src/rules/type_init_formals.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = "Don't type annotate initializing formals."; class TypeInitFormals extends AnalysisRule { - TypeInitFormals() - : super(name: LintNames.type_init_formals, description: _desc); + new() : super(name: LintNames.type_init_formals, description: _desc); @override DiagnosticCode get diagnosticCode => diag.typeInitFormals; @@ -36,7 +35,7 @@ class TypeInitFormals extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldFormalParameter(FieldFormalParameter node) { diff --git a/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart b/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart index ace850e7706..86b144526ef 100644 --- a/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart +++ b/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't use constant patterns with type literals."; class TypeLiteralInConstantPattern extends AnalysisRule { - TypeLiteralInConstantPattern() + new() : super( name: LintNames.type_literal_in_constant_pattern, description: _desc, @@ -38,7 +38,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override visitConstantPattern(ConstantPattern node) { diff --git a/pkg/linter/lib/src/rules/unawaited_futures.dart b/pkg/linter/lib/src/rules/unawaited_futures.dart index 75261f75ff8..83bbdd17f5f 100644 --- a/pkg/linter/lib/src/rules/unawaited_futures.dart +++ b/pkg/linter/lib/src/rules/unawaited_futures.dart @@ -19,8 +19,7 @@ const _desc = '`await`ed or marked `unawaited` using `dart:async`.'; class UnawaitedFutures extends AnalysisRule { - UnawaitedFutures() - : super(name: LintNames.unawaited_futures, description: _desc); + new() : super(name: LintNames.unawaited_futures, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unawaitedFutures; diff --git a/pkg/linter/lib/src/rules/unintended_html_in_doc_comment.dart b/pkg/linter/lib/src/rules/unintended_html_in_doc_comment.dart index 0325a1edcbe..59005f9d5de 100644 --- a/pkg/linter/lib/src/rules/unintended_html_in_doc_comment.dart +++ b/pkg/linter/lib/src/rules/unintended_html_in_doc_comment.dart @@ -123,7 +123,7 @@ const _validHtmlTags = [ ]; class UnintendedHtmlInDocComment extends AnalysisRule { - UnintendedHtmlInDocComment() + new() : super(name: LintNames.unintended_html_in_doc_comment, description: _desc); @override @@ -144,7 +144,7 @@ class UnintendedHtmlInDocComment extends AnalysisRule { class _UnintendedTag { final int offset; final int length; - _UnintendedTag(this.offset, this.length); + new(this.offset, this.length); } class _Visitor extends SimpleAstVisitor { @@ -198,7 +198,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitComment(Comment node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_async.dart b/pkg/linter/lib/src/rules/unnecessary_async.dart index 9638063bcf9..f5bc92781b1 100644 --- a/pkg/linter/lib/src/rules/unnecessary_async.dart +++ b/pkg/linter/lib/src/rules/unnecessary_async.dart @@ -19,7 +19,7 @@ import '../diagnostic.dart' as diag; const _desc = r'No await no async.'; class UnnecessaryAsync extends AnalysisRule { - UnnecessaryAsync() + new() : super( name: LintNames.unnecessary_async, description: _desc, @@ -100,7 +100,7 @@ class _HasAwaitVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFunctionDeclaration(covariant FunctionDeclarationImpl node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart b/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart index 2db0d1a3f1d..892a16be758 100644 --- a/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart +++ b/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Unnecessary `await` keyword in return.'; class UnnecessaryAwaitInReturn extends AnalysisRule { - UnnecessaryAwaitInReturn() + new() : super(name: LintNames.unnecessary_await_in_return, description: _desc); @override @@ -38,7 +38,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final TypeSystem typeSystem; - _Visitor(this.rule, this.typeSystem); + new(this.rule, this.typeSystem); @override void visitExpressionFunctionBody(ExpressionFunctionBody node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart b/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart index 8d632ba1b11..df053b89459 100644 --- a/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart +++ b/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart @@ -22,7 +22,7 @@ bool isIdentifierPart(Token? token) => token is StringToken && token.lexeme.startsWith(identifierPart); class UnnecessaryBraceInStringInterps extends AnalysisRule { - UnnecessaryBraceInStringInterps() + new() : super( name: LintNames.unnecessary_brace_in_string_interps, description: _desc, @@ -44,7 +44,7 @@ class UnnecessaryBraceInStringInterps extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitStringInterpolation(StringInterpolation node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_breaks.dart b/pkg/linter/lib/src/rules/unnecessary_breaks.dart index 4d8ce409165..3aeec7ef2c4 100644 --- a/pkg/linter/lib/src/rules/unnecessary_breaks.dart +++ b/pkg/linter/lib/src/rules/unnecessary_breaks.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't use explicit `break`s when a break is implied."; class UnnecessaryBreaks extends AnalysisRule { - UnnecessaryBreaks() - : super(name: LintNames.unnecessary_breaks, description: _desc); + new() : super(name: LintNames.unnecessary_breaks, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryBreaks; @@ -37,7 +36,7 @@ class UnnecessaryBreaks extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override visitBreakStatement(BreakStatement node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_const.dart b/pkg/linter/lib/src/rules/unnecessary_const.dart index 2f910c96091..d9c8f5a4cee 100644 --- a/pkg/linter/lib/src/rules/unnecessary_const.dart +++ b/pkg/linter/lib/src/rules/unnecessary_const.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid `const` keyword.'; class UnnecessaryConst extends AnalysisRule { - UnnecessaryConst() - : super(name: LintNames.unnecessary_const, description: _desc); + new() : super(name: LintNames.unnecessary_const, description: _desc); @override bool get canUseParsedResult => true; @@ -41,7 +40,7 @@ class UnnecessaryConst extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitDotShorthandConstructorInvocation( diff --git a/pkg/linter/lib/src/rules/unnecessary_const_in_enum_constructor.dart b/pkg/linter/lib/src/rules/unnecessary_const_in_enum_constructor.dart index 2623c0fbe67..a682a3fdaa8 100644 --- a/pkg/linter/lib/src/rules/unnecessary_const_in_enum_constructor.dart +++ b/pkg/linter/lib/src/rules/unnecessary_const_in_enum_constructor.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = "Don't use an explicit `const` in a generative enum constructor."; class UnnecessaryConstInEnumConstructor extends AnalysisRule { - UnnecessaryConstInEnumConstructor() + new() : super( name: LintNames.unnecessary_const_in_enum_constructor, description: _desc, @@ -44,7 +44,7 @@ class UnnecessaryConstInEnumConstructor extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart b/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart index eba42df2ec0..d59b7d81b6c 100644 --- a/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart +++ b/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Unnecessary `.new` constructor name.'; class UnnecessaryConstructorName extends AnalysisRule { - UnnecessaryConstructorName() + new() : super(name: LintNames.unnecessary_constructor_name, description: _desc); @override @@ -37,7 +37,7 @@ class UnnecessaryConstructorName extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_final.dart b/pkg/linter/lib/src/rules/unnecessary_final.dart index decf8509ff1..47ad97bd722 100644 --- a/pkg/linter/lib/src/rules/unnecessary_final.dart +++ b/pkg/linter/lib/src/rules/unnecessary_final.dart @@ -18,8 +18,7 @@ import '../extensions.dart'; const _desc = "Don't use `final` for local variables."; class UnnecessaryFinal extends MultiAnalysisRule { - UnnecessaryFinal() - : super(name: LintNames.unnecessary_final, description: _desc); + new() : super(name: LintNames.unnecessary_final, description: _desc); @override List get diagnosticCodes => [ @@ -53,7 +52,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitDeclaredVariablePattern(DeclaredVariablePattern node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart b/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart index a2d5a9ac51a..83c48e6e219 100644 --- a/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart +++ b/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart @@ -18,7 +18,7 @@ const _desc = r'Avoid wrapping fields in getters and setters just to be "safe".'; class UnnecessaryGettersSetters extends AnalysisRule { - UnnecessaryGettersSetters() + new() : super(name: LintNames.unnecessary_getters_setters, description: _desc); @override @@ -38,7 +38,7 @@ class UnnecessaryGettersSetters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_ignore.dart b/pkg/linter/lib/src/rules/unnecessary_ignore.dart index f30611f2527..c50b5a227c1 100644 --- a/pkg/linter/lib/src/rules/unnecessary_ignore.dart +++ b/pkg/linter/lib/src/rules/unnecessary_ignore.dart @@ -12,7 +12,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't ignore a diagnostic code that is not produced."; class UnnecessaryIgnore extends MultiAnalysisRule { - UnnecessaryIgnore() : super(name: 'unnecessary_ignore', description: _desc) { + new() : super(name: 'unnecessary_ignore', description: _desc) { // Register the unnecessary_ignore lint codes with the analyzer's validator. // We do this here to avoid having to introduce a dependency from the analyzer // on the linter. diff --git a/pkg/linter/lib/src/rules/unnecessary_lambdas.dart b/pkg/linter/lib/src/rules/unnecessary_lambdas.dart index 1e9264d74d7..e1284fbf4ba 100644 --- a/pkg/linter/lib/src/rules/unnecessary_lambdas.dart +++ b/pkg/linter/lib/src/rules/unnecessary_lambdas.dart @@ -27,8 +27,7 @@ Set _extractElementsOfSimpleIdentifiers(AstNode node) => _IdentifierVisitor().extractElements(node); class UnnecessaryLambdas extends AnalysisRule { - UnnecessaryLambdas() - : super(name: LintNames.unnecessary_lambdas, description: _desc); + new() : super(name: LintNames.unnecessary_lambdas, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryLambdas; @@ -46,7 +45,7 @@ class UnnecessaryLambdas extends AnalysisRule { class _FinalExpressionChecker { final Set parameters; - _FinalExpressionChecker(this.parameters); + new(this.parameters); bool isFinalNode(Expression? node_) { if (node_ == null) { @@ -83,7 +82,7 @@ class _FinalExpressionChecker { class _IdentifierVisitor extends RecursiveAstVisitor { final _elements = {}; - _IdentifierVisitor(); + new(); Set extractElements(AstNode node) { node.accept(this); @@ -102,7 +101,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final TypeSystem typeSystem; - _Visitor(this.rule, RuleContext context) + new(this.rule, RuleContext context) : constructorTearOffsEnabled = context.isFeatureEnabled( Feature.constructor_tearoffs, ), diff --git a/pkg/linter/lib/src/rules/unnecessary_late.dart b/pkg/linter/lib/src/rules/unnecessary_late.dart index 8dc4f79e0d9..9f67cc5b5f5 100644 --- a/pkg/linter/lib/src/rules/unnecessary_late.dart +++ b/pkg/linter/lib/src/rules/unnecessary_late.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't specify the `late` modifier when it is not needed."; class UnnecessaryLate extends AnalysisRule { - UnnecessaryLate() - : super(name: LintNames.unnecessary_late, description: _desc); + new() : super(name: LintNames.unnecessary_late, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryLate; @@ -35,7 +34,7 @@ class UnnecessaryLate extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldDeclaration(FieldDeclaration node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_library_directive.dart b/pkg/linter/lib/src/rules/unnecessary_library_directive.dart index 9884d3c0bd6..6fbcc759dd9 100644 --- a/pkg/linter/lib/src/rules/unnecessary_library_directive.dart +++ b/pkg/linter/lib/src/rules/unnecessary_library_directive.dart @@ -17,7 +17,7 @@ const _desc = 'annotations.'; class UnnecessaryLibraryDirective extends AnalysisRule { - UnnecessaryLibraryDirective() + new() : super(name: LintNames.unnecessary_library_directive, description: _desc); @override @@ -36,7 +36,7 @@ class UnnecessaryLibraryDirective extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitLibraryDirective(LibraryDirective node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_library_name.dart b/pkg/linter/lib/src/rules/unnecessary_library_name.dart index 97512819ca2..9f0ceacb973 100644 --- a/pkg/linter/lib/src/rules/unnecessary_library_name.dart +++ b/pkg/linter/lib/src/rules/unnecessary_library_name.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't have a library name in a `library` declaration."; class UnnecessaryLibraryName extends AnalysisRule { - UnnecessaryLibraryName() - : super(name: LintNames.unnecessary_library_name, description: _desc); + new() : super(name: LintNames.unnecessary_library_name, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryLibraryName; @@ -37,7 +36,7 @@ class UnnecessaryLibraryName extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitLibraryDirective(LibraryDirective node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_new.dart b/pkg/linter/lib/src/rules/unnecessary_new.dart index 1bd2da66a20..54ce7eabeb7 100644 --- a/pkg/linter/lib/src/rules/unnecessary_new.dart +++ b/pkg/linter/lib/src/rules/unnecessary_new.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Unnecessary new keyword.'; class UnnecessaryNew extends AnalysisRule { - UnnecessaryNew() : super(name: LintNames.unnecessary_new, description: _desc); + new() : super(name: LintNames.unnecessary_new, description: _desc); @override bool get canUseParsedResult => true; @@ -36,7 +36,7 @@ class UnnecessaryNew extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart b/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart index dd96b9bba61..55bc8ce417e 100644 --- a/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart +++ b/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart @@ -18,7 +18,7 @@ import '../extensions.dart'; const _desc = r'Avoid `null` in `null`-aware assignment.'; class UnnecessaryNullAwareAssignments extends AnalysisRule { - UnnecessaryNullAwareAssignments() + new() : super( name: LintNames.unnecessary_null_aware_assignments, description: _desc, @@ -40,7 +40,7 @@ class UnnecessaryNullAwareAssignments extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitAssignmentExpression(AssignmentExpression node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart b/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart index 15d9e166a42..a57fded03b9 100644 --- a/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart +++ b/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart @@ -19,7 +19,7 @@ const _desc = r'Unnecessary null aware operator on extension on a nullable type.'; class UnnecessaryNullAwareOperatorOnExtensionOnNullable extends AnalysisRule { - UnnecessaryNullAwareOperatorOnExtensionOnNullable() + new() : super( name: LintNames.unnecessary_null_aware_operator_on_extension_on_nullable, @@ -46,7 +46,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitIndexExpression(IndexExpression node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_null_checks.dart b/pkg/linter/lib/src/rules/unnecessary_null_checks.dart index b60ea1c7bf8..1145d600a73 100644 --- a/pkg/linter/lib/src/rules/unnecessary_null_checks.dart +++ b/pkg/linter/lib/src/rules/unnecessary_null_checks.dart @@ -161,8 +161,7 @@ DartType? getExpectedType( } class UnnecessaryNullChecks extends AnalysisRule { - UnnecessaryNullChecks() - : super(name: LintNames.unnecessary_null_checks, description: _desc); + new() : super(name: LintNames.unnecessary_null_checks, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryNullChecks; @@ -182,7 +181,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitNullAssertPattern(NullAssertPattern node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart b/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart index 1a7c34f2733..6a06d7a233c 100644 --- a/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart +++ b/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart @@ -17,7 +17,7 @@ import '../extensions.dart'; const _desc = r'Avoid using `null` in `??` operators.'; class UnnecessaryNullInIfNullOperators extends AnalysisRule { - UnnecessaryNullInIfNullOperators() + new() : super( name: LintNames.unnecessary_null_in_if_null_operators, description: _desc, @@ -39,7 +39,7 @@ class UnnecessaryNullInIfNullOperators extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart b/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart index 58a6006b44b..315edf51a26 100644 --- a/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart +++ b/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart @@ -19,7 +19,7 @@ const _desc = 'with a non-nullable value.'; class UnnecessaryNullableForFinalVariableDeclarations extends AnalysisRule { - UnnecessaryNullableForFinalVariableDeclarations() + new() : super( name: LintNames.unnecessary_nullable_for_final_variable_declarations, description: _desc, @@ -46,7 +46,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); void check(AstNode node) { if (node is! DeclaredVariablePattern) return; diff --git a/pkg/linter/lib/src/rules/unnecessary_overrides.dart b/pkg/linter/lib/src/rules/unnecessary_overrides.dart index 73224ed6e29..28584eb834a 100644 --- a/pkg/linter/lib/src/rules/unnecessary_overrides.dart +++ b/pkg/linter/lib/src/rules/unnecessary_overrides.dart @@ -20,8 +20,7 @@ const _desc = r' parameters.'; class UnnecessaryOverrides extends AnalysisRule { - UnnecessaryOverrides() - : super(name: LintNames.unnecessary_overrides, description: _desc); + new() : super(name: LintNames.unnecessary_overrides, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryOverrides; @@ -45,7 +44,7 @@ abstract class _AbstractUnnecessaryOverrideVisitor late ExecutableElement _inheritedMethod; late MethodDeclaration declaration; - _AbstractUnnecessaryOverrideVisitor(this.rule); + new(this.rule); ExecutableElement? getInheritedElement(MethodDeclaration node); @@ -183,7 +182,7 @@ abstract class _AbstractUnnecessaryOverrideVisitor class _UnnecessaryGetterOverrideVisitor extends _AbstractUnnecessaryOverrideVisitor { - _UnnecessaryGetterOverrideVisitor(super.rule); + new(super.rule); @override ExecutableElement? getInheritedElement(MethodDeclaration node) { @@ -211,7 +210,7 @@ class _UnnecessaryGetterOverrideVisitor class _UnnecessaryMethodOverrideVisitor extends _AbstractUnnecessaryOverrideVisitor { - _UnnecessaryMethodOverrideVisitor(super.rule); + new(super.rule); @override ExecutableElement? getInheritedElement(node) { @@ -245,7 +244,7 @@ class _UnnecessaryMethodOverrideVisitor class _UnnecessaryOperatorOverrideVisitor extends _AbstractUnnecessaryOverrideVisitor { - _UnnecessaryOperatorOverrideVisitor(super.rule); + new(super.rule); @override ExecutableElement? getInheritedElement(node) { @@ -294,7 +293,7 @@ class _UnnecessaryOperatorOverrideVisitor class _UnnecessarySetterOverrideVisitor extends _AbstractUnnecessaryOverrideVisitor { - _UnnecessarySetterOverrideVisitor(super.rule); + new(super.rule); @override ExecutableElement? getInheritedElement(node) { @@ -330,7 +329,7 @@ class _UnnecessarySetterOverrideVisitor class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart b/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart index a5006c16cf3..d0f399104f7 100644 --- a/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart +++ b/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart @@ -20,8 +20,7 @@ import '../extensions.dart'; const _desc = r'Unnecessary parentheses can be removed.'; class UnnecessaryParenthesis extends AnalysisRule { - UnnecessaryParenthesis() - : super(name: LintNames.unnecessary_parenthesis, description: _desc); + new() : super(name: LintNames.unnecessary_parenthesis, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryParenthesis; @@ -56,7 +55,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final TypeSystem typeSystem; - _Visitor(this.rule, this.typeSystem); + new(this.rule, this.typeSystem); @override void visitParenthesizedExpression(ParenthesizedExpression node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart b/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart index 9b0cd3e3d78..55df2af45d0 100644 --- a/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart +++ b/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart @@ -15,8 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Unnecessary raw string.'; class UnnecessaryRawStrings extends AnalysisRule { - UnnecessaryRawStrings() - : super(name: LintNames.unnecessary_raw_strings, description: _desc); + new() : super(name: LintNames.unnecessary_raw_strings, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryRawStrings; @@ -34,7 +33,7 @@ class UnnecessaryRawStrings extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitSimpleStringLiteral(SimpleStringLiteral node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_statements.dart b/pkg/linter/lib/src/rules/unnecessary_statements.dart index 94ace08c572..5610f8c0b8b 100644 --- a/pkg/linter/lib/src/rules/unnecessary_statements.dart +++ b/pkg/linter/lib/src/rules/unnecessary_statements.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid using unnecessary statements.'; class UnnecessaryStatements extends AnalysisRule { - UnnecessaryStatements() - : super(name: LintNames.unnecessary_statements, description: _desc); + new() : super(name: LintNames.unnecessary_statements, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryStatements; @@ -52,7 +51,7 @@ class UnnecessaryStatements extends AnalysisRule { class _ReportNoClearEffectVisitor extends UnifyingAstVisitor { final AnalysisRule rule; - _ReportNoClearEffectVisitor(this.rule); + new(this.rule); @override void visitAsExpression(AsExpression node) { @@ -190,7 +189,7 @@ class _ReportNoClearEffectVisitor extends UnifyingAstVisitor { class _Visitor extends SimpleAstVisitor { final _ReportNoClearEffectVisitor reportNoClearEffect; - _Visitor(this.reportNoClearEffect); + new(this.reportNoClearEffect); @override void visitCascadeExpression(CascadeExpression node) { for (var section in node.cascadeSections) { diff --git a/pkg/linter/lib/src/rules/unnecessary_string_escapes.dart b/pkg/linter/lib/src/rules/unnecessary_string_escapes.dart index 5c1a538f019..9b0eb6e8911 100644 --- a/pkg/linter/lib/src/rules/unnecessary_string_escapes.dart +++ b/pkg/linter/lib/src/rules/unnecessary_string_escapes.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Remove unnecessary backslashes in strings.'; class UnnecessaryStringEscapes extends AnalysisRule { - UnnecessaryStringEscapes() - : super(name: LintNames.unnecessary_string_escapes, description: _desc); + new() : super(name: LintNames.unnecessary_string_escapes, description: _desc); @override bool get canUseParsedResult => true; @@ -55,7 +54,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void visitLexeme( Token token, { diff --git a/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart b/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart index 1221b39f1f8..97d33bd66ad 100644 --- a/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart +++ b/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Unnecessary string interpolation.'; class UnnecessaryStringInterpolations extends AnalysisRule { - UnnecessaryStringInterpolations() + new() : super( name: LintNames.unnecessary_string_interpolations, description: _desc, @@ -38,7 +38,7 @@ class UnnecessaryStringInterpolations extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitStringInterpolation(StringInterpolation node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_this.dart b/pkg/linter/lib/src/rules/unnecessary_this.dart index ecbe595ea12..6304a6739f8 100644 --- a/pkg/linter/lib/src/rules/unnecessary_this.dart +++ b/pkg/linter/lib/src/rules/unnecessary_this.dart @@ -18,8 +18,7 @@ import '../util/scope.dart'; const _desc = r"Don't access members with `this` unless avoiding shadowing."; class UnnecessaryThis extends AnalysisRule { - UnnecessaryThis() - : super(name: LintNames.unnecessary_this, description: _desc); + new() : super(name: LintNames.unnecessary_this, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryThis; @@ -40,7 +39,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitConstructorFieldInitializer(ConstructorFieldInitializer node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart b/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart index b4f8a2c2850..2c2affbe984 100644 --- a/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart +++ b/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart @@ -16,7 +16,7 @@ import '../extensions.dart'; const _desc = r'Unnecessary `toList()` in spreads.'; class UnnecessaryToListInSpreads extends AnalysisRule { - UnnecessaryToListInSpreads() + new() : super(name: LintNames.unnecessary_to_list_in_spreads, description: _desc); @override @@ -35,7 +35,7 @@ class UnnecessaryToListInSpreads extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitSpreadElement(SpreadElement node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_type_name_in_constructor.dart b/pkg/linter/lib/src/rules/unnecessary_type_name_in_constructor.dart index 255e5318fc8..01432064105 100644 --- a/pkg/linter/lib/src/rules/unnecessary_type_name_in_constructor.dart +++ b/pkg/linter/lib/src/rules/unnecessary_type_name_in_constructor.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = "Don't use an explicit type name in a constructor."; class UnnecessaryTypeNameInConstructor extends AnalysisRule { - UnnecessaryTypeNameInConstructor() + new() : super( name: LintNames.unnecessary_type_name_in_constructor, description: _desc, @@ -43,7 +43,7 @@ class UnnecessaryTypeNameInConstructor extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitConstructorDeclaration(ConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_unawaited.dart b/pkg/linter/lib/src/rules/unnecessary_unawaited.dart index 591157b8d65..d103c6ee15a 100644 --- a/pkg/linter/lib/src/rules/unnecessary_unawaited.dart +++ b/pkg/linter/lib/src/rules/unnecessary_unawaited.dart @@ -16,8 +16,7 @@ import '../extensions.dart'; const _desc = r"Unnecessary use of 'unawaited'."; class UnnecessaryUnawaited extends AnalysisRule { - UnnecessaryUnawaited() - : super(name: LintNames.unnecessary_unawaited, description: _desc); + new() : super(name: LintNames.unnecessary_unawaited, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryUnawaited; @@ -35,7 +34,7 @@ class UnnecessaryUnawaited extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation node) { diff --git a/pkg/linter/lib/src/rules/unnecessary_underscores.dart b/pkg/linter/lib/src/rules/unnecessary_underscores.dart index cd25e657afc..6b231302c9c 100644 --- a/pkg/linter/lib/src/rules/unnecessary_underscores.dart +++ b/pkg/linter/lib/src/rules/unnecessary_underscores.dart @@ -20,8 +20,7 @@ import '../util/ascii_utils.dart'; const _desc = r'Unnecessary underscores can be removed.'; class UnnecessaryUnderscores extends AnalysisRule { - UnnecessaryUnderscores() - : super(name: LintNames.unnecessary_underscores, description: _desc); + new() : super(name: LintNames.unnecessary_underscores, description: _desc); @override DiagnosticCode get diagnosticCode => diag.unnecessaryUnderscores; @@ -41,7 +40,7 @@ class UnnecessaryUnderscores extends AnalysisRule { class _BodyVisitor extends RecursiveAstVisitor { final Set referencedElements = {}; - _BodyVisitor(); + new(); @override void visitSimpleIdentifier(SimpleIdentifier node) { @@ -52,7 +51,7 @@ class _BodyVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFormalParameterList(FormalParameterList node) { diff --git a/pkg/linter/lib/src/rules/unreachable_from_main.dart b/pkg/linter/lib/src/rules/unreachable_from_main.dart index cf7e7b72f9a..3d7d95b86bd 100644 --- a/pkg/linter/lib/src/rules/unreachable_from_main.dart +++ b/pkg/linter/lib/src/rules/unreachable_from_main.dart @@ -24,7 +24,7 @@ import '../extensions.dart'; const _desc = 'Unreachable top-level members in executable libraries.'; class UnreachableFromMain extends AnalysisRule { - UnreachableFromMain() + new() : super( name: LintNames.unreachable_from_main, description: _desc, @@ -51,7 +51,7 @@ class _DeclarationGatherer { /// All declarations which we may wish to report on. final Set declarations = {}; - _DeclarationGatherer({required this.linterContext}); + new({required this.linterContext}); void addDeclarations(CompilationUnit node) { for (var declaration in node.declarations) { @@ -169,7 +169,7 @@ class _ReferenceVisitor extends RecursiveAstVisitor { /// References from patterns should not be counted. int _patternLevel = 0; - _ReferenceVisitor(this.declarationMap); + new(this.declarationMap); @override void visitAnnotation(Annotation node) { @@ -502,7 +502,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override void visitCompilationUnit(CompilationUnit node) { diff --git a/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart b/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart index 97ca870c320..fca23dc09c1 100644 --- a/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart +++ b/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart @@ -20,7 +20,7 @@ const _desc = r'Equality operator `==` invocation with references of unrelated types.'; class UnrelatedTypeEqualityChecks extends MultiAnalysisRule { - UnrelatedTypeEqualityChecks() + new() : super(name: LintNames.unrelated_type_equality_checks, description: _desc); @override @@ -44,7 +44,7 @@ class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; final TypeSystem typeSystem; - _Visitor(this.rule, this.typeSystem); + new(this.rule, this.typeSystem); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/unsafe_variance.dart b/pkg/linter/lib/src/rules/unsafe_variance.dart index 73975645dcc..2b784924f8e 100644 --- a/pkg/linter/lib/src/rules/unsafe_variance.dart +++ b/pkg/linter/lib/src/rules/unsafe_variance.dart @@ -21,7 +21,7 @@ import '../util/variance_checker.dart'; const _desc = r'Unsafe type: Has a type variable in a non-covariant position.'; class UnsafeVariance extends AnalysisRule { - UnsafeVariance() + new() : super( name: LintNames.unsafe_variance, description: _desc, @@ -44,7 +44,7 @@ class UnsafeVariance extends AnalysisRule { class _UnsafeVarianceChecker extends VarianceChecker { final AnalysisRule rule; - _UnsafeVarianceChecker(this.rule); + new(this.rule); @override void checkNamedType( @@ -93,7 +93,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; final VarianceChecker checker; - _Visitor(this.rule, this.context) : checker = _UnsafeVarianceChecker(rule); + new(this.rule, this.context) : checker = _UnsafeVarianceChecker(rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/use_build_context_synchronously.dart b/pkg/linter/lib/src/rules/use_build_context_synchronously.dart index d6fd2a2bd51..f1cfe558df2 100644 --- a/pkg/linter/lib/src/rules/use_build_context_synchronously.dart +++ b/pkg/linter/lib/src/rules/use_build_context_synchronously.dart @@ -927,7 +927,7 @@ class ProtectedFunction { /// The list of named parameters that are protected. final List named; - const ProtectedFunction( + const new( this.library, this.type, this.name, { @@ -937,7 +937,7 @@ class ProtectedFunction { } class UseBuildContextSynchronously extends MultiAnalysisRule { - UseBuildContextSynchronously() + new() : super( name: LintNames.use_build_context_synchronously, description: _desc, @@ -1119,7 +1119,7 @@ class _Visitor extends SimpleAstVisitor { final MultiAnalysisRule rule; - _Visitor(this.rule); + new(this.rule); void check(Expression node, Element mountedElement) { // Checks each of the statements before `child` for a `mounted` check, and diff --git a/pkg/linter/lib/src/rules/use_colored_box.dart b/pkg/linter/lib/src/rules/use_colored_box.dart index 5e6666de74a..4c0c2be00da 100644 --- a/pkg/linter/lib/src/rules/use_colored_box.dart +++ b/pkg/linter/lib/src/rules/use_colored_box.dart @@ -17,7 +17,7 @@ import '../util/flutter_utils.dart'; const _desc = r'Use `ColoredBox`.'; class UseColoredBox extends AnalysisRule { - UseColoredBox() : super(name: LintNames.use_colored_box, description: _desc); + new() : super(name: LintNames.use_colored_box, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useColoredBox; @@ -36,7 +36,7 @@ class UseColoredBox extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/use_declaring_parameters.dart b/pkg/linter/lib/src/rules/use_declaring_parameters.dart index 09611149d8d..8192004ed85 100644 --- a/pkg/linter/lib/src/rules/use_declaring_parameters.dart +++ b/pkg/linter/lib/src/rules/use_declaring_parameters.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use a declaring parameter.'; class UseDeclaringParameters extends AnalysisRule { - UseDeclaringParameters() - : super(name: LintNames.use_declaring_parameters, description: _desc); + new() : super(name: LintNames.use_declaring_parameters, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useDeclaringParameters; @@ -37,7 +36,7 @@ class UseDeclaringParameters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitPrimaryConstructorDeclaration(PrimaryConstructorDeclaration node) { diff --git a/pkg/linter/lib/src/rules/use_decorated_box.dart b/pkg/linter/lib/src/rules/use_decorated_box.dart index 6c585787db3..ebc58dd00bf 100644 --- a/pkg/linter/lib/src/rules/use_decorated_box.dart +++ b/pkg/linter/lib/src/rules/use_decorated_box.dart @@ -16,8 +16,7 @@ import '../util/flutter_utils.dart'; const _desc = r'Use `DecoratedBox`.'; class UseDecoratedBox extends AnalysisRule { - UseDecoratedBox() - : super(name: LintNames.use_decorated_box, description: _desc); + new() : super(name: LintNames.use_decorated_box, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useDecoratedBox; @@ -36,7 +35,7 @@ class UseDecoratedBox extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/use_enums.dart b/pkg/linter/lib/src/rules/use_enums.dart index f1388562b98..79f030f4a98 100644 --- a/pkg/linter/lib/src/rules/use_enums.dart +++ b/pkg/linter/lib/src/rules/use_enums.dart @@ -19,7 +19,7 @@ import '../extensions.dart'; const _desc = r'Use enums rather than classes that behave like enums.'; class UseEnums extends AnalysisRule { - UseEnums() : super(name: LintNames.use_enums, description: _desc); + new() : super(name: LintNames.use_enums, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useEnums; @@ -41,7 +41,7 @@ class _BaseVisitor extends RecursiveAstVisitor { /// The element representing the enum declaration that's being visited. final ClassElement classElement; - _BaseVisitor(this.classElement); + new(this.classElement); /// Return `true` if the given [node] is an invocation of a generative /// constructor from the class being converted. @@ -65,7 +65,7 @@ class _EnumVisitor extends _BaseVisitor { List variableDeclarations; - _EnumVisitor(super.classElement, this.variableDeclarations); + new(super.classElement, this.variableDeclarations); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { @@ -100,7 +100,7 @@ class _InvalidEnumException implements Exception {} class _NonEnumVisitor extends _BaseVisitor { /// Initialize a newly created visitor to visit everything except the class /// declaration corresponding to the given [classElement]. - _NonEnumVisitor(super.classElement); + new(super.classElement); @override void visitClassDeclaration(ClassDeclaration node) { @@ -138,7 +138,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); @override visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart b/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart index 94e16ce83bd..ad1cb76eade 100644 --- a/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart +++ b/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart @@ -18,7 +18,7 @@ const _desc = 'instantiate a Color.'; class UseFullHexValuesForFlutterColors extends AnalysisRule { - UseFullHexValuesForFlutterColors() + new() : super( name: LintNames.use_full_hex_values_for_flutter_colors, description: _desc, @@ -42,7 +42,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart b/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart index a30bc32611c..eee2b36d538 100644 --- a/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart +++ b/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use generic function type syntax for parameters.'; class UseFunctionTypeSyntaxForParameters extends AnalysisRule { - UseFunctionTypeSyntaxForParameters() + new() : super( name: LintNames.use_function_type_syntax_for_parameters, description: _desc, @@ -42,7 +42,7 @@ class UseFunctionTypeSyntaxForParameters extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFieldFormalParameter(FieldFormalParameter node) { diff --git a/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart b/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart index f7e56a33d13..b48ec65e545 100644 --- a/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart +++ b/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart @@ -19,7 +19,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use `??` operators to convert `null`s to `bool`s.'; class UseIfNullToConvertNullsToBools extends AnalysisRule { - UseIfNullToConvertNullsToBools() + new() : super( name: LintNames.use_if_null_to_convert_nulls_to_bools, description: _desc, @@ -43,7 +43,7 @@ class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; final RuleContext context; - _Visitor(this.rule, this.context); + new(this.rule, this.context); bool isNullableBool(DartType? type) => type != null && diff --git a/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart b/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart index d94c3198364..f1ac92e6e22 100644 --- a/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart +++ b/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart @@ -17,7 +17,7 @@ const _desc = r'Prefer intValue.isOdd/isEven instead of checking the result of % 2.'; class UseIsEvenRatherThanModulo extends AnalysisRule { - UseIsEvenRatherThanModulo() + new() : super(name: LintNames.use_is_even_rather_than_modulo, description: _desc); @override @@ -35,7 +35,7 @@ class UseIsEvenRatherThanModulo extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart b/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart index d4f4bf21198..20c65c07d5d 100644 --- a/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart +++ b/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart @@ -20,7 +20,7 @@ import '../util/flutter_utils.dart'; const _desc = r'Use key in widget constructors.'; class UseKeyInWidgetConstructors extends AnalysisRule { - UseKeyInWidgetConstructors() + new() : super(name: LintNames.use_key_in_widget_constructors, description: _desc); @override @@ -41,7 +41,7 @@ class UseKeyInWidgetConstructors extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart b/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart index 2f2582e972c..84950c09824 100644 --- a/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart +++ b/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart @@ -20,7 +20,7 @@ import '../extensions.dart'; const _desc = r'Use late for private members with a non-nullable type.'; class UseLateForPrivateFieldsAndVariables extends AnalysisRule { - UseLateForPrivateFieldsAndVariables() + new() : super( name: LintNames.use_late_for_private_fields_and_variables, description: _desc, @@ -53,7 +53,7 @@ class _Visitor extends RecursiveAstVisitor { /// [visitCompilationUnit]. late LibraryFragment currentLibraryFragment; - _Visitor(this.rule, this.context); + new(this.rule, this.context); void afterLibrary() { for (var contextUnit in context.allUnits) { diff --git a/pkg/linter/lib/src/rules/use_named_constants.dart b/pkg/linter/lib/src/rules/use_named_constants.dart index a5c8cbc666c..847684459ec 100644 --- a/pkg/linter/lib/src/rules/use_named_constants.dart +++ b/pkg/linter/lib/src/rules/use_named_constants.dart @@ -17,8 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use predefined named constants.'; class UseNamedConstants extends AnalysisRule { - UseNamedConstants() - : super(name: LintNames.use_named_constants, description: _desc); + new() : super(name: LintNames.use_named_constants, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useNamedConstants; @@ -37,7 +36,7 @@ class UseNamedConstants extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitDotShorthandConstructorInvocation( diff --git a/pkg/linter/lib/src/rules/use_null_aware_elements.dart b/pkg/linter/lib/src/rules/use_null_aware_elements.dart index 75e01f11751..60025f84734 100644 --- a/pkg/linter/lib/src/rules/use_null_aware_elements.dart +++ b/pkg/linter/lib/src/rules/use_null_aware_elements.dart @@ -22,8 +22,7 @@ const _desc = r'If-elements testing for null can be replaced with null-aware elements.'; class UseNullAwareElements extends AnalysisRule { - UseNullAwareElements() - : super(name: LintNames.use_null_aware_elements, description: _desc); + new() : super(name: LintNames.use_null_aware_elements, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useNullAwareElements; @@ -42,7 +41,7 @@ class UseNullAwareElements extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitIfElement(IfElement node) { diff --git a/pkg/linter/lib/src/rules/use_primary_constructors.dart b/pkg/linter/lib/src/rules/use_primary_constructors.dart index 8c7772109fe..59791bd3992 100644 --- a/pkg/linter/lib/src/rules/use_primary_constructors.dart +++ b/pkg/linter/lib/src/rules/use_primary_constructors.dart @@ -18,8 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use a primary constructor.'; class UsePrimaryConstructors extends AnalysisRule { - UsePrimaryConstructors() - : super(name: LintNames.use_primary_constructors, description: _desc); + new() : super(name: LintNames.use_primary_constructors, description: _desc); @override DiagnosticCode get diagnosticCode => diag.usePrimaryConstructors; @@ -39,7 +38,7 @@ class UsePrimaryConstructors extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitClassDeclaration(ClassDeclaration node) { diff --git a/pkg/linter/lib/src/rules/use_raw_strings.dart b/pkg/linter/lib/src/rules/use_raw_strings.dart index 985855e1e22..ed33b52d0bd 100644 --- a/pkg/linter/lib/src/rules/use_raw_strings.dart +++ b/pkg/linter/lib/src/rules/use_raw_strings.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use raw string to avoid escapes.'; class UseRawStrings extends AnalysisRule { - UseRawStrings() : super(name: LintNames.use_raw_strings, description: _desc); + new() : super(name: LintNames.use_raw_strings, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useRawStrings; @@ -33,7 +33,7 @@ class UseRawStrings extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitSimpleStringLiteral(SimpleStringLiteral node) { diff --git a/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart b/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart index 99eb781088c..54d845458c7 100644 --- a/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart +++ b/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart @@ -16,8 +16,7 @@ import '../extensions.dart'; const _desc = r'Use rethrow to rethrow a caught exception.'; class UseRethrowWhenPossible extends AnalysisRule { - UseRethrowWhenPossible() - : super(name: LintNames.use_rethrow_when_possible, description: _desc); + new() : super(name: LintNames.use_rethrow_when_possible, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useRethrowWhenPossible; @@ -35,7 +34,7 @@ class UseRethrowWhenPossible extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitThrowExpression(ThrowExpression node) { diff --git a/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart b/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart index f6314dcca0b..77d8eee1d71 100644 --- a/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart +++ b/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart @@ -20,7 +20,7 @@ const _desc = r'Use a setter for operations that conceptually change a property.'; class UseSettersToChangeProperties extends AnalysisRule { - UseSettersToChangeProperties() + new() : super( name: LintNames.use_setters_to_change_properties, description: _desc, @@ -42,7 +42,7 @@ class UseSettersToChangeProperties extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/use_string_buffers.dart b/pkg/linter/lib/src/rules/use_string_buffers.dart index fd8f104999f..7c597415891 100644 --- a/pkg/linter/lib/src/rules/use_string_buffers.dart +++ b/pkg/linter/lib/src/rules/use_string_buffers.dart @@ -27,8 +27,7 @@ bool _isEmptyInterpolationString(AstNode node) => /// computed, in otherwise using a StringBuffer the order is reduced to O(~N) /// so the bad case is N times slower than the good case. class UseStringBuffers extends AnalysisRule { - UseStringBuffers() - : super(name: LintNames.use_string_buffers, description: _desc); + new() : super(name: LintNames.use_string_buffers, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useStringBuffers; @@ -49,7 +48,7 @@ class _IdentifierIsPrefixVisitor extends SimpleAstVisitor { final AnalysisRule rule; SimpleIdentifier identifier; - _IdentifierIsPrefixVisitor(this.rule, this.identifier); + new(this.rule, this.identifier); @override void visitBinaryExpression(BinaryExpression node) { @@ -88,7 +87,7 @@ class _UseStringBufferVisitor extends SimpleAstVisitor { final AnalysisRule rule; final localElements = {}; - _UseStringBufferVisitor(this.rule); + new(this.rule); @override void visitAssignmentExpression(AssignmentExpression node) { @@ -139,7 +138,7 @@ class _UseStringBufferVisitor extends SimpleAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitDoStatement(DoStatement node) { diff --git a/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart b/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart index 4841377c212..e44d84cabec 100644 --- a/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart +++ b/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart @@ -16,7 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use string in part of directives.'; class UseStringInPartOfDirectives extends AnalysisRule { - UseStringInPartOfDirectives() + new() : super( name: LintNames.use_string_in_part_of_directives, description: _desc, @@ -40,7 +40,7 @@ class UseStringInPartOfDirectives extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitPartOfDirective(PartOfDirective node) { diff --git a/pkg/linter/lib/src/rules/use_super_parameters.dart b/pkg/linter/lib/src/rules/use_super_parameters.dart index 074a08b01fa..e3211580a15 100644 --- a/pkg/linter/lib/src/rules/use_super_parameters.dart +++ b/pkg/linter/lib/src/rules/use_super_parameters.dart @@ -29,7 +29,7 @@ Set _referencedParameters(FunctionBody? body) { } class UseSuperParameters extends MultiAnalysisRule { - UseSuperParameters() + new() : super( name: LintNames.use_super_parameters, description: _desc, @@ -71,7 +71,7 @@ class _Visitor extends SimpleAstVisitor { final RuleContext context; final MultiAnalysisRule rule; - _Visitor(this.rule, this.context); + new(this.rule, this.context); void check( SourceRange errorRange, diff --git a/pkg/linter/lib/src/rules/use_test_throws_matchers.dart b/pkg/linter/lib/src/rules/use_test_throws_matchers.dart index 6470be3af2b..6d3942d5414 100644 --- a/pkg/linter/lib/src/rules/use_test_throws_matchers.dart +++ b/pkg/linter/lib/src/rules/use_test_throws_matchers.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use throwsA matcher instead of fail().'; class UseTestThrowsMatchers extends AnalysisRule { - UseTestThrowsMatchers() - : super(name: LintNames.use_test_throws_matchers, description: _desc); + new() : super(name: LintNames.use_test_throws_matchers, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useTestThrowsMatchers; @@ -35,7 +34,7 @@ class UseTestThrowsMatchers extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); bool isTestInvocation(Statement statement, String functionName) { if (statement is! ExpressionStatement) return false; diff --git a/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart b/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart index ab27fb9e550..a70f7e611c9 100644 --- a/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart +++ b/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart @@ -26,7 +26,7 @@ bool _isVoid(TypeAnnotation? returnType) => returnType is NamedType && returnType.type is VoidType; class UseToAndAsIfApplicable extends AnalysisRule { - UseToAndAsIfApplicable() + new() : super(name: LintNames.use_to_and_as_if_applicable, description: _desc); @override @@ -45,7 +45,7 @@ class UseToAndAsIfApplicable extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/lib/src/rules/use_truncating_division.dart b/pkg/linter/lib/src/rules/use_truncating_division.dart index 2e080cd7dc6..460332acdb4 100644 --- a/pkg/linter/lib/src/rules/use_truncating_division.dart +++ b/pkg/linter/lib/src/rules/use_truncating_division.dart @@ -16,8 +16,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use truncating division.'; class UseTruncatingDivision extends AnalysisRule { - UseTruncatingDivision() - : super(name: LintNames.use_truncating_division, description: _desc); + new() : super(name: LintNames.use_truncating_division, description: _desc); @override DiagnosticCode get diagnosticCode => diag.useTruncatingDivision; @@ -35,7 +34,7 @@ class UseTruncatingDivision extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitBinaryExpression(BinaryExpression node) { diff --git a/pkg/linter/lib/src/rules/valid_regexps.dart b/pkg/linter/lib/src/rules/valid_regexps.dart index 56f1a5d570b..bc4a043eb1c 100644 --- a/pkg/linter/lib/src/rules/valid_regexps.dart +++ b/pkg/linter/lib/src/rules/valid_regexps.dart @@ -15,7 +15,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Use valid regular expression syntax.'; class ValidRegexps extends AnalysisRule { - ValidRegexps() : super(name: LintNames.valid_regexps, description: _desc); + new() : super(name: LintNames.valid_regexps, description: _desc); @override DiagnosticCode get diagnosticCode => diag.validRegexps; @@ -33,7 +33,7 @@ class ValidRegexps extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitInstanceCreationExpression(InstanceCreationExpression node) { diff --git a/pkg/linter/lib/src/rules/var_with_no_type_annotation.dart b/pkg/linter/lib/src/rules/var_with_no_type_annotation.dart index 80e67d2b7d9..bc9298b210c 100644 --- a/pkg/linter/lib/src/rules/var_with_no_type_annotation.dart +++ b/pkg/linter/lib/src/rules/var_with_no_type_annotation.dart @@ -17,7 +17,7 @@ import '../diagnostic.dart' as diag; const _desc = r'Avoid declaring parameters with `var` and no type annotation.'; class VarWithNoTypeAnnotation extends AnalysisRule { - VarWithNoTypeAnnotation() + new() : super(name: LintNames.var_with_no_type_annotation, description: _desc); @override @@ -36,7 +36,7 @@ class VarWithNoTypeAnnotation extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitFormalParameterList(FormalParameterList node) { diff --git a/pkg/linter/lib/src/rules/void_checks.dart b/pkg/linter/lib/src/rules/void_checks.dart index 260ab893121..d265c61070e 100644 --- a/pkg/linter/lib/src/rules/void_checks.dart +++ b/pkg/linter/lib/src/rules/void_checks.dart @@ -18,7 +18,7 @@ import '../diagnostic.dart' as diag; const _desc = r"Don't assign to `void`."; class VoidChecks extends AnalysisRule { - VoidChecks() : super(name: LintNames.void_checks, description: _desc); + new() : super(name: LintNames.void_checks, description: _desc); @override DiagnosticCode get diagnosticCode => diag.voidChecks; @@ -42,7 +42,7 @@ class _Visitor extends SimpleAstVisitor { final TypeSystem typeSystem; - _Visitor(this.rule, RuleContext context) : typeSystem = context.typeSystem; + new(this.rule, RuleContext context) : typeSystem = context.typeSystem; bool isTypeAcceptableWhenExpectingFutureOrVoid(DartType type) { if (type is DynamicType) return true; diff --git a/pkg/linter/lib/src/util/leak_detector_visitor.dart b/pkg/linter/lib/src/util/leak_detector_visitor.dart index a1d01623052..6561e21187a 100644 --- a/pkg/linter/lib/src/util/leak_detector_visitor.dart +++ b/pkg/linter/lib/src/util/leak_detector_visitor.dart @@ -59,7 +59,7 @@ typedef DartTypePredicate = bool Function(DartType type); abstract class LeakDetectorProcessors extends SimpleAstVisitor { final AnalysisRule rule; - LeakDetectorProcessors(this.rule); + new(this.rule); @protected Map get predicates; @@ -181,7 +181,7 @@ class _ValidUseVisitor extends RecursiveAstVisitor { /// valid use. var containsValidUse = false; - _ValidUseVisitor( + new( this.variable, this.variableElement, this.predicates, { diff --git a/pkg/linter/lib/src/util/scope.dart b/pkg/linter/lib/src/util/scope.dart index 6bf716eaa19..08ddd89fc8f 100644 --- a/pkg/linter/lib/src/util/scope.dart +++ b/pkg/linter/lib/src/util/scope.dart @@ -47,14 +47,14 @@ class LinterNameInScopeResolutionResult { /// The state of the result. final _LinterNameInScopeResolutionResultState _state; - const LinterNameInScopeResolutionResult._differentName(this.element) + const new _differentName(this.element) : _state = _LinterNameInScopeResolutionResultState.differentName; - const LinterNameInScopeResolutionResult._none() + const new _none() : element = null, _state = _LinterNameInScopeResolutionResultState.none; - const LinterNameInScopeResolutionResult._requestedName(this.element) + const new _requestedName(this.element) : _state = _LinterNameInScopeResolutionResultState.requestedName; bool get isDifferentName => diff --git a/pkg/linter/lib/src/util/unused_futures.dart b/pkg/linter/lib/src/util/unused_futures.dart index a664dccfe15..1a176225a7b 100644 --- a/pkg/linter/lib/src/util/unused_futures.dart +++ b/pkg/linter/lib/src/util/unused_futures.dart @@ -26,7 +26,7 @@ class UnusedFuturesVisitor extends SimpleAstVisitor { /// might report on it. final IsInterestingFilter _isInteresting; - UnusedFuturesVisitor({required this._rule, required this._isInteresting}); + new({required this._rule, required this._isInteresting}); @override void visitCascadeExpression(CascadeExpression node) { diff --git a/pkg/linter/pubspec.yaml b/pkg/linter/pubspec.yaml index de168c2ee62..fec30b7a05f 100644 --- a/pkg/linter/pubspec.yaml +++ b/pkg/linter/pubspec.yaml @@ -7,7 +7,7 @@ description: >- This package is not intended to be used directly. environment: - sdk: '^3.12.0-0' + sdk: '^3.13.0-0' resolution: workspace diff --git a/pkg/linter/test/mocks.dart b/pkg/linter/test/mocks.dart index 5ee279eafa3..9178bc5a2c5 100644 --- a/pkg/linter/test/mocks.dart +++ b/pkg/linter/test/mocks.dart @@ -63,7 +63,7 @@ class MockIOSink implements IOSink { } class TestDiagnosticCode extends DiagnosticCodeImpl { - TestDiagnosticCode( + new( String name, String message, { super.type = DiagnosticType.COMPILE_TIME_ERROR, diff --git a/pkg/linter/test/rules/invalid_runtime_check_with_js_interop_types_test.dart b/pkg/linter/test/rules/invalid_runtime_check_with_js_interop_types_test.dart index 8e85cd40cfc..c1454cca966 100644 --- a/pkg/linter/test/rules/invalid_runtime_check_with_js_interop_types_test.dart +++ b/pkg/linter/test/rules/invalid_runtime_check_with_js_interop_types_test.dart @@ -1447,13 +1447,13 @@ export 'dart:_js_annotations' show JS, staticInterop; /// Represents an `as` cast from a value of type [valueType] to [type]. final class _AsCast extends _TypeTest { - _AsCast(super.valueType, super.type, {super.lint, super.unnecessary}); + new(super.valueType, super.type, {super.lint, super.unnecessary}); } /// Represents an `is` check against [type] where the value is of type /// [valueType]. final class _IsCheck extends _TypeTest { - _IsCheck(super.valueType, super.type, {super.lint, super.unnecessary}); + new(super.valueType, super.type, {super.lint, super.unnecessary}); } /// Represents a type test using a runtime check. @@ -1468,10 +1468,5 @@ abstract class _TypeTest { /// test should ignore the related warning. bool unnecessary; - _TypeTest( - this.valueType, - this.type, { - this.lint = true, - this.unnecessary = false, - }); + new(this.valueType, this.type, {this.lint = true, this.unnecessary = false}); } diff --git a/pkg/linter/test/verify_reflective_test_suites_test.dart b/pkg/linter/test/verify_reflective_test_suites_test.dart index 13de91e94b6..fb509e3055c 100644 --- a/pkg/linter/test/verify_reflective_test_suites_test.dart +++ b/pkg/linter/test/verify_reflective_test_suites_test.dart @@ -29,7 +29,7 @@ void main() { class _VerifyTests { final String testDirPath; - _VerifyTests(this.testDirPath); + new(this.testDirPath); String get testAllFileName => 'all.dart'; diff --git a/pkg/linter/tool/benchmark.dart b/pkg/linter/tool/benchmark.dart index 41753a373d2..9a95141e139 100644 --- a/pkg/linter/tool/benchmark.dart +++ b/pkg/linter/tool/benchmark.dart @@ -218,7 +218,7 @@ class Stat implements Comparable { final String name; final int elapsed; - Stat(this.name, this.elapsed); + new(this.name, this.elapsed); @override int compareTo(Stat other) => other.elapsed - elapsed; @@ -229,7 +229,7 @@ class _ErrorWatchingSink implements StringSink { final StringSink delegate; - _ErrorWatchingSink(this.delegate); + new(this.delegate); @override void write(Object? obj) => delegate.write(obj); diff --git a/pkg/linter/tool/checks/driver.dart b/pkg/linter/tool/checks/driver.dart index c7598d9c9eb..3ac84b4d546 100644 --- a/pkg/linter/tool/checks/driver.dart +++ b/pkg/linter/tool/checks/driver.dart @@ -45,7 +45,7 @@ class Driver { final List lints; final bool silent; - Driver(this.lints, {this.silent = true}); + new(this.lints, {this.silent = true}); Future> analyze(List sources) async { if (sources.isEmpty) { diff --git a/pkg/linter/tool/checks/rules/no_solo_tests.dart b/pkg/linter/tool/checks/rules/no_solo_tests.dart index 37394dbf65f..180ba1047b3 100644 --- a/pkg/linter/tool/checks/rules/no_solo_tests.dart +++ b/pkg/linter/tool/checks/rules/no_solo_tests.dart @@ -14,7 +14,7 @@ import 'package:linter/src/diagnostic.dart' as diag; class NoSoloTests extends AnalysisRule { static const DiagnosticCode code = diag.noSoloTests; - NoSoloTests() + new() : super(name: 'no_solo_tests', description: "Don't commit soloed tests."); @override @@ -35,7 +35,7 @@ class NoSoloTests extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/tool/checks/rules/no_trailing_spaces.dart b/pkg/linter/tool/checks/rules/no_trailing_spaces.dart index 47ed46e7b5b..df9f6a05b44 100644 --- a/pkg/linter/tool/checks/rules/no_trailing_spaces.dart +++ b/pkg/linter/tool/checks/rules/no_trailing_spaces.dart @@ -14,7 +14,7 @@ import 'package:linter/src/diagnostic.dart' as diag; class NoTrailingSpaces extends AnalysisRule { static const DiagnosticCode code = diag.noTrailingSpaces; - NoTrailingSpaces() + new() : super( name: 'no_trailing_spaces', description: @@ -39,7 +39,7 @@ class NoTrailingSpaces extends AnalysisRule { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodInvocation(MethodInvocation node) { diff --git a/pkg/linter/tool/checks/rules/visit_registered_nodes.dart b/pkg/linter/tool/checks/rules/visit_registered_nodes.dart index 3560ad120a7..bbf6433c29a 100644 --- a/pkg/linter/tool/checks/rules/visit_registered_nodes.dart +++ b/pkg/linter/tool/checks/rules/visit_registered_nodes.dart @@ -15,7 +15,7 @@ import 'package:linter/src/diagnostic.dart' as diag; class VisitRegisteredNodes extends AnalysisRule { static const DiagnosticCode code = diag.visitRegisteredNodes; - VisitRegisteredNodes() + new() : super( name: 'visit_registered_nodes', description: "Declare 'visit' methods for all registered node types.", @@ -36,7 +36,7 @@ class VisitRegisteredNodes extends AnalysisRule { class _BodyVisitor extends RecursiveAstVisitor { final AnalysisRule rule; - _BodyVisitor(this.rule); + new(this.rule); bool implements(ClassElement visitor, String methodName) { var member = visitor.lookUpConcreteMethod(methodName, visitor.library); @@ -71,7 +71,7 @@ class _BodyVisitor extends RecursiveAstVisitor { class _Visitor extends SimpleAstVisitor { final AnalysisRule rule; - _Visitor(this.rule); + new(this.rule); @override void visitMethodDeclaration(MethodDeclaration node) { diff --git a/pkg/linter/tool/messages_info.dart b/pkg/linter/tool/messages_info.dart index 96a1d10522c..e467c7faf6e 100644 --- a/pkg/linter/tool/messages_info.dart +++ b/pkg/linter/tool/messages_info.dart @@ -51,11 +51,7 @@ class CodeInfo { final List problemMessage; final List? correctionMessage; - CodeInfo( - this.uniqueName, { - required this.problemMessage, - this.correctionMessage, - }); + new(this.uniqueName, {required this.problemMessage, this.correctionMessage}); } class RuleInfo { @@ -68,7 +64,7 @@ class RuleInfo { final String deprecatedDetails; final bool removed; - RuleInfo({ + new({ required this.name, required this.codes, required this.categories, @@ -98,7 +94,7 @@ class _RuleBuilder { String? _documentation; String? _deprecatedDetails; - _RuleBuilder(this.sharedName); + new(this.sharedName); bool get _wasRemoved => _states?.keys.any((key) => key == LintStateName.removed) ?? false; diff --git a/pkg/linter/tool/test_linter.dart b/pkg/linter/tool/test_linter.dart index 25ce0c3a692..a02591867a0 100644 --- a/pkg/linter/tool/test_linter.dart +++ b/pkg/linter/tool/test_linter.dart @@ -27,7 +27,7 @@ class TestLinter implements DiagnosticListener { final String? _dartSdkPath; - TestLinter(this._rules, this._dartSdkPath); + new(this._rules, this._dartSdkPath); ResourceProvider get _resourceProvider => file_system.PhysicalResourceProvider.INSTANCE; diff --git a/pkg/linter/tool/util/formatter.dart b/pkg/linter/tool/util/formatter.dart index 29d5146e96e..55fc1170f02 100644 --- a/pkg/linter/tool/util/formatter.dart +++ b/pkg/linter/tool/util/formatter.dart @@ -34,7 +34,7 @@ class ReportFormatter { int diagnosticCount = 0; - ReportFormatter(this.diagnostics, this.out); + new(this.diagnostics, this.out); /// Override to influence diagnostic sorting. int compare(Diagnostic diagnostic1, Diagnostic diagnostic2) { diff --git a/pkg/server_plugin/analysis_options.yaml b/pkg/server_plugin/analysis_options.yaml index 47356f7900d..599bc023919 100644 --- a/pkg/server_plugin/analysis_options.yaml +++ b/pkg/server_plugin/analysis_options.yaml @@ -13,6 +13,8 @@ analyzer: linter: rules: + - unnecessary_type_name_in_constructor + - unnecessary_const_in_enum_constructor - always_use_package_imports - avoid_dynamic_calls - avoid_redundant_argument_values diff --git a/pkg/server_plugin/pubspec.yaml b/pkg/server_plugin/pubspec.yaml index 2542fbfe655..f498d35705a 100644 --- a/pkg/server_plugin/pubspec.yaml +++ b/pkg/server_plugin/pubspec.yaml @@ -3,7 +3,7 @@ name: server_plugin publish_to: none environment: - sdk: '^3.12.0-0' + sdk: '^3.13.0-0' resolution: workspace diff --git a/pkg/telemetry/analysis_options.yaml b/pkg/telemetry/analysis_options.yaml index d2e6c140cd3..6688b1c0d1c 100644 --- a/pkg/telemetry/analysis_options.yaml +++ b/pkg/telemetry/analysis_options.yaml @@ -6,4 +6,6 @@ analyzer: linter: rules: + - unnecessary_type_name_in_constructor + - unnecessary_const_in_enum_constructor - unawaited_futures diff --git a/pkg/telemetry/lib/crash_reporting.dart b/pkg/telemetry/lib/crash_reporting.dart index 4e95417e4da..c0a568cc769 100644 --- a/pkg/telemetry/lib/crash_reporting.dart +++ b/pkg/telemetry/lib/crash_reporting.dart @@ -52,7 +52,7 @@ class CrashReportSender { int _reportsSent = 0; int _skippedReports = 0; - CrashReportSender._( + new _( this.crashProductId, this.shouldSend, { http.Client? httpClient, @@ -65,7 +65,7 @@ class CrashReportSender { ); /// Create a new [CrashReportSender] connected to the staging endpoint. - CrashReportSender.staging( + new staging( String crashProductId, EnablementCallback shouldSend, { http.Client? httpClient, @@ -77,7 +77,7 @@ class CrashReportSender { ); /// Create a new [CrashReportSender] connected to the prod endpoint. - CrashReportSender.prod( + new prod( String crashProductId, EnablementCallback shouldSend, { http.Client? httpClient, @@ -203,7 +203,7 @@ class CrashReportAttachment { final String _field; final String _value; - CrashReportAttachment.string({required this._field, required this._value}); + new string({required this._field, required this._value}); } /// A typedef to allow crash reporting to query as to whether it should send a diff --git a/pkg/telemetry/lib/src/pii_regexp.dart b/pkg/telemetry/lib/src/pii_regexp.dart index 7cbe4dcab70..af1296db01d 100644 --- a/pkg/telemetry/lib/src/pii_regexp.dart +++ b/pkg/telemetry/lib/src/pii_regexp.dart @@ -23,7 +23,7 @@ class _RegExpList { final List _regExps; final String substitution; - _RegExpList(List uncompiledRegexps, this.substitution) + new(List uncompiledRegexps, this.substitution) : _regExps = uncompiledRegexps.map((s) => RegExp(s)).toList(); String applyTo(String input) => _regExps.fold( diff --git a/pkg/telemetry/lib/src/utils.dart b/pkg/telemetry/lib/src/utils.dart index 55597ffa56d..637342f9dac 100644 --- a/pkg/telemetry/lib/src/utils.dart +++ b/pkg/telemetry/lib/src/utils.dart @@ -17,7 +17,7 @@ class ThrottlingBucket { late int _drops = bucketSize; late int _lastReplenish = DateTime.now().millisecondsSinceEpoch; - ThrottlingBucket(this.bucketSize, this.replenishDuration); + new(this.bucketSize, this.replenishDuration); bool removeDrop() { _checkReplenish(); diff --git a/pkg/telemetry/pubspec.yaml b/pkg/telemetry/pubspec.yaml index d6d66978d7b..f6e84ad32c8 100644 --- a/pkg/telemetry/pubspec.yaml +++ b/pkg/telemetry/pubspec.yaml @@ -4,7 +4,7 @@ description: A library to facilitate reporting analytics and crash reports. publish_to: none environment: - sdk: '^3.12.0-0' + sdk: '^3.13.0-0' resolution: workspace