Skip to content

Commit

Permalink
Added "base class".
Browse files Browse the repository at this point in the history
  • Loading branch information
eggnstone committed Jul 18, 2024
1 parent 9628351 commit 905e7b1
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ pubspec.lock
# Manually added
/.idea/libraries/Dart_Packages.xml
/doc/
/test/Formatter/Playground.dart
/test/Sandbox.dart
1 change: 1 addition & 0 deletions lib/src/Formatters/ClassDeclarationFormatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ClassDeclarationFormatter extends IFormatter
//log('### NOT COPYING node.sortedCommentAndAnnotations', 0);

formatState.copyEntity(node.sealedKeyword, astVisitor, '$methodName/node.abstractKeyword');
formatState.copyEntity(node.baseKeyword, astVisitor, '$methodName/node.baseKeyword');
formatState.copyEntity(node.abstractKeyword, astVisitor, '$methodName/node.abstractKeyword');
formatState.copyEntity(node.mixinKeyword, astVisitor, '$methodName/node.mixinKeyword');
formatState.copyEntity(node.interfaceKeyword, astVisitor, '$methodName/node.interfaceKeyword');
Expand Down
9 changes: 9 additions & 0 deletions test/Formatters/ClassDeclarationFormatter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ void main()
TestConfig('@a sealed class C\n{\n}\n')
]
),
TestGroupConfig(
inputNodeCreator: AstCreator.createDeclaration,
inputMiddle: 'base class C{}',
name: 'ClassDeclaration / base class C{}',
testConfigs: <TestConfig>[
TestConfig.none(),
TestConfig('base class C\n{\n}\n')
]
),
TestGroupConfig(
inputNodeCreator: AstCreator.createDeclaration,
inputMiddle: 'abstract mixin class C{}',
Expand Down
2 changes: 1 addition & 1 deletion test/Formatters/SwitchExpressionFormatter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void main()
name: 'SwitchPatternCase',
astVisitors: <TestVisitor<void>>[
TestVisitor<IntegerLiteral>(22, '0'),
TestVisitor<SwitchExpressionCase>(25, '0=>0'),
TestVisitor<SwitchExpressionCase>(25, '0=>0')
],
testConfigs: <TestConfig>[
TestConfig.none(),
Expand Down
39 changes: 39 additions & 0 deletions test/Unsolved/Comma after closing brace.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
final Iterable<int> placeholderDigits = <int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map<int>(
(int n)
// ignore: prefer_expression_function_bodies
{
return 0;
}

);
/*
final Iterable<int> placeholderDigits = <int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map<int>(
(int n)
// ignore: prefer_expression_function_bodies
{
return 0;
},
);
*/

class C
{
final void Function() a;
final int b;

const C({required this.a, required this.b});
}

final C x = C(
a: ()
{
}
,
b: 0
);
/*
final x = C(
a: () {},
b: 0,
);
*/

0 comments on commit 905e7b1

Please sign in to comment.