Skip to content

Commit 0fcd1a6

Browse files
stereotype441Commit Queue
authored andcommitted
Bump _fe_analyzer_shared to SDK 3.7 and reformat
Change-Id: I70157caf90c0955c2eb8426f5721ba4ed527eb76 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427900 Commit-Queue: Konstantin Shcheglov <[email protected]> Auto-Submit: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent c4c9854 commit 0fcd1a6

File tree

312 files changed

+30251
-20024
lines changed

Some content is hidden

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

312 files changed

+30251
-20024
lines changed

pkg/_fe_analyzer_shared/benchmark/exhaustiveness/large_fields_call_counts.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,15 @@ void main() {
111111

112112
/// Test that [cases] are exhaustive over [type] if and only if all cases are
113113
/// included and that all subsets of the cases are not exhaustive.
114-
void expectExhaustiveOnlyAll(ObjectPropertyLookup objectFieldLookup,
115-
StaticType type, List<Map<String, Object>> cases) {
114+
void expectExhaustiveOnlyAll(
115+
ObjectPropertyLookup objectFieldLookup,
116+
StaticType type,
117+
List<Map<String, Object>> cases,
118+
) {
116119
var spaces = cases.map((c) => ty(type, c)).toList();
117120
profile.reset();
118121
print(
119-
isExhaustive(objectFieldLookup, Space(const Path.root(), type), spaces));
122+
isExhaustive(objectFieldLookup, Space(const Path.root(), type), spaces),
123+
);
120124
profile.log();
121125
}

pkg/_fe_analyzer_shared/benchmark/exhaustiveness/large_fields_timed.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ void main() {
110110

111111
/// Test that [cases] are exhaustive over [type] if and only if all cases are
112112
/// included and that all subsets of the cases are not exhaustive.
113-
void expectExhaustiveOnlyAll(ObjectPropertyLookup objectFieldLookup,
114-
StaticType type, List<Map<String, Object>> cases) {
113+
void expectExhaustiveOnlyAll(
114+
ObjectPropertyLookup objectFieldLookup,
115+
StaticType type,
116+
List<Map<String, Object>> cases,
117+
) {
115118
var valueSpace = Space(const Path.root(), type);
116119
var caseSpaces = cases.map((c) => ty(type, c)).toList();
117120

pkg/_fe_analyzer_shared/benchmark/exhaustiveness/large_subtype_count.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,17 @@ void testFieldCount(int n) {
8888
expectExhaustive('Field count $n', env, t, [fields]);
8989
}
9090

91-
void expectExhaustive(String title, ObjectPropertyLookup objectFieldLookup,
92-
StaticType type, List<Map<String, Object>> cases) {
91+
void expectExhaustive(
92+
String title,
93+
ObjectPropertyLookup objectFieldLookup,
94+
StaticType type,
95+
List<Map<String, Object>> cases,
96+
) {
9397
var spaces = cases.map((c) => ty(type, c)).toList();
9498
profile.reset();
9599
print(
96-
isExhaustive(objectFieldLookup, Space(const Path.root(), type), spaces));
100+
isExhaustive(objectFieldLookup, Space(const Path.root(), type), spaces),
101+
);
97102
print('--------------------------------------------------------------------');
98103
print(title);
99104
profile.log();

pkg/_fe_analyzer_shared/lib/src/base/errors.dart

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ abstract class DiagnosticCode {
6666
required this.name,
6767
required String problemMessage,
6868
required this.uniqueName,
69-
}) : _correctionMessage = correctionMessage,
70-
_problemMessage = problemMessage;
69+
}) : _correctionMessage = correctionMessage,
70+
_problemMessage = problemMessage;
7171

7272
/**
7373
* The template used to create the correction to be displayed for this error,
@@ -99,7 +99,7 @@ abstract class DiagnosticCode {
9999
String? correctionMessage = _correctionMessage;
100100
for (String s in [
101101
_problemMessage,
102-
if (correctionMessage != null) correctionMessage
102+
if (correctionMessage != null) correctionMessage,
103103
]) {
104104
for (RegExpMatch match in _positionalArgumentRegExp.allMatches(s)) {
105105
result = max(result, int.parse(match.group(1)!) + 1);
@@ -145,33 +145,49 @@ class DiagnosticSeverity implements Comparable<DiagnosticSeverity> {
145145
* The severity representing a non-error. This is never used for any error
146146
* code, but is useful for clients.
147147
*/
148-
static const DiagnosticSeverity NONE =
149-
const DiagnosticSeverity('NONE', 0, " ", "none");
148+
static const DiagnosticSeverity NONE = const DiagnosticSeverity(
149+
'NONE',
150+
0,
151+
" ",
152+
"none",
153+
);
150154

151155
/**
152156
* The severity representing an informational level analysis issue.
153157
*/
154-
static const DiagnosticSeverity INFO =
155-
const DiagnosticSeverity('INFO', 1, "I", "info");
158+
static const DiagnosticSeverity INFO = const DiagnosticSeverity(
159+
'INFO',
160+
1,
161+
"I",
162+
"info",
163+
);
156164

157165
/**
158166
* The severity representing a warning. Warnings can become errors if the
159167
* `-Werror` command line flag is specified.
160168
*/
161-
static const DiagnosticSeverity WARNING =
162-
const DiagnosticSeverity('WARNING', 2, "W", "warning");
169+
static const DiagnosticSeverity WARNING = const DiagnosticSeverity(
170+
'WARNING',
171+
2,
172+
"W",
173+
"warning",
174+
);
163175

164176
/**
165177
* The severity representing an error.
166178
*/
167-
static const DiagnosticSeverity ERROR =
168-
const DiagnosticSeverity('ERROR', 3, "E", "error");
179+
static const DiagnosticSeverity ERROR = const DiagnosticSeverity(
180+
'ERROR',
181+
3,
182+
"E",
183+
"error",
184+
);
169185

170186
static const List<DiagnosticSeverity> values = const [
171187
NONE,
172188
INFO,
173189
WARNING,
174-
ERROR
190+
ERROR,
175191
];
176192

177193
final String name;
@@ -189,7 +205,11 @@ class DiagnosticSeverity implements Comparable<DiagnosticSeverity> {
189205
final String displayName;
190206

191207
const DiagnosticSeverity(
192-
this.name, this.ordinal, this.machineCode, this.displayName);
208+
this.name,
209+
this.ordinal,
210+
this.machineCode,
211+
this.displayName,
212+
);
193213

194214
@override
195215
int get hashCode => ordinal;
@@ -219,53 +239,74 @@ class DiagnosticType implements Comparable<DiagnosticType> {
219239
/**
220240
* Task (todo) comments in user code.
221241
*/
222-
static const DiagnosticType TODO =
223-
const DiagnosticType('TODO', 0, DiagnosticSeverity.INFO);
242+
static const DiagnosticType TODO = const DiagnosticType(
243+
'TODO',
244+
0,
245+
DiagnosticSeverity.INFO,
246+
);
224247

225248
/**
226249
* Extra analysis run over the code to follow best practices, which are not in
227250
* the Dart Language Specification.
228251
*/
229-
static const DiagnosticType HINT =
230-
const DiagnosticType('HINT', 1, DiagnosticSeverity.INFO);
252+
static const DiagnosticType HINT = const DiagnosticType(
253+
'HINT',
254+
1,
255+
DiagnosticSeverity.INFO,
256+
);
231257

232258
/**
233259
* Compile-time errors are errors that preclude execution. A compile time
234260
* error must be reported by a Dart compiler before the erroneous code is
235261
* executed.
236262
*/
237-
static const DiagnosticType COMPILE_TIME_ERROR =
238-
const DiagnosticType('COMPILE_TIME_ERROR', 2, DiagnosticSeverity.ERROR);
263+
static const DiagnosticType COMPILE_TIME_ERROR = const DiagnosticType(
264+
'COMPILE_TIME_ERROR',
265+
2,
266+
DiagnosticSeverity.ERROR,
267+
);
239268

240269
/**
241270
* Checked mode compile-time errors are errors that preclude execution in
242271
* checked mode.
243272
*/
244273
static const DiagnosticType CHECKED_MODE_COMPILE_TIME_ERROR =
245274
const DiagnosticType(
246-
'CHECKED_MODE_COMPILE_TIME_ERROR', 3, DiagnosticSeverity.ERROR);
275+
'CHECKED_MODE_COMPILE_TIME_ERROR',
276+
3,
277+
DiagnosticSeverity.ERROR,
278+
);
247279

248280
/**
249281
* Static warnings are those warnings reported by the static checker. They
250282
* have no effect on execution. Static warnings must be provided by Dart
251283
* compilers used during development.
252284
*/
253-
static const DiagnosticType STATIC_WARNING =
254-
const DiagnosticType('STATIC_WARNING', 4, DiagnosticSeverity.WARNING);
285+
static const DiagnosticType STATIC_WARNING = const DiagnosticType(
286+
'STATIC_WARNING',
287+
4,
288+
DiagnosticSeverity.WARNING,
289+
);
255290

256291
/**
257292
* Syntactic errors are errors produced as a result of input that does not
258293
* conform to the grammar.
259294
*/
260-
static const DiagnosticType SYNTACTIC_ERROR =
261-
const DiagnosticType('SYNTACTIC_ERROR', 6, DiagnosticSeverity.ERROR);
295+
static const DiagnosticType SYNTACTIC_ERROR = const DiagnosticType(
296+
'SYNTACTIC_ERROR',
297+
6,
298+
DiagnosticSeverity.ERROR,
299+
);
262300

263301
/**
264302
* Lint warnings describe style and best practice recommendations that can be
265303
* used to formalize a project's style guidelines.
266304
*/
267-
static const DiagnosticType LINT =
268-
const DiagnosticType('LINT', 7, DiagnosticSeverity.INFO);
305+
static const DiagnosticType LINT = const DiagnosticType(
306+
'LINT',
307+
7,
308+
DiagnosticSeverity.INFO,
309+
);
269310

270311
static const List<DiagnosticType> values = const [
271312
TODO,

pkg/_fe_analyzer_shared/lib/src/base/syntactic_entity.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import 'package:_fe_analyzer_shared/src/base/analyzer_public_api.dart';
99
* which has a location and extent in the source file.
1010
*/
1111
@AnalyzerPublicApi(
12-
message: 'exported by package:analyzer/dart/ast/syntactic_entity.dart')
12+
message: 'exported by package:analyzer/dart/ast/syntactic_entity.dart',
13+
)
1314
abstract class SyntacticEntity {
1415
/**
1516
* Return the offset from the beginning of the file to the character after the

pkg/_fe_analyzer_shared/lib/src/deferred_function_literal_heuristic.dart

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ import 'package:_fe_analyzer_shared/src/util/dependency_walker.dart';
1111
/// https://github.com/dart-lang/language/issues/731 (improved inference for
1212
/// fold etc.) to choose the proper order in which to recursively analyze
1313
/// function literals passed as invocation arguments.
14-
abstract class FunctionLiteralDependencies<TypeVariable, ParamInfo,
15-
DeferredParamInfo extends ParamInfo> {
14+
abstract class FunctionLiteralDependencies<
15+
TypeVariable,
16+
ParamInfo,
17+
DeferredParamInfo extends ParamInfo
18+
> {
1619
final List<_Node<ParamInfo>> _paramNodes = [];
1720

1821
/// Construct a [FunctionLiteralDependencies] object that's prepared to
@@ -22,15 +25,18 @@ abstract class FunctionLiteralDependencies<TypeVariable, ParamInfo,
2225
/// [unDeferredParams] should contain information about any parameters
2326
/// corresponding to arguments that have already been type inferred.
2427
FunctionLiteralDependencies(
25-
Iterable<DeferredParamInfo> deferredParams,
26-
Iterable<TypeVariable> typeVariables,
27-
Iterable<ParamInfo> unDeferredParams) {
28+
Iterable<DeferredParamInfo> deferredParams,
29+
Iterable<TypeVariable> typeVariables,
30+
Iterable<ParamInfo> unDeferredParams,
31+
) {
2832
Map<TypeVariable, Set<_Node<ParamInfo>>> paramsDependingOnTypeVar = {};
2933
Map<TypeVariable, Set<_Node<ParamInfo>>> paramsConstrainingTypeVar = {};
3034
int deferredParamIndex = 0;
3135
for (DeferredParamInfo param in deferredParams) {
32-
_Node<ParamInfo> paramNode =
33-
new _Node<ParamInfo>(param, deferredParamIndex: deferredParamIndex++);
36+
_Node<ParamInfo> paramNode = new _Node<ParamInfo>(
37+
param,
38+
deferredParamIndex: deferredParamIndex++,
39+
);
3440
_paramNodes.add(paramNode);
3541
for (TypeVariable v in typeVarsFreeInParamParams(param)) {
3642
(paramsDependingOnTypeVar[v] ??= {}).add(paramNode);
@@ -40,8 +46,10 @@ abstract class FunctionLiteralDependencies<TypeVariable, ParamInfo,
4046
}
4147
}
4248
for (ParamInfo param in unDeferredParams) {
43-
_Node<ParamInfo> paramNode =
44-
new _Node<ParamInfo>(param, deferredParamIndex: null);
49+
_Node<ParamInfo> paramNode = new _Node<ParamInfo>(
50+
param,
51+
deferredParamIndex: null,
52+
);
4553
_paramNodes.add(paramNode);
4654
// Note: for un-deferred parameters, we only care about
4755
// typeVarsFreeInParamReturns, because these parameters have already been
@@ -53,8 +61,9 @@ abstract class FunctionLiteralDependencies<TypeVariable, ParamInfo,
5361
for (TypeVariable typeVariable in typeVariables) {
5462
for (_Node<ParamInfo> paramNode
5563
in paramsDependingOnTypeVar[typeVariable] ?? const {}) {
56-
paramNode.dependencies
57-
.addAll(paramsConstrainingTypeVar[typeVariable] ?? const {});
64+
paramNode.dependencies.addAll(
65+
paramsConstrainingTypeVar[typeVariable] ?? const {},
66+
);
5867
}
5968
}
6069
}
@@ -93,8 +102,8 @@ abstract class FunctionLiteralDependencies<TypeVariable, ParamInfo,
93102
for (List<_Node<ParamInfo>> stage in walker.reconciliationStages)
94103
[
95104
for (_Node<ParamInfo> node in _sortStage(stage))
96-
node.param as DeferredParamInfo
97-
]
105+
node.param as DeferredParamInfo,
106+
],
98107
];
99108
}
100109

pkg/_fe_analyzer_shared/lib/src/exhaustiveness/dart_template_buffer.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
///
1414
/// Clients who do not need the additional semantic information may obtain the
1515
/// final string immediately using [SimpleDartBuffer].
16-
abstract class DartTemplateBuffer<ConstantValue extends Object,
17-
EnumValue extends Object, Type extends Object> {
16+
abstract class DartTemplateBuffer<
17+
ConstantValue extends Object,
18+
EnumValue extends Object,
19+
Type extends Object
20+
> {
1821
/// Adds a text string to the buffer.
1922
void write(String text);
2023

0 commit comments

Comments
 (0)