[frontend_server] Migrate to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288) This change migrates the frontend_server package to use the new constructor declaration syntax, described in https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations. This change was performed in an automated fashion, by (a) bumping the package's SDK constraint to `3.13.0-0`, (b) enabling the lints `unnecessary_type_name_in_constructor` and `unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint failures using `dart fix`, and then (d) reformatting the affected files. To ease code review, I've reverted unrelated formatting changes. Change-Id: Icbc924a1faae2f1c8fe0d5fa07bb9bd66a6a6964 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508369 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
e82bd2c8ed
commit
7a5c71ba05
@@ -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
|
||||
|
||||
@@ -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<Uri, Uri> redirectsFromTo = {};
|
||||
final Set<Uri> 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) {
|
||||
|
||||
@@ -573,7 +573,7 @@ class BinaryPrinterFactory {
|
||||
}
|
||||
|
||||
class FrontendCompiler implements CompilerInterface {
|
||||
FrontendCompiler(
|
||||
new(
|
||||
StringSink? outputStream, {
|
||||
BinaryPrinterFactory? printerFactory,
|
||||
this.transformer,
|
||||
|
||||
@@ -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<String> 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<String> 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';
|
||||
|
||||
@@ -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, {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<Library> {
|
||||
_LibraryGraph(this.library, this.loadedLibraries, [this._partialComponent]);
|
||||
new(this.library, this.loadedLibraries, [this._partialComponent]);
|
||||
|
||||
final Library library;
|
||||
final Set<Library> loadedLibraries;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<void> _processFiles(
|
||||
@@ -446,7 +446,7 @@ Future<List<String>> 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<Result> _receivedResults;
|
||||
@@ -500,7 +500,7 @@ class Result {
|
||||
String? status;
|
||||
List<String>? 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() {
|
||||
|
||||
@@ -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<String, Stopwatch> stopwatches = {};
|
||||
final List<String> _log = <String>[];
|
||||
|
||||
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,
|
||||
|
||||
@@ -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<String> 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<Result> receivedResults;
|
||||
final OutputParser outputParser;
|
||||
|
||||
factory FrontendServer() {
|
||||
factory() {
|
||||
final StreamController<List<int>> inputStreamController =
|
||||
new StreamController<List<int>>();
|
||||
final StreamController<List<int>> stdoutStreamController =
|
||||
@@ -3968,7 +3968,7 @@ class FrontendServer {
|
||||
);
|
||||
}
|
||||
|
||||
FrontendServer._internal(
|
||||
new _internal(
|
||||
this.inputStreamController,
|
||||
this.stdoutStreamController,
|
||||
this.ioSink,
|
||||
|
||||
Reference in New Issue
Block a user