Skip to content

Commit 254b166

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer: Simplify FormatterOptions impl
Change-Id: If68c615efcbec4ad07be3a51fc267a53829924c3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389020 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent d6e562c commit 254b166

File tree

4 files changed

+8
-29
lines changed

4 files changed

+8
-29
lines changed

pkg/analyzer/lib/dart/analysis/formatter_options.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
/// A set of options related to the formatter that apply to the code within a
66
/// single analysis context.
7-
///
8-
/// Clients may not extend, implement or mix-in this class.
9-
abstract class FormatterOptions {
7+
final class FormatterOptions {
108
/// The width configured for where the formatter should wrap code.
11-
int? get pageWidth;
9+
final int? pageWidth;
10+
11+
FormatterOptions({this.pageWidth});
1212
}

pkg/analyzer/lib/src/analysis_options/apply_options.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:analyzer/dart/analysis/formatter_options.dart';
88
import 'package:analyzer/error/error.dart';
99
import 'package:analyzer/source/error_processor.dart';
1010
import 'package:analyzer/src/analysis_options/code_style_options.dart';
11-
import 'package:analyzer/src/analysis_options/formatter_options.dart';
1211
import 'package:analyzer/src/dart/analysis/experiments.dart';
1312
import 'package:analyzer/src/generated/engine.dart';
1413
import 'package:analyzer/src/generated/utilities_general.dart';
@@ -159,7 +158,7 @@ extension on AnalysisOptionsImpl {
159158
pageWidth = formatValue;
160159
}
161160
}
162-
return FormatterOptionsImpl(this, pageWidth: pageWidth);
161+
return FormatterOptions(pageWidth: pageWidth);
163162
}
164163

165164
void _applyLegacyPlugins(YamlNode? plugins) {

pkg/analyzer/lib/src/analysis_options/formatter_options.dart

Lines changed: 0 additions & 18 deletions
This file was deleted.

pkg/analyzer/lib/src/generated/engine.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import 'package:analyzer/source/error_processor.dart';
1717
import 'package:analyzer/source/line_info.dart';
1818
import 'package:analyzer/source/source.dart';
1919
import 'package:analyzer/src/analysis_options/code_style_options.dart';
20-
import 'package:analyzer/src/analysis_options/formatter_options.dart';
2120
import 'package:analyzer/src/dart/analysis/experiments.dart';
2221
import 'package:analyzer/src/generated/source.dart' show SourceFactory;
2322
import 'package:analyzer/src/lint/linter.dart';
@@ -239,17 +238,16 @@ class AnalysisOptionsImpl implements AnalysisOptions {
239238
late CodeStyleOptions codeStyleOptions;
240239

241240
@override
242-
late FormatterOptions formatterOptions;
241+
FormatterOptions formatterOptions = FormatterOptions();
243242

244-
/// The set of "un-ignorable" error names, as parsed in [AnalyzerOptions] from
245-
/// an analysis options file.
243+
/// The set of "un-ignorable" error names, as parsed from an analysis options
244+
/// file.
246245
Set<String> unignorableNames = {};
247246

248247
/// Initialize a newly created set of analysis options to have their default
249248
/// values.
250249
AnalysisOptionsImpl({this.file}) {
251250
codeStyleOptions = CodeStyleOptionsImpl(this, useFormatter: false);
252-
formatterOptions = FormatterOptionsImpl(this);
253251
}
254252

255253
/// Initialize a newly created set of analysis options to have the same values

0 commit comments

Comments
 (0)