From 62269bf588ba493907924afeeaf5ea1549ab4cce Mon Sep 17 00:00:00 2001 From: eggnstone Date: Fri, 19 Jul 2024 12:44:44 +0200 Subject: [PATCH] Fixed VariableDeclarationList with annotation. --- .../Formatters/VariableDeclarationListFormatter.dart | 1 + .../VariableDeclarationListFormatter_test.dart | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/src/Formatters/VariableDeclarationListFormatter.dart b/lib/src/Formatters/VariableDeclarationListFormatter.dart index 88e975d..5a86e03 100644 --- a/lib/src/Formatters/VariableDeclarationListFormatter.dart +++ b/lib/src/Formatters/VariableDeclarationListFormatter.dart @@ -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'); diff --git a/test/Formatters/VariableDeclarationListFormatter_test.dart b/test/Formatters/VariableDeclarationListFormatter_test.dart index f266a6b..4861417 100644 --- a/test/Formatters/VariableDeclarationListFormatter_test.dart +++ b/test/Formatters/VariableDeclarationListFormatter_test.dart @@ -21,6 +21,18 @@ void main() TestVisitor(19, 'int'), TestVisitor(23, 'i = 0') ] + ), + TestGroupConfig( + inputNodeCreator: AstCreator.createVariableDeclarationListInFunction, + inputLeading: 'void f(){', + inputMiddle: '@a bool b', + inputTrailing: ';}', + name: 'VariableDeclarationList @a bool b', + astVisitors: >[ + TestVisitor(9, '@a'), + TestVisitor(12, 'bool'), + TestVisitor(17, 'b') + ] ) ];