Skip to content

Commit

Permalink
Replace libdparse with DMD in UselessInitializerChecker (#121)
Browse files Browse the repository at this point in the history
* Replace libdparse with DMD in UselessInitializerChecker

* Address feedback
  • Loading branch information
Vladiwostok authored Aug 12, 2024
1 parent dffbf3a commit 655fc46
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 275 deletions.
10 changes: 6 additions & 4 deletions src/dscanner/analysis/run.d
Original file line number Diff line number Diff line change
Expand Up @@ -850,10 +850,6 @@ private BaseAnalyzer[] getAnalyzersForModuleAndConfig(string fileName,
checks ~= new VcallCtorChecker(args.setSkipTests(
analysisConfig.vcall_in_ctor == Check.skipTests && !ut));

if (moduleName.shouldRun!UselessInitializerChecker(analysisConfig))
checks ~= new UselessInitializerChecker(args.setSkipTests(
analysisConfig.useless_initializer == Check.skipTests && !ut));

if (moduleName.shouldRun!AllManCheck(analysisConfig))
checks ~= new AllManCheck(args.setSkipTests(
analysisConfig.allman_braces_check == Check.skipTests && !ut));
Expand Down Expand Up @@ -1358,6 +1354,12 @@ MessageSet analyzeDmd(string fileName, ASTCodegen.Module m, const char[] moduleN
config.body_on_disabled_func_check == Check.skipTests && !ut
);

if (moduleName.shouldRunDmd!(UselessInitializerChecker!ASTCodegen)(config))
visitors ~= new UselessInitializerChecker!ASTCodegen(
fileName,
config.useless_initializer == Check.skipTests && !ut
);

foreach (visitor; visitors)
{
m.accept(visitor);
Expand Down
Loading

0 comments on commit 655fc46

Please sign in to comment.