Skip to content

Commit becd91d

Browse files
scheglovCommit Queue
authored andcommitted
Format analyzer/ with tall mode.
Change-Id: I410cd1cf63fbf00b868bbb3e060433cad3ac9e6c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423520 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Paul Berry <[email protected]>
1 parent b67a9a7 commit becd91d

File tree

1,305 files changed

+87114
-62690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,305 files changed

+87114
-62690
lines changed

pkg/analyzer/example/analyze.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ void main(List<String> args) async {
1919

2020
var issueCount = 0;
2121
var collection = AnalysisContextCollection(
22-
includedPaths: [entity.absolute.path],
23-
resourceProvider: PhysicalResourceProvider.INSTANCE);
22+
includedPaths: [entity.absolute.path],
23+
resourceProvider: PhysicalResourceProvider.INSTANCE,
24+
);
2425

2526
// Often one context is returned, but depending on the project structure we
2627
// can see multiple contexts.
@@ -37,7 +38,8 @@ void main(List<String> args) async {
3738
for (var error in errorsResult.errors) {
3839
if (error.errorCode.type != ErrorType.TODO) {
3940
print(
40-
' \u001b[1m${error.source.shortName}\u001b[0m ${error.message}');
41+
' \u001b[1m${error.source.shortName}\u001b[0m ${error.message}',
42+
);
4143
issueCount++;
4244
}
4345
}

pkg/analyzer/lib/dart/analysis/analysis_options.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,17 @@ final class GitPluginSource implements PluginSource {
8282
final String? _ref;
8383

8484
GitPluginSource({required String url, String? path, String? ref})
85-
: _url = url,
86-
_path = path,
87-
_ref = ref;
85+
: _url = url,
86+
_path = path,
87+
_ref = ref;
8888

8989
@override
9090
String toYaml({required String name}) {
91-
var buffer = StringBuffer()
92-
..writeln(' $name:')
93-
..writeln(' git:')
94-
..writeln(' url: $_url');
91+
var buffer =
92+
StringBuffer()
93+
..writeln(' $name:')
94+
..writeln(' git:')
95+
..writeln(' url: $_url');
9596
if (_ref != null) {
9697
buffer.writeln(' ref: $_ref');
9798
}
@@ -159,7 +160,7 @@ final class VersionedPluginSource implements PluginSource {
159160
final String _constraint;
160161

161162
VersionedPluginSource({required String constraint})
162-
: _constraint = constraint;
163+
: _constraint = constraint;
163164

164165
@override
165166
String toYaml({required String name}) => ' $name: $_constraint\n';

pkg/analyzer/lib/dart/analysis/features.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ abstract class FeatureSet {
147147
/// that the code that you process is valid for the latest language version.
148148
///
149149
/// Otherwise, it is recommended to use [FeatureSet.fromEnableFlags2].
150-
factory FeatureSet.latestLanguageVersion({
151-
List<String> flags,
152-
}) = ExperimentStatus.latestLanguageVersion;
150+
factory FeatureSet.latestLanguageVersion({List<String> flags}) =
151+
ExperimentStatus.latestLanguageVersion;
153152

154153
/// Queries whether the given [feature] is contained in this feature set.
155154
bool isEnabled(Feature feature);

pkg/analyzer/lib/dart/analysis/session.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ abstract class AnalysisSession {
7070
/// Throw [ArgumentError] if the [element] was not produced by this session.
7171
@experimental
7272
Future<SomeResolvedLibraryResult> getResolvedLibraryByElement2(
73-
LibraryElement2 element);
73+
LibraryElement2 element,
74+
);
7475

7576
/// Return a future that will complete with information about the results of
7677
/// resolving all of the files in the library containing the given absolute,
@@ -94,6 +95,8 @@ abstract class AnalysisSession {
9495
/// might be inconsistent with any previously returned results.
9596
class InconsistentAnalysisException extends AnalysisException {
9697
InconsistentAnalysisException()
97-
: super('Requested result might be inconsistent with previously '
98-
'returned results');
98+
: super(
99+
'Requested result might be inconsistent with previously '
100+
'returned results',
101+
);
99102
}

pkg/analyzer/lib/dart/analysis/utilities.dart

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@ import 'package:analyzer/src/string_source.dart';
4141
/// produced because of syntactic errors in the file an `ArgumentError` will be
4242
/// thrown. If the parameter is `false`, then the caller can check the result
4343
/// to see whether there are any errors.
44-
ParseStringResult parseFile(
45-
{required String path,
46-
ResourceProvider? resourceProvider,
47-
required FeatureSet featureSet,
48-
bool throwIfDiagnostics = true}) {
44+
ParseStringResult parseFile({
45+
required String path,
46+
ResourceProvider? resourceProvider,
47+
required FeatureSet featureSet,
48+
bool throwIfDiagnostics = true,
49+
}) {
4950
resourceProvider ??= PhysicalResourceProvider.INSTANCE;
5051
var content = (resourceProvider.getResource(path) as File).readAsStringSync();
5152
return parseString(
52-
content: content,
53-
path: path,
54-
featureSet: featureSet,
55-
throwIfDiagnostics: throwIfDiagnostics);
53+
content: content,
54+
path: path,
55+
featureSet: featureSet,
56+
throwIfDiagnostics: throwIfDiagnostics,
57+
);
5658
}
5759

5860
/// Returns the result of parsing the given [content] as a compilation unit.
@@ -72,24 +74,25 @@ ParseStringResult parseFile(
7274
/// in the presence of parse errors). Clients interested in details about parse
7375
/// errors should pass `false` and check `result.errors` to determine what parse
7476
/// errors, if any, have occurred.
75-
ParseStringResult parseString(
76-
{required String content,
77-
FeatureSet? featureSet,
78-
String? path,
79-
bool throwIfDiagnostics = true}) {
77+
ParseStringResult parseString({
78+
required String content,
79+
FeatureSet? featureSet,
80+
String? path,
81+
bool throwIfDiagnostics = true,
82+
}) {
8083
featureSet ??= FeatureSet.latestLanguageVersion();
8184
var source = StringSource(content, path ?? '');
8285
var reader = CharSequenceReader(content);
8386
var errorCollector = RecordingErrorListener();
84-
var scanner = Scanner(source, reader, errorCollector)
85-
..configureFeatures(
86-
featureSetForOverriding: featureSet,
87-
featureSet: featureSet,
88-
);
87+
var scanner = Scanner(source, reader, errorCollector)..configureFeatures(
88+
featureSetForOverriding: featureSet,
89+
featureSet: featureSet,
90+
);
8991
var token = scanner.tokenize();
9092
var languageVersion = LibraryLanguageVersion(
91-
package: ExperimentStatus.currentVersion,
92-
override: scanner.overrideVersion);
93+
package: ExperimentStatus.currentVersion,
94+
override: scanner.overrideVersion,
95+
);
9396
var lineInfo = LineInfo(scanner.lineStarts);
9497
var parser = Parser(
9598
source,
@@ -99,14 +102,19 @@ ParseStringResult parseString(
99102
lineInfo: lineInfo,
100103
);
101104
var unit = parser.parseCompilationUnit(token);
102-
ParseStringResult result =
103-
ParseStringResultImpl(content, unit, errorCollector.errors);
105+
ParseStringResult result = ParseStringResultImpl(
106+
content,
107+
unit,
108+
errorCollector.errors,
109+
);
104110
if (throwIfDiagnostics && result.errors.isNotEmpty) {
105111
var buffer = StringBuffer();
106112
for (var error in result.errors) {
107113
var location = lineInfo.getLocation(error.offset);
108-
buffer.writeln(' ${error.errorCode.name}: ${error.message} - '
109-
'${location.lineNumber}:${location.columnNumber}');
114+
buffer.writeln(
115+
' ${error.errorCode.name}: ${error.message} - '
116+
'${location.lineNumber}:${location.columnNumber}',
117+
);
110118
}
111119
throw ArgumentError('Content produced diagnostics when parsed:\n$buffer');
112120
}
@@ -120,19 +128,25 @@ ParseStringResult parseString(
120128
/// Note that if more than one file is going to be resolved then this function
121129
/// is inefficient. Clients should instead use [AnalysisContextCollection] to
122130
/// create one or more contexts and use those contexts to resolve the files.
123-
Future<SomeResolvedUnitResult> resolveFile2(
124-
{required String path, ResourceProvider? resourceProvider}) async {
125-
AnalysisContext context =
126-
_createAnalysisContext(path: path, resourceProvider: resourceProvider);
131+
Future<SomeResolvedUnitResult> resolveFile2({
132+
required String path,
133+
ResourceProvider? resourceProvider,
134+
}) async {
135+
AnalysisContext context = _createAnalysisContext(
136+
path: path,
137+
resourceProvider: resourceProvider,
138+
);
127139
return await context.currentSession.getResolvedUnit(path);
128140
}
129141

130142
/// Return a newly create analysis context in which the file at the given [path]
131143
/// can be analyzed.
132144
///
133145
/// If a [resourceProvider] is given, it will be used to access the file system.
134-
AnalysisContext _createAnalysisContext(
135-
{required String path, ResourceProvider? resourceProvider}) {
146+
AnalysisContext _createAnalysisContext({
147+
required String path,
148+
ResourceProvider? resourceProvider,
149+
}) {
136150
AnalysisContextCollection collection = AnalysisContextCollection(
137151
includedPaths: <String>[path],
138152
resourceProvider: resourceProvider ?? PhysicalResourceProvider.INSTANCE,

pkg/analyzer/lib/dart/ast/doc_comment.dart

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,7 @@ enum DocDirectiveType {
221221
///
222222
/// See documentation at
223223
/// <https://github.com/dart-lang/dartdoc/blob/main/doc/directives.md#category-and-subcategory---categories>.
224-
category(
225-
'category',
226-
restParametersAllowed: true,
227-
),
224+
category('category', restParametersAllowed: true),
228225

229226
/// The end tag for the [DocDirectiveType.injectHtml] tag.
230227
///
@@ -370,25 +367,23 @@ enum DocDirectiveType {
370367
this.positionalParameters = const <DocDirectiveParameter>[],
371368
this.namedParameters = const <DocDirectiveParameter>[],
372369
this.restParametersAllowed = false,
373-
}) : isBlock = false,
374-
opposingName = null;
370+
}) : isBlock = false,
371+
opposingName = null;
375372

376373
const DocDirectiveType.block(
377374
this.name,
378375
this.opposingName, {
379376
this.positionalParameters = const <DocDirectiveParameter>[],
380377
this.restParametersAllowed = false,
381-
}) : isBlock = true,
382-
namedParameters = const <DocDirectiveParameter>[];
383-
384-
const DocDirectiveType.end(
385-
this.name, {
386-
required String openingTag,
387-
}) : opposingName = openingTag,
388-
isBlock = false,
389-
positionalParameters = const <DocDirectiveParameter>[],
390-
namedParameters = const <DocDirectiveParameter>[],
391-
restParametersAllowed = false;
378+
}) : isBlock = true,
379+
namedParameters = const <DocDirectiveParameter>[];
380+
381+
const DocDirectiveType.end(this.name, {required String openingTag})
382+
: opposingName = openingTag,
383+
isBlock = false,
384+
positionalParameters = const <DocDirectiveParameter>[],
385+
namedParameters = const <DocDirectiveParameter>[],
386+
restParametersAllowed = false;
392387
}
393388

394389
/// A documentation import, found in a doc comment.

pkg/analyzer/lib/dart/ast/precedence.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ class Precedence {
9494

9595
static const Precedence additive = Precedence._(ADDITIVE_PRECEDENCE);
9696

97-
static const Precedence multiplicative =
98-
Precedence._(MULTIPLICATIVE_PRECEDENCE);
97+
static const Precedence multiplicative = Precedence._(
98+
MULTIPLICATIVE_PRECEDENCE,
99+
);
99100

100101
static const Precedence prefix = Precedence._(PREFIX_PRECEDENCE);
101102

0 commit comments

Comments
 (0)