diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index fe7793e8b31..e48f0eec1bc 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,7 @@ +## 10.0.1 + +* Requires `analyzer 5.13.0` and replaces use of deprecated APIs. + ## 10.0.0 * [swift] Avoids using `Any` to represent `Optional` in Swift. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 7508c566d77..f7b0fc0a9f7 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -11,7 +11,7 @@ import 'ast.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '10.0.0'; +const String pigeonVersion = '10.0.1'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart index 1ef6e8a900b..09ea9133adc 100644 --- a/packages/pigeon/lib/pigeon_lib.dart +++ b/packages/pigeon/lib/pigeon_lib.dart @@ -1004,10 +1004,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { final dart_ast.NamedType? namedType = getFirstChildOfType(parameter); if (namedType != null) { - // TODO(stuartmorgan): Replace `name` when adopting the next version of - // analyzer. - // ignore: deprecated_member_use - final String argTypeBaseName = namedType.name.name; + final String argTypeBaseName = _getNamedTypeQualifiedName(namedType); final bool isNullable = namedType.question != null; final List argTypeArguments = typeAnnotationsToTypeArguments(namedType.typeArguments); @@ -1089,10 +1086,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { Method( name: node.name.lexeme, returnType: TypeDeclaration( - // TODO(stuartmorgan): Replace `name` when adopting the next - // version of analyzer. - // ignore: deprecated_member_use - baseName: returnType.name.name, + baseName: _getNamedTypeQualifiedName(returnType), typeArguments: typeAnnotationsToTypeArguments(returnType.typeArguments), isNullable: returnType.question != null), @@ -1141,10 +1135,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { for (final Object x in typeArguments.childEntities) { if (x is dart_ast.NamedType) { result.add(TypeDeclaration( - // TODO(stuartmorgan): Replace `name` when adopting the next - // version of analyzer. - // ignore: deprecated_member_use - baseName: x.name.name, + baseName: _getNamedTypeQualifiedName(x), isNullable: x.question != null, typeArguments: typeAnnotationsToTypeArguments(x.typeArguments))); } @@ -1174,10 +1165,7 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { final dart_ast.TypeArgumentList? typeArguments = type.typeArguments; _currentClass!.fields.add(NamedType( type: TypeDeclaration( - // TODO(stuartmorgan): Replace `name` when adopting the next - // version of analyzer. - // ignore: deprecated_member_use - baseName: type.name.name, + baseName: _getNamedTypeQualifiedName(type), isNullable: type.question != null, typeArguments: typeAnnotationsToTypeArguments(typeArguments), ), @@ -1223,6 +1211,14 @@ class _RootBuilder extends dart_ast_visitor.RecursiveAstVisitor { node.visitChildren(this); return null; } + + static String _getNamedTypeQualifiedName(dart_ast.NamedType node) { + final dart_ast.ImportPrefixReference? importPrefix = node.importPrefix; + if (importPrefix != null) { + return '${importPrefix.name.lexeme}.${node.name2.lexeme}'; + } + return node.name2.lexeme; + } } int? _calculateLineNumberNullable(String contents, int? offset) { diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 26b6465413c..a4284b0b498 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,13 +2,13 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon -version: 10.0.0 # This must match the version in lib/generator_tools.dart +version: 10.0.1 # This must match the version in lib/generator_tools.dart environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=2.19.0 <4.0.0" dependencies: - analyzer: "^5.2.0" + analyzer: "^5.13.0" args: ^2.1.0 collection: ^1.15.0 meta: ^1.7.0