Skip to content

Commit 93d2068

Browse files
authored
Require analyzer 6.5.0 and stop using deprecated nodes. (#1490)
* Require analyzer 6.5.0 and stop using deprecated nodes. * Update CHANGELOG.md * Replace SDK 3.0.0 with 3.4.0 in two places.
1 parent 5ddd749 commit 93d2068

File tree

6 files changed

+24
-28
lines changed

6 files changed

+24
-28
lines changed

.github/workflows/test-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
sdk: [3.0.0, dev]
23+
sdk: [3.4.0, dev]
2424
steps:
2525
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
2626
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30
@@ -50,7 +50,7 @@ jobs:
5050
matrix:
5151
# Add macos-latest and/or windows-latest if relevant for this package.
5252
os: [ubuntu-latest]
53-
sdk: [3.0.0, dev]
53+
sdk: [3.4.0, dev]
5454
steps:
5555
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
5656
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 2.3.7-wip
22

33
* Remove temporary work around for analyzer 6.2.0 from dart_style 2.3.6.
4+
* Require `package:analyzer` `>=6.5.0 <7.0.0`.
45

56
## 2.3.6
67

lib/src/front_end/ast_node_visitor.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,13 @@ class AstNodeVisitor extends ThrowingAstVisitor<void> with PieceFactory {
594594

595595
@override
596596
void visitExtensionDeclaration(ExtensionDeclaration node) {
597+
(Token, TypeAnnotation)? onType;
598+
if (node.onClause case var onClause?) {
599+
onType = (onClause.onKeyword, onClause.extendedType);
600+
}
601+
597602
writeType(node.metadata, [node.extensionKeyword], node.name,
598-
typeParameters: node.typeParameters,
599-
// TODO(rnystrom): Move to the new analyzer API after Dart 3.4 ships.
600-
// ignore: deprecated_member_use
601-
onType: (node.onKeyword, node.extendedType), body: () {
603+
typeParameters: node.typeParameters, onType: onType, body: () {
602604
return pieces.build(() {
603605
writeBody(node.leftBracket, node.members, node.rightBracket);
604606
});
@@ -1267,6 +1269,12 @@ class AstNodeVisitor extends ThrowingAstVisitor<void> with PieceFactory {
12671269
});
12681270
}
12691271

1272+
@override
1273+
void visitMixinOnClause(MixinOnClause node) {
1274+
throw UnsupportedError(
1275+
'This node is handled by PieceFactory.createType().');
1276+
}
1277+
12701278
@override
12711279
void visitNamedExpression(NamedExpression node) {
12721280
writeAssignment(node.name.label, node.name.colon, node.expression);
@@ -1332,14 +1340,6 @@ class AstNodeVisitor extends ThrowingAstVisitor<void> with PieceFactory {
13321340
pieces.add(builder.build());
13331341
}
13341342

1335-
@override
1336-
// TODO(rnystrom): Move to the new analyzer API after Dart 3.4 ships.
1337-
// ignore: deprecated_member_use
1338-
void visitOnClause(OnClause node) {
1339-
throw UnsupportedError(
1340-
'This node is handled by PieceFactory.createType().');
1341-
}
1342-
13431343
@override
13441344
void visitParenthesizedExpression(ParenthesizedExpression node) {
13451345
pieces.token(node.leftParenthesis);

lib/src/front_end/piece_factory.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,9 +1171,7 @@ mixin PieceFactory {
11711171
NamedType? superclass,
11721172
RepresentationDeclaration? representation,
11731173
ExtendsClause? extendsClause,
1174-
// TODO(rnystrom): Move to the new analyzer API after Dart 3.4 ships.
1175-
// ignore: deprecated_member_use
1176-
OnClause? onClause,
1174+
MixinOnClause? onClause,
11771175
WithClause? withClause,
11781176
ImplementsClause? implementsClause,
11791177
NativeClause? nativeClause,

lib/src/short/source_visitor.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,13 +1274,12 @@ class SourceVisitor extends ThrowingAstVisitor {
12741274
token(node.name, before: space);
12751275

12761276
visit(node.typeParameters);
1277-
soloSplit();
1278-
// TODO(rnystrom): Move to the new analyzer API after Dart 3.4 ships.
1279-
// ignore: deprecated_member_use
1280-
token(node.onKeyword);
1281-
space();
1282-
// ignore: deprecated_member_use
1283-
visit(node.extendedType);
1277+
if (node.onClause case var onClause?) {
1278+
soloSplit();
1279+
token(onClause.onKeyword);
1280+
space();
1281+
visit(onClause.extendedType);
1282+
}
12841283
space();
12851284
builder.unnest();
12861285
_visitBody(node.leftBracket, node.members, node.rightBracket);
@@ -2369,9 +2368,7 @@ class SourceVisitor extends ThrowingAstVisitor {
23692368
}
23702369

23712370
@override
2372-
// TODO(rnystrom): Move to the new analyzer API after Dart 3.4 ships.
2373-
// ignore: deprecated_member_use
2374-
void visitOnClause(OnClause node) {
2371+
void visitMixinOnClause(MixinOnClause node) {
23752372
_visitCombinator(node.onKeyword, node.superclassConstraints);
23762373
}
23772374

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ environment:
99
sdk: "^3.0.0"
1010

1111
dependencies:
12-
analyzer: '^6.3.0'
12+
analyzer: '^6.5.0'
1313
args: ">=1.0.0 <3.0.0"
1414
collection: "^1.17.0"
1515
path: ^1.0.0

0 commit comments

Comments
 (0)