Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to analyzer 5 #65

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dart_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: [ 2.13.4, 2.18.7, stable, beta ]
sdk: [ 2.18.7, 2.19.6, stable ]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
Expand Down
8 changes: 4 additions & 4 deletions lib/src/analyzer_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ String _copyFieldDeclaration(FieldDeclaration decl, String initializer) {
if (decl.staticKeyword != null) {
result = '${decl.staticKeyword} $result';
}
result = '$result ${decl.fields.variables.first.name.name}';
result = '$result ${decl.fields.variables.first.name.lexeme}';
if (initializer.isNotEmpty) {
result = '$result = $initializer;';
} else {
Expand All @@ -192,7 +192,7 @@ String _copyGetterDeclaration(MethodDeclaration decl, String body) {
result = 'static $result';
}

result = '$result ${decl.name.name}';
result = '$result ${decl.name.lexeme}';
if (decl.body.keyword != null) {
result = '$result ${decl.body.keyword}${decl.body.star ?? ''}';
}
Expand All @@ -205,12 +205,12 @@ String _copySetterDeclaration(MethodDeclaration decl, String body) {
if (decl.isStatic) {
result = 'static $result';
}
result = '$result ${decl.name.name}${decl.parameters} {\n$body\n }';
result = '$result ${decl.name.lexeme}${decl.parameters} {\n$body\n }';
return result;
}

String _copyMethodDeclaration(MethodDeclaration decl, String body) {
var result = '${decl.name.name}';
var result = '${decl.name.lexeme}';
if (decl.returnType != null) {
result = '${decl.returnType} $result';
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
analyzer: '>=2.0.0 <5.0.0'
analyzer: ^5.0.0
build: ^2.0.3
collection: ^1.15.0
path: ^1.8.0
Expand Down
6 changes: 3 additions & 3 deletions test/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TestAnnotation {
ConstructorDeclaration? getConstructor(ClassDeclaration classDecl,
{String? name}) {
for (var member in classDecl.members) {
if (member is ConstructorDeclaration && member.name?.name == name) {
if (member is ConstructorDeclaration && member.name?.lexeme == name) {
return member;
}
}
Expand All @@ -41,7 +41,7 @@ ConstructorDeclaration? getConstructor(ClassDeclaration classDecl,
FieldDeclaration? getFieldByName(ClassDeclaration classDecl, String name) {
for (var member in classDecl.members) {
if (member is FieldDeclaration &&
member.fields.variables.first.name.name == name) {
member.fields.variables.first.name.lexeme == name) {
return member;
}
}
Expand All @@ -50,7 +50,7 @@ FieldDeclaration? getFieldByName(ClassDeclaration classDecl, String name) {

MethodDeclaration? getMethodByName(ClassDeclaration classDecl, String name) {
for (var member in classDecl.members) {
if (member is MethodDeclaration && member.name.name == name) {
if (member is MethodDeclaration && member.name.lexeme == name) {
return member;
}
}
Expand Down
Loading