Skip to content

Commit 44e67b1

Browse files
scheglovCommit Queue
authored andcommitted
[analyzer] Update SDK constraint to ^3.9.0, format.
Change-Id: I79fe556112b6b9e471b043bf668677c9654b80d7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447004 Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 010b696 commit 44e67b1

File tree

211 files changed

+4429
-4989
lines changed

Some content is hidden

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

211 files changed

+4429
-4989
lines changed

pkg/analyzer/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 8.2.0-dev
2+
* Updated SDK constraint to `^3.9.0`.
23
* Deprecate `Diagnostic.data`. Instead, please use an expando to attach data to
34
the `Diagnostic` object.
45
* Deprecate `CatchClauseParameter.declaredElement` and `CatchClauseParameter.declaredElement2`.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ final class GitPluginSource implements PluginSource {
8888

8989
@override
9090
String toYaml({required String name}) {
91-
var buffer =
92-
StringBuffer()
93-
..writeln(' $name:')
94-
..writeln(' git:')
95-
..writeln(' url: $_url');
91+
var buffer = StringBuffer()
92+
..writeln(' $name:')
93+
..writeln(' git:')
94+
..writeln(' url: $_url');
9695
if (_ref != null) {
9796
buffer.writeln(' ref: $_ref');
9897
}
@@ -109,7 +108,8 @@ final class PathPluginSource implements PluginSource {
109108
PathPluginSource({required String path}) : _path = path;
110109

111110
@override
112-
String toYaml({required String name}) => '''
111+
String toYaml({required String name}) =>
112+
'''
113113
$name:
114114
path: $_path
115115
''';

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ ParseStringResult parseString({
8484
var source = StringSource(content, path ?? '');
8585
var reader = CharSequenceReader(content);
8686
var diagnosticCollector = RecordingDiagnosticListener();
87-
var scanner = Scanner(source, reader, diagnosticCollector)..configureFeatures(
88-
featureSetForOverriding: featureSet,
89-
featureSet: featureSet,
90-
);
87+
var scanner = Scanner(source, reader, diagnosticCollector)
88+
..configureFeatures(
89+
featureSetForOverriding: featureSet,
90+
featureSet: featureSet,
91+
);
9192
var token = scanner.tokenize();
9293
var languageVersion = LibraryLanguageVersion(
9394
package: ExperimentStatus.currentVersion,

pkg/analyzer/lib/file_system/memory_file_system.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ class MemoryResourceProvider implements ResourceProvider {
3939
MemoryResourceProvider({
4040
pathos.Context? context,
4141
this.delayWatcherInitialization,
42-
}) : _pathContext =
43-
context ??=
44-
pathos.style == pathos.Style.windows
45-
// On Windows, ensure that the current drive matches
46-
// the drive inserted by ResourceProvider.convertPath
47-
// so that packages are mapped to the correct drive
48-
? pathos.Context(current: 'C:\\')
49-
: pathos.context;
42+
}) : _pathContext = context ??= pathos.style == pathos.Style.windows
43+
// On Windows, ensure that the current drive matches
44+
// the drive inserted by ResourceProvider.convertPath
45+
// so that packages are mapped to the correct drive
46+
? pathos.Context(current: 'C:\\')
47+
: pathos.context;
5048

5149
@override
5250
pathos.Context get pathContext => _pathContext;

pkg/analyzer/lib/file_system/physical_file_system.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,11 @@ class _PhysicalFolder extends _PhysicalResource implements Folder {
311311
var watcher = DirectoryWatcher(_entry.path);
312312
var events = watcher.events.handleError(
313313
(Object error) {},
314-
test:
315-
(error) =>
316-
error is io.FileSystemException &&
317-
// Don't suppress "Directory watcher closed," so the outer
318-
// listener can see the interruption & act on it.
319-
!error.message.startsWith(
320-
"Directory watcher closed unexpectedly",
321-
),
314+
test: (error) =>
315+
error is io.FileSystemException &&
316+
// Don't suppress "Directory watcher closed," so the outer
317+
// listener can see the interruption & act on it.
318+
!error.message.startsWith("Directory watcher closed unexpectedly"),
322319
);
323320
return ResourceWatcher(
324321
events.transform(_exceptionTransformer),

pkg/analyzer/lib/instrumentation/log_adapter.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ class InstrumentationLogAdapter implements InstrumentationService {
7070
Object exception,
7171
StackTrace stackTrace,
7272
) {
73-
String timeStamp =
74-
time == null ? 'null' : time.millisecondsSinceEpoch.toString();
73+
String timeStamp = time == null
74+
? 'null'
75+
: time.millisecondsSinceEpoch.toString();
7576
String exceptionText = exception.toString();
7677
String stackTraceText = stackTrace.toString();
7778
_instrumentationLogger.log(

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,9 @@ class CodeStyleOptionsImpl implements CodeStyleOptions {
9999
bool _isLintEnabled(String name) => options.isLintEnabled(name);
100100

101101
/// Returns the preferred lint quote, otherwise `null`.
102-
String? _lintQuote() =>
103-
_isLintEnabled('prefer_single_quotes')
104-
? "'"
105-
: _isLintEnabled('prefer_double_quotes')
106-
? '"'
107-
: null;
102+
String? _lintQuote() => _isLintEnabled('prefer_single_quotes')
103+
? "'"
104+
: _isLintEnabled('prefer_double_quotes')
105+
? '"'
106+
: null;
108107
}

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -331,19 +331,19 @@ class _AnalyzerTopLevelOptionsValidator extends _TopLevelOptionValidator {
331331
/// values in the section, and whether each value is a valid string.
332332
class _CannotIgnoreOptionValidator extends OptionsValidator {
333333
/// Lazily populated set of diagnostic code names.
334-
static final Set<String> _diagnosticCodes =
335-
diagnosticCodeValues.map((DiagnosticCode code) => code.name).toSet();
334+
static final Set<String> _diagnosticCodes = diagnosticCodeValues
335+
.map((DiagnosticCode code) => code.name)
336+
.toSet();
336337

337338
/// The diagnostic code names that existed, but were removed.
338339
/// We don't want to report these, this breaks clients.
339340
// TODO(scheglov): https://github.com/flutter/flutter/issues/141576
340341
static const Set<String> _removedDiagnosticCodes = {'MISSING_RETURN'};
341342

342343
/// Lazily populated set of lint code names.
343-
late final Set<String> _lintCodes =
344-
Registry.ruleRegistry.rules
345-
.map((rule) => rule.name.toUpperCase())
346-
.toSet();
344+
late final Set<String> _lintCodes = Registry.ruleRegistry.rules
345+
.map((rule) => rule.name.toUpperCase())
346+
.toSet();
347347

348348
@override
349349
void validate(DiagnosticReporter reporter, YamlMap options) {
@@ -474,8 +474,9 @@ class _EnableExperimentsValidator extends OptionsValidator {
474474
AnalysisOptionsFile.enableExperiment,
475475
);
476476
if (experimentNames is YamlList) {
477-
var flags =
478-
experimentNames.nodes.map((node) => node.toString()).toList();
477+
var flags = experimentNames.nodes
478+
.map((node) => node.toString())
479+
.toList();
479480
for (var validationResult in validateFlags(flags)) {
480481
var flagIndex = validationResult.stringIndex;
481482
var span = experimentNames.nodes[flagIndex].span;
@@ -575,19 +576,19 @@ class _ErrorFilterOptionValidator extends OptionsValidator {
575576
legalValues.quotedAndCommaSeparatedWithAnd;
576577

577578
/// Lazily populated set of diagnostic code names.
578-
static final Set<String> _diagnosticCodes =
579-
diagnosticCodeValues.map((DiagnosticCode code) => code.name).toSet();
579+
static final Set<String> _diagnosticCodes = diagnosticCodeValues
580+
.map((DiagnosticCode code) => code.name)
581+
.toSet();
580582

581583
/// The diagnostic code names that existed, but were removed.
582584
/// We don't want to report these, this breaks clients.
583585
// TODO(scheglov): https://github.com/flutter/flutter/issues/141576
584586
static const Set<String> _removedDiagnosticCodes = {'MISSING_RETURN'};
585587

586588
/// Lazily populated set of lint code names.
587-
late final Set<String> _lintCodes =
588-
Registry.ruleRegistry.rules
589-
.map((rule) => rule.name.toUpperCase())
590-
.toSet();
589+
late final Set<String> _lintCodes = Registry.ruleRegistry.rules
590+
.map((rule) => rule.name.toUpperCase())
591+
.toSet();
591592

592593
@override
593594
void validate(DiagnosticReporter reporter, YamlMap options) {
@@ -1080,10 +1081,9 @@ class _TopLevelOptionValidator extends OptionsValidator {
10801081
_TopLevelOptionValidator(this.pluginName, this.supportedOptions)
10811082
: assert(supportedOptions.isNotEmpty),
10821083
_valueProposal = supportedOptions.quotedAndCommaSeparatedWithAnd,
1083-
_warningCode =
1084-
supportedOptions.length == 1
1085-
? AnalysisOptionsWarningCode.unsupportedOptionWithLegalValue
1086-
: AnalysisOptionsWarningCode.unsupportedOptionWithLegalValues;
1084+
_warningCode = supportedOptions.length == 1
1085+
? AnalysisOptionsWarningCode.unsupportedOptionWithLegalValue
1086+
: AnalysisOptionsWarningCode.unsupportedOptionWithLegalValues;
10871087

10881088
@override
10891089
void validate(DiagnosticReporter reporter, YamlMap options) {

pkg/analyzer/lib/src/analysis_rule/rule_context.dart

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,27 @@ final class RuleContextWithParsedResults implements RuleContext {
4444
bool get isInTestDirectory => false;
4545

4646
@override
47-
LibraryElement get libraryElement =>
48-
throw UnsupportedError(
49-
'RuleContext with parsed results does not include a LibraryElement',
50-
);
47+
LibraryElement get libraryElement => throw UnsupportedError(
48+
'RuleContext with parsed results does not include a LibraryElement',
49+
);
5150

5251
@override
5352
WorkspacePackage? get package => null;
5453

5554
@override
56-
TypeProvider get typeProvider =>
57-
throw UnsupportedError(
58-
'RuleContext with parsed results does not include a TypeProvider',
59-
);
55+
TypeProvider get typeProvider => throw UnsupportedError(
56+
'RuleContext with parsed results does not include a TypeProvider',
57+
);
6058

6159
@override
62-
TypeSystem get typeSystem =>
63-
throw UnsupportedError(
64-
'RuleContext with parsed results does not include a TypeSystem',
65-
);
60+
TypeSystem get typeSystem => throw UnsupportedError(
61+
'RuleContext with parsed results does not include a TypeSystem',
62+
);
6663

6764
@override
68-
bool isFeatureEnabled(Feature feature) =>
69-
throw UnsupportedError(
70-
'RuleContext with parsed results does not include a LibraryElement',
71-
);
65+
bool isFeatureEnabled(Feature feature) => throw UnsupportedError(
66+
'RuleContext with parsed results does not include a LibraryElement',
67+
);
7268
}
7369

7470
/// A [RuleContext] for a library, resolved into [ResolvedUnitResult]s.

pkg/analyzer/lib/src/clients/dart_style/rewrite_cascade.dart

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ ExpressionStatement fixCascadeByParenthesizingTarget({
1515
assert(cascadeExpression.cascadeSections.length == 1);
1616

1717
var newTarget = ParenthesizedExpressionImpl(
18-
leftParenthesis:
19-
Token(TokenType.OPEN_PAREN, 0)
20-
..previous = expressionStatement.beginToken.previous
21-
..next = cascadeExpression.target.beginToken,
18+
leftParenthesis: Token(TokenType.OPEN_PAREN, 0)
19+
..previous = expressionStatement.beginToken.previous
20+
..next = cascadeExpression.target.beginToken,
2221
expression: cascadeExpression.target,
23-
rightParenthesis:
24-
Token(TokenType.CLOSE_PAREN, 0)
25-
..previous = cascadeExpression.target.endToken
26-
..next = expressionStatement.semicolon,
22+
rightParenthesis: Token(TokenType.CLOSE_PAREN, 0)
23+
..previous = cascadeExpression.target.endToken
24+
..next = expressionStatement.semicolon,
2725
);
2826

2927
return ExpressionStatementImpl(
@@ -86,10 +84,9 @@ ExpressionImpl insertCascadeTargetIntoExpression({
8684
cascadeTarget: cascadeTarget,
8785
),
8886
// If we've reached the end, replace the `..` operator with `.`
89-
operator:
90-
expressionTarget == cascadeTarget
91-
? _synthesizeToken(TokenType.PERIOD, expression.operator!)
92-
: expression.operator,
87+
operator: expressionTarget == cascadeTarget
88+
? _synthesizeToken(TokenType.PERIOD, expression.operator!)
89+
: expression.operator,
9390
methodName: expression.methodName,
9491
typeArguments: expression.typeArguments,
9592
argumentList: expression.argumentList,
@@ -102,10 +99,9 @@ ExpressionImpl insertCascadeTargetIntoExpression({
10299
cascadeTarget: cascadeTarget,
103100
),
104101
// If we've reached the end, replace the `..` operator with `.`
105-
operator:
106-
expressionTarget == cascadeTarget
107-
? _synthesizeToken(TokenType.PERIOD, expression.operator)
108-
: expression.operator,
102+
operator: expressionTarget == cascadeTarget
103+
? _synthesizeToken(TokenType.PERIOD, expression.operator)
104+
: expression.operator,
109105
propertyName: expression.propertyName,
110106
);
111107
}

0 commit comments

Comments
 (0)