Skip to content

Commit 3b6022d

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer_utilities: Bump language version to 3.9
Change-Id: I32d14d614018e6a9c4333173c46575352e68a45b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447281 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent a2491e4 commit 3b6022d

File tree

5 files changed

+31
-26
lines changed

5 files changed

+31
-26
lines changed

pkg/analyzer_utilities/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ linter:
2222
- unnecessary_library_directive
2323
- unnecessary_parenthesis
2424
- unreachable_from_main
25+
- use_null_aware_elements

pkg/analyzer_utilities/lib/tool/api.dart

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ class ApiDescription {
110110
var element = _potentiallyDanglingReferences.removeFirst();
111111
if (!_dumpedTopLevelElements.add(element)) continue;
112112
var containingLibraryUri = element.library!.uri;
113-
var childNode =
114-
Node<MemberSortKey>()..text.add(_uniqueNamer.name(element));
113+
var childNode = Node<MemberSortKey>()
114+
..text.add(_uniqueNamer.name(element));
115115
_dumpElement(element, childNode);
116-
(nodes[containingLibraryUri] ??=
117-
Node<MemberSortKey>()..text.add('$containingLibraryUri:'))
116+
(nodes[containingLibraryUri] ??= Node<MemberSortKey>()
117+
..text.add('$containingLibraryUri:'))
118118
.childNodes
119119
.add((MemberSortKey(element), childNode));
120120
}
@@ -424,8 +424,8 @@ class ApiDescription {
424424
var definedNames = library.exportNamespace.definedNames2;
425425
for (var key in definedNames.keys.sorted()) {
426426
var element = definedNames[key]!;
427-
var childNode =
428-
Node<MemberSortKey>()..text.add(_uniqueNamer.name(element));
427+
var childNode = Node<MemberSortKey>()
428+
..text.add(_uniqueNamer.name(element));
429429
if (!_dumpedTopLevelElements.add(element)) {
430430
childNode.text.add(' (see above)');
431431
} else {
@@ -512,16 +512,18 @@ class MemberSortKey implements Comparable<MemberSortKey> {
512512
InterfaceElement() => MemberCategory.interface,
513513
ExtensionElement() => MemberCategory.extension,
514514
TypeAliasElement() => MemberCategory.typeAlias,
515-
dynamic(:var runtimeType) =>
516-
throw UnimplementedError('Unexpected element: $runtimeType'),
515+
dynamic(:var runtimeType) => throw UnimplementedError(
516+
'Unexpected element: $runtimeType',
517+
),
517518
};
518519

519520
static bool _computeIsInstanceMember(Element element) =>
520521
element.enclosingElement is InstanceElement &&
521522
switch (element) {
522523
ExecutableElement(:var isStatic) => !isStatic,
523-
dynamic(:var runtimeType) =>
524-
throw UnimplementedError('Unexpected element: $runtimeType'),
524+
dynamic(:var runtimeType) => throw UnimplementedError(
525+
'Unexpected element: $runtimeType',
526+
),
525527
};
526528
}
527529

@@ -576,11 +578,10 @@ class UniqueName {
576578
}
577579

578580
@override
579-
String toString() =>
580-
[
581-
_nameHint,
582-
if (_disambiguator case var disambiguator?) '@$disambiguator',
583-
].join();
581+
String toString() => [
582+
_nameHint,
583+
if (_disambiguator case var disambiguator?) '@$disambiguator',
584+
].join();
584585
}
585586

586587
/// Manager of unique names for elements.
@@ -606,8 +607,9 @@ class UriSortKey implements Comparable<UriSortKey> {
606607
final String _uriString;
607608

608609
UriSortKey(Uri uri, String pkgName)
609-
: _category =
610-
uri.isIn(pkgName) ? UriCategory.inPackage : UriCategory.notInPackage,
610+
: _category = uri.isIn(pkgName)
611+
? UriCategory.inPackage
612+
: UriCategory.notInPackage,
611613
_uriString = uri.toString();
612614

613615
@override

pkg/analyzer_utilities/lib/tools.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ mixin CodeGenerator {
158158
void outputHeader({bool javaStyle = false, String? year}) {
159159
String header;
160160
if (codeGeneratorSettings.languageName == 'java') {
161-
header = '''
161+
header =
162+
'''
162163
/*
163164
* Copyright (c) ${year ?? '2019'}, the Dart project authors. Please see the AUTHORS file
164165
* for details. All rights reserved. Use of this source code is governed by a
@@ -168,7 +169,8 @@ mixin CodeGenerator {
168169
* To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
169170
*/''';
170171
} else if (codeGeneratorSettings.languageName == 'python') {
171-
header = '''
172+
header =
173+
'''
172174
# Copyright (c) ${year ?? '2014'}, the Dart project authors. Please see the AUTHORS file
173175
# for details. All rights reserved. Use of this source code is governed by a
174176
# BSD-style license that can be found in the LICENSE file.
@@ -178,7 +180,8 @@ mixin CodeGenerator {
178180
# "pkg/analysis_server/tool/spec/generate_files".
179181
''';
180182
} else {
181-
header = '''
183+
header =
184+
'''
182185
// Copyright (c) ${year ?? '2014'}, the Dart project authors. Please see the AUTHORS file
183186
// for details. All rights reserved. Use of this source code is governed by a
184187
// BSD-style license that can be found in the LICENSE file.

pkg/analyzer_utilities/lib/verify_tests.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ class VerifyTests {
3232
includedPaths: <String>[testDirPath],
3333
excludedPaths: excludedPaths,
3434
);
35-
var singleAnalysisContext =
36-
collection.contexts
37-
.where(analysisContextPredicate ?? (_) => true)
38-
.toList()
39-
.singleOrNull;
35+
var singleAnalysisContext = collection.contexts
36+
.where(analysisContextPredicate ?? (_) => true)
37+
.toList()
38+
.singleOrNull;
4039
if (singleAnalysisContext == null) {
4140
fail('The test directory contains multiple analysis contexts.');
4241
}

pkg/analyzer_utilities/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: analyzer_utilities
33
publish_to: none
44

55
environment:
6-
sdk: ^3.7.0
6+
sdk: ^3.9.0
77

88
resolution: workspace
99

0 commit comments

Comments
 (0)