Skip to content

Commit

Permalink
Update to analyzer 5
Browse files Browse the repository at this point in the history
  • Loading branch information
robbecker-wf committed Sep 5, 2023
1 parent 3e53f89 commit 7a302d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
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

0 comments on commit 7a302d0

Please sign in to comment.