diff --git a/pkg/frontend_server/analysis_options.yaml b/pkg/frontend_server/analysis_options.yaml index 9ff1bcbc65c..e10a959bbbe 100644 --- a/pkg/frontend_server/analysis_options.yaml +++ b/pkg/frontend_server/analysis_options.yaml @@ -4,6 +4,8 @@ analyzer: linter: rules: + - unnecessary_type_name_in_constructor + - unnecessary_const_in_enum_constructor - collection_methods_unrelated_type - curly_braces_in_flow_control_structures - prefer_adjacent_string_concatenation diff --git a/pkg/frontend_server/lib/compute_kernel.dart b/pkg/frontend_server/lib/compute_kernel.dart index eaaa05efe43..1d00cb4dc3b 100644 --- a/pkg/frontend_server/lib/compute_kernel.dart +++ b/pkg/frontend_server/lib/compute_kernel.dart @@ -160,7 +160,7 @@ class ComputeKernelResult { final bool succeeded; final fe.InitializedCompilerState? previousState; - ComputeKernelResult(this.succeeded, this.previousState); + new(this.succeeded, this.previousState); } /// Computes a kernel file based on [args]. @@ -600,7 +600,7 @@ class _FakeFileSystem extends FileSystem { final Map redirectsFromTo = {}; final Set redirectsTo = {}; final FileSystem fs; - _FakeFileSystem(this.fs); + new(this.fs); void addRedirect(Uri from, Uri to) { redirectsTo.add(to); @@ -621,11 +621,8 @@ class DevCompilerSummaryTarget extends DevCompilerTarget with SummaryMixin { @override final bool excludeNonSources; - DevCompilerSummaryTarget( - this.sources, - this.excludeNonSources, - TargetFlags targetFlags, - ) : super(targetFlags); + new(this.sources, this.excludeNonSources, TargetFlags targetFlags) + : super(targetFlags); @override bool isModularlyCompatibleWith(Target other) { diff --git a/pkg/frontend_server/lib/frontend_server.dart b/pkg/frontend_server/lib/frontend_server.dart index 64c9c6bffcd..90e6ea86299 100644 --- a/pkg/frontend_server/lib/frontend_server.dart +++ b/pkg/frontend_server/lib/frontend_server.dart @@ -573,7 +573,7 @@ class BinaryPrinterFactory { } class FrontendCompiler implements CompilerInterface { - FrontendCompiler( + new( StringSink? outputStream, { BinaryPrinterFactory? printerFactory, this.transformer, diff --git a/pkg/frontend_server/lib/resident_frontend_server_utils.dart b/pkg/frontend_server/lib/resident_frontend_server_utils.dart index e7e98d3a872..d0ae02e37f7 100644 --- a/pkg/frontend_server/lib/resident_frontend_server_utils.dart +++ b/pkg/frontend_server/lib/resident_frontend_server_utils.dart @@ -43,11 +43,7 @@ final class ResidentCompilerInfo { ); } - ResidentCompilerInfo._({ - required this.sdkHash, - required this.port, - required this.address, - }); + new _({required this.sdkHash, required this.port, required this.address}); } typedef CachedDillAndCompilerOptionsPaths = ({ @@ -152,7 +148,7 @@ final class CompileResult { /// The output lines produced by the compiler, if any. final List compilerOutputLines; - CompileResult({ + new({ required this.outputDill, required this.errorCount, this.compilerOutputLines = const [], @@ -171,7 +167,7 @@ final class CompileExpressionResult { /// The output lines produced by the compiler, if any. final List compilerOutputLines; - CompileExpressionResult({ + new({ required this.kernelBytes, required this.errorCount, this.compilerOutputLines = const [], @@ -184,7 +180,7 @@ final class CompileException implements Exception { /// The error message from the compiler. final String message; - CompileException(this.message); + new(this.message); @override String toString() => 'CompileException: $message'; diff --git a/pkg/frontend_server/lib/src/javascript_bundle.dart b/pkg/frontend_server/lib/src/javascript_bundle.dart index 111bb99c653..ebec07c37d8 100644 --- a/pkg/frontend_server/lib/src/javascript_bundle.dart +++ b/pkg/frontend_server/lib/src/javascript_bundle.dart @@ -34,7 +34,7 @@ import 'strong_components.dart'; /// an incremental build, a different file is written for each which contains /// only the updated libraries. class IncrementalJavaScriptBundler { - IncrementalJavaScriptBundler( + new( this._fileSystem, this._loadedLibraries, this._fileSystemScheme, { diff --git a/pkg/frontend_server/lib/src/resident_frontend_server.dart b/pkg/frontend_server/lib/src/resident_frontend_server.dart index 477555a7777..10134f2c629 100644 --- a/pkg/frontend_server/lib/src/resident_frontend_server.dart +++ b/pkg/frontend_server/lib/src/resident_frontend_server.dart @@ -97,7 +97,7 @@ class ResidentCompiler { File get _outputDill => new File(_compileOptions.option(ResidentFrontendServer._outputString)!); - ResidentCompiler(this._entryPoint, this._compileOptions) { + new(this._entryPoint, this._compileOptions) { _compiler = new FrontendCompiler(_compilerOutput); updateState(_compileOptions); } diff --git a/pkg/frontend_server/lib/src/strong_components.dart b/pkg/frontend_server/lib/src/strong_components.dart index 14b17576ccc..a8b082ce6cd 100644 --- a/pkg/frontend_server/lib/src/strong_components.dart +++ b/pkg/frontend_server/lib/src/strong_components.dart @@ -26,12 +26,7 @@ import 'package:kernel/util/graph.dart'; /// On incremental updates, we completely recompute the strongly connected /// components, but only for the partial component produced. class StrongComponents { - StrongComponents( - this.component, - this.loadedLibraries, - this.mainUri, [ - this.fileSystem, - ]); + new(this.component, this.loadedLibraries, this.mainUri, [this.fileSystem]); /// The Component that is being compiled. /// @@ -110,7 +105,7 @@ class StrongComponents { } class _LibraryGraph implements Graph { - _LibraryGraph(this.library, this.loadedLibraries, [this._partialComponent]); + new(this.library, this.loadedLibraries, [this._partialComponent]); final Library library; final Set loadedLibraries; diff --git a/pkg/frontend_server/pubspec.yaml b/pkg/frontend_server/pubspec.yaml index bbc782c353b..ecda277b6e5 100644 --- a/pkg/frontend_server/pubspec.yaml +++ b/pkg/frontend_server/pubspec.yaml @@ -4,7 +4,7 @@ description: A resident kernel compiler publish_to: none environment: - sdk: '^3.12.0-0' + sdk: '^3.13.0-0' resolution: workspace diff --git a/pkg/frontend_server/test/const_finder_test.dart b/pkg/frontend_server/test/const_finder_test.dart index 7c401e2ed46..30996455d73 100644 --- a/pkg/frontend_server/test/const_finder_test.dart +++ b/pkg/frontend_server/test/const_finder_test.dart @@ -451,7 +451,7 @@ enum Compiler { } class _Test { - _Test({ + new({ required this.name, required this.dartSource, required this.sdkRoot, @@ -531,7 +531,7 @@ class _Test { /// Equality that casts all [num]'s to [double] before comparing. class Dart2JSDeepCollectionEquality extends DeepCollectionEquality { - const Dart2JSDeepCollectionEquality(); + const new(); @override bool equals(Object? e1, Object? e2) { diff --git a/pkg/frontend_server/test/frontend_server_flutter.dart b/pkg/frontend_server/test/frontend_server_flutter.dart index d7a16c7e4a5..b4325cdd16c 100644 --- a/pkg/frontend_server/test/frontend_server_flutter.dart +++ b/pkg/frontend_server/test/frontend_server_flutter.dart @@ -188,7 +188,7 @@ class _QueueEntry { final File packageConfig; final Directory testDir; - _QueueEntry(this.files, this.packageConfig, this.testDir); + new(this.files, this.packageConfig, this.testDir); } Future _processFiles( @@ -446,7 +446,7 @@ Future> attemptStuff( // (expect can only be used in tests via the test framework). class OutputParser { - OutputParser(this._receivedResults); + new(this._receivedResults); bool expectSources = true; final StreamController _receivedResults; @@ -500,7 +500,7 @@ class Result { String? status; List? sources; - Result(this.status, this.sources); + new(this.status, this.sources); void expectNoErrors({String? filename}) { CompilationResult result = new CompilationResult.parse(status!); @@ -519,7 +519,7 @@ class CompilationResult { late String filename; late int errorsCount; - CompilationResult.parse(String? filenameAndErrorCount) { + new parse(String? filenameAndErrorCount) { if (filenameAndErrorCount == null) { return; } @@ -579,7 +579,7 @@ class _MockFile implements File { final File _f; _MockIOSink? writeSink; - _MockFile(this._f); + new(this._f); @override bool existsSync() { diff --git a/pkg/frontend_server/test/frontend_server_flutter_suite.dart b/pkg/frontend_server/test/frontend_server_flutter_suite.dart index 326b8cbb586..dfe3e84e7d6 100644 --- a/pkg/frontend_server/test/frontend_server_flutter_suite.dart +++ b/pkg/frontend_server/test/frontend_server_flutter_suite.dart @@ -23,7 +23,7 @@ class Options { final String flutterDir; final String flutterPlatformDir; - Options( + new( this.configurationName, this.verbose, this.printFailureLog, @@ -86,7 +86,7 @@ class ResultLogger extends Logger { final Map stopwatches = {}; final List _log = []; - ResultLogger(this.suiteConfiguration); + new(this.suiteConfiguration); void handleTestResult(String testName, bool matchedExpectations) { String fullTestName = "$suiteNamePrefix/$testName"; @@ -172,7 +172,7 @@ class SuiteConfiguration { final String flutterDir; final String flutterPlatformDir; - const SuiteConfiguration( + const new( this.resultsPort, this.logsPort, this.verbose, diff --git a/pkg/frontend_server/test/frontend_server_test.dart b/pkg/frontend_server/test/frontend_server_test.dart index 03aefc3efab..fcd9fd99122 100644 --- a/pkg/frontend_server/test/frontend_server_test.dart +++ b/pkg/frontend_server/test/frontend_server_test.dart @@ -54,7 +54,7 @@ void nopVerifyRecompileDelta(String? entryPoint) {} void nopVerify() {} class _MockedCompiler implements CompilerInterface { - _MockedCompiler({ + new({ this.verifyCompile = nopVerifyCompile, this.verifyRecompileDelta = nopVerifyRecompileDelta, this.verifyInvalidate = nopVerifyInvalidate, @@ -3845,7 +3845,7 @@ class CompilationResult { late String filename; int errorsCount = 0; - CompilationResult.parse(String? filenameAndErrorCount) { + new parse(String? filenameAndErrorCount) { if (filenameAndErrorCount == null) { return; } @@ -3864,7 +3864,7 @@ class OutputParser { String? _boundaryKey; bool _readingSources = false; - OutputParser(this._receivedResults); + new(this._receivedResults); void listener(String s) { if (_boundaryKey == null) { @@ -3910,7 +3910,7 @@ class Result { String? status; List sources; - Result(this.status, this.sources); + new(this.status, this.sources); void expectNoErrors({String? filename}) { CompilationResult result = new CompilationResult.parse(status); @@ -3927,7 +3927,7 @@ Matcher not(Matcher matcher) => new NotMatcher(matcher); class NotMatcher extends Matcher { final Matcher matcher; - const NotMatcher(this.matcher); + const new(this.matcher); @override Description describe(Description description) => @@ -3947,7 +3947,7 @@ class FrontendServer { final StreamController receivedResults; final OutputParser outputParser; - factory FrontendServer() { + factory() { final StreamController> inputStreamController = new StreamController>(); final StreamController> stdoutStreamController = @@ -3968,7 +3968,7 @@ class FrontendServer { ); } - FrontendServer._internal( + new _internal( this.inputStreamController, this.stdoutStreamController, this.ioSink,