11import 'package:analyzer/dart/ast/ast.dart' ;
22import 'package:analyzer/dart/ast/visitor.dart' ;
3+ import 'package:solid_lints/src/common/parameters/excluded_entities_list_parameter.dart' ;
34import 'package:solid_lints/src/common/parameters/excluded_identifiers_list_parameter.dart' ;
45import 'package:solid_lints/src/lints/prefer_match_file_name/models/declaration_token_info.dart' ;
56
@@ -10,7 +11,7 @@ class PreferMatchFileNameVisitor extends RecursiveAstVisitor<void> {
1011
1112 /// Iterable that contains the name of entity (or entities) that should
1213 /// be ignored
13- final Iterable < String > excludedEntities;
14+ final ExcludedEntitiesListParameters excludedEntities;
1415
1516 /// Constructor of [PreferMatchFileNameVisitor] class
1617 PreferMatchFileNameVisitor ({
@@ -26,28 +27,28 @@ class PreferMatchFileNameVisitor extends RecursiveAstVisitor<void> {
2627 (a, b) => _publicDeclarationsFirst (a, b) ?? _byDeclarationOrder (a, b),
2728 );
2829
29- bool _shouldIgnore (Declaration node) {
30- if (excludedEntities.isEmpty) return false ;
31-
32- if (node is ClassDeclaration && excludedEntities.contains ('class' )) {
33- return true ;
34- } else if (node is MixinDeclaration && excludedEntities.contains ('mixin' )) {
35- return true ;
36- } else if (node is EnumDeclaration && excludedEntities.contains ('enum' )) {
37- return true ;
38- } else if (node is ExtensionDeclaration &&
39- excludedEntities.contains ('extension' )) {
40- return true ;
41- }
42-
43- return false ;
44- }
30+ // bool _shouldIgnore(Declaration node) {
31+ // if (excludedEntities.isEmpty) return false;
32+ //
33+ // if (node is ClassDeclaration && excludedEntities.contains('class')) {
34+ // return true;
35+ // } else if (node is MixinDeclaration && excludedEntities.contains('mixin')) {
36+ // return true;
37+ // } else if (node is EnumDeclaration && excludedEntities.contains('enum')) {
38+ // return true;
39+ // } else if (node is ExtensionDeclaration &&
40+ // excludedEntities.contains('extension')) {
41+ // return true;
42+ // }
43+ //
44+ // return false;
45+ // }
4546
4647 @override
4748 void visitClassDeclaration (ClassDeclaration node) {
4849 super .visitClassDeclaration (node);
4950
50- if (_shouldIgnore (node)) return ;
51+ if (excludedEntities. shouldIgnoreEntity (node)) return ;
5152
5253 _declarations.add ((token: node.name, parent: node));
5354 }
@@ -56,7 +57,7 @@ class PreferMatchFileNameVisitor extends RecursiveAstVisitor<void> {
5657 void visitExtensionDeclaration (ExtensionDeclaration node) {
5758 super .visitExtensionDeclaration (node);
5859
59- if (_shouldIgnore (node)) return ;
60+ if (excludedEntities. shouldIgnoreEntity (node)) return ;
6061
6162 final name = node.name;
6263 if (name != null ) {
@@ -68,7 +69,7 @@ class PreferMatchFileNameVisitor extends RecursiveAstVisitor<void> {
6869 void visitMixinDeclaration (MixinDeclaration node) {
6970 super .visitMixinDeclaration (node);
7071
71- if (_shouldIgnore (node)) return ;
72+ if (excludedEntities. shouldIgnoreEntity (node)) return ;
7273
7374 _declarations.add ((token: node.name, parent: node));
7475 }
@@ -77,7 +78,7 @@ class PreferMatchFileNameVisitor extends RecursiveAstVisitor<void> {
7778 void visitEnumDeclaration (EnumDeclaration node) {
7879 super .visitEnumDeclaration (node);
7980
80- if (_shouldIgnore (node)) return ;
81+ if (excludedEntities. shouldIgnoreEntity (node)) return ;
8182
8283 _declarations.add ((token: node.name, parent: node));
8384 }
0 commit comments