Skip to content

Commit

Permalink
Fixed VariableDeclarationList with annotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
eggnstone committed Jul 19, 2024
1 parent 5787c85 commit 62269bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/Formatters/VariableDeclarationListFormatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class VariableDeclarationListFormatter extends IFormatter
if (node is! VariableDeclarationList)
throw FormatException('Not a VariableDeclarationList: ${node.runtimeType}');

formatState.acceptList(node.metadata, astVisitor, '$methodName/node.metadata');
formatState.copyEntity(node.lateKeyword, astVisitor, '$methodName/node.lateKeyword');
formatState.copyEntity(node.keyword, astVisitor, '$methodName/node.keyword');
formatState.copyEntity(node.type, astVisitor, '$methodName/node.type');
Expand Down
12 changes: 12 additions & 0 deletions test/Formatters/VariableDeclarationListFormatter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ void main()
TestVisitor<NamedType>(19, 'int'),
TestVisitor<VariableDeclaration>(23, 'i = 0')
]
),
TestGroupConfig(
inputNodeCreator: AstCreator.createVariableDeclarationListInFunction,
inputLeading: 'void f(){',
inputMiddle: '@a bool b',
inputTrailing: ';}',
name: 'VariableDeclarationList @a bool b',
astVisitors: <TestVisitor<void>>[
TestVisitor<Annotation>(9, '@a'),
TestVisitor<NamedType>(12, 'bool'),
TestVisitor<VariableDeclaration>(17, 'b')
]
)
];

Expand Down

0 comments on commit 62269bf

Please sign in to comment.