Skip to content

Commit

Permalink
Merge pull request #65 from Workiva/analyzer_5
Browse files Browse the repository at this point in the history
Update to analyzer 5
  • Loading branch information
rmconsole6-wk authored Sep 5, 2023
2 parents 3e53f89 + 0a96123 commit 0261e9b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
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

0 comments on commit 0261e9b

Please sign in to comment.