Skip to content

Commit f0b3441

Browse files
[pigeon] Update analyzer range to 8-9 (#10466)
Updates the compatible `analyze` versions from 6-8 to 8-9. Doing this now will help avoid future compatibility problems like we saw recently with the flutter/flutter Dart roll that was blocked by needing analyzer 8, which Pigeon only very recently supported. This drop 6-7 because it uses replacements for deprecated APIs that were introduced in 8.0, in order to allow 9.0 which removes the deprecated APIs. ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 8af0ee9 commit f0b3441

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

packages/pigeon/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 26.1.1
22

3+
* Updates supported `analyzer` versions to 8.x or 9.x.
34
* Updates minimum supported SDK version to Flutter 3.32/Dart 3.8.
45

56
## 26.1.0

packages/pigeon/lib/src/generator_tools.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'generator.dart';
1515
/// The current version of pigeon.
1616
///
1717
/// This must match the version in pubspec.yaml.
18-
const String pigeonVersion = '26.1.0';
18+
const String pigeonVersion = '26.1.1';
1919

2020
/// Read all the content from [stdin] to a String.
2121
String readStdin() {

packages/pigeon/lib/src/pigeon_lib.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:analyzer/dart/analysis/analysis_context_collection.dart'
1414
import 'package:analyzer/dart/analysis/results.dart' show ParsedUnitResult;
1515
import 'package:analyzer/dart/analysis/session.dart' show AnalysisSession;
1616
import 'package:analyzer/dart/ast/ast.dart' as dart_ast;
17-
import 'package:analyzer/error/error.dart' show AnalysisError;
17+
import 'package:analyzer/diagnostic/diagnostic.dart' show Diagnostic;
1818
import 'package:args/args.dart';
1919
import 'package:meta/meta.dart' show visibleForTesting;
2020
import 'package:path/path.dart' as path;
@@ -467,18 +467,18 @@ class Pigeon {
467467
final AnalysisSession session = context.currentSession;
468468
final ParsedUnitResult result =
469469
session.getParsedUnit(path) as ParsedUnitResult;
470-
if (result.errors.isEmpty) {
470+
if (result.diagnostics.isEmpty) {
471471
final dart_ast.CompilationUnit unit = result.unit;
472472
unit.accept(rootBuilder);
473473
} else {
474-
for (final AnalysisError error in result.errors) {
474+
for (final Diagnostic diagnostic in result.diagnostics) {
475475
compilationErrors.add(
476476
Error(
477-
message: error.message,
478-
filename: error.source.fullName,
477+
message: diagnostic.message,
478+
filename: diagnostic.source.fullName,
479479
lineNumber: calculateLineNumber(
480-
error.source.contents.data,
481-
error.offset,
480+
diagnostic.source.contents.data,
481+
diagnostic.offset,
482482
),
483483
),
484484
);

packages/pigeon/lib/src/pigeon_lib_internal.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
16561656
);
16571657
} else if (node.extendsClause != null) {
16581658
superClass = TypeDeclaration(
1659-
baseName: node.extendsClause!.superclass.name2.lexeme,
1659+
baseName: node.extendsClause!.superclass.name.lexeme,
16601660
isNullable: false,
16611661
);
16621662
}
@@ -1666,7 +1666,7 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
16661666
for (final dart_ast.NamedType type
16671667
in node.implementsClause!.interfaces) {
16681668
interfaces.add(
1669-
TypeDeclaration(baseName: type.name2.lexeme, isNullable: false),
1669+
TypeDeclaration(baseName: type.name.lexeme, isNullable: false),
16701670
);
16711671
}
16721672
}
@@ -1777,8 +1777,8 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
17771777
name: node.name.lexeme,
17781778
fields: <NamedType>[],
17791779
superClassName:
1780-
node.implementsClause?.interfaces.first.name2.toString() ??
1781-
node.extendsClause?.superclass.name2.toString(),
1780+
node.implementsClause?.interfaces.first.name.toString() ??
1781+
node.extendsClause?.superclass.name.toString(),
17821782
isSealed: node.sealedKeyword != null,
17831783
isSwiftClass: _hasMetadata(node.metadata, 'SwiftClass'),
17841784
documentationComments: _documentationCommentsParser(
@@ -2137,9 +2137,9 @@ class RootBuilder extends dart_ast_visitor.RecursiveAstVisitor<Object?> {
21372137
static String _getNamedTypeQualifiedName(dart_ast.NamedType node) {
21382138
final dart_ast.ImportPrefixReference? importPrefix = node.importPrefix;
21392139
if (importPrefix != null) {
2140-
return '${importPrefix.name.lexeme}.${node.name2.lexeme}';
2140+
return '${importPrefix.name.lexeme}.${node.name.lexeme}';
21412141
}
2142-
return node.name2.lexeme;
2142+
return node.name.lexeme;
21432143
}
21442144

21452145
void _addProxyApiField(

packages/pigeon/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: pigeon
22
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
33
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
5-
version: 26.1.0 # This must match the version in lib/src/generator_tools.dart
5+
version: 26.1.1 # This must match the version in lib/src/generator_tools.dart
66

77
environment:
88
sdk: ^3.8.0
99

1010
dependencies:
11-
analyzer: ">=6.0.0 <9.0.0"
11+
analyzer: ">=8.0.0 <10.0.0"
1212
args: ^2.1.0
1313
code_builder: ^4.10.0
1414
collection: ^1.15.0

0 commit comments

Comments
 (0)