mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-04-26 21:30:14 +03:00
Remove dead code
This commit is contained in:
parent
77553e746e
commit
9665d644d5
2 changed files with 1 additions and 114 deletions
|
@ -6,7 +6,7 @@ import std.file : exists, remove;
|
|||
import std.functional : toDelegate;
|
||||
import std.stdio;
|
||||
|
||||
import dscanner.analysis.base : AutoFix, AutoFixFormatting, BaseAnalyzer, BaseAnalyzerDmd, Message;
|
||||
import dscanner.analysis.base : AutoFix, AutoFixFormatting, BaseAnalyzerDmd, Message;
|
||||
import dscanner.analysis.config : StaticAnalysisConfig;
|
||||
import dscanner.analysis.run : analyze, doNothing;
|
||||
import dscanner.analysis.rundmd;
|
||||
|
|
|
@ -2,7 +2,6 @@ module dscanner.analysis.base;
|
|||
|
||||
import dparse.ast;
|
||||
import dparse.lexer : IdType, str, Token, tok;
|
||||
import dsymbol.scope_ : Scope;
|
||||
import std.array;
|
||||
import std.container;
|
||||
import std.meta : AliasSeq;
|
||||
|
@ -320,118 +319,6 @@ mixin template AnalyzerInfo(string checkName)
|
|||
}
|
||||
}
|
||||
|
||||
struct BaseAnalyzerArguments
|
||||
{
|
||||
string fileName;
|
||||
const(Token)[] tokens;
|
||||
const Scope* sc;
|
||||
bool skipTests = false;
|
||||
|
||||
BaseAnalyzerArguments setSkipTests(bool v)
|
||||
{
|
||||
auto ret = this;
|
||||
ret.skipTests = v;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class BaseAnalyzer : ASTVisitor
|
||||
{
|
||||
public:
|
||||
deprecated("Don't use this constructor, use the one taking BaseAnalyzerArguments")
|
||||
this(string fileName, const Scope* sc, bool skipTests = false)
|
||||
{
|
||||
BaseAnalyzerArguments args = {
|
||||
fileName: fileName,
|
||||
sc: sc,
|
||||
skipTests: skipTests
|
||||
};
|
||||
this(args);
|
||||
}
|
||||
|
||||
this(BaseAnalyzerArguments args)
|
||||
{
|
||||
this.sc = args.sc;
|
||||
this.tokens = args.tokens;
|
||||
this.fileName = args.fileName;
|
||||
this.skipTests = args.skipTests;
|
||||
_messages = new MessageSet;
|
||||
}
|
||||
|
||||
string getName()
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
Message[] messages()
|
||||
{
|
||||
return _messages[].array;
|
||||
}
|
||||
|
||||
alias visit = ASTVisitor.visit;
|
||||
|
||||
/**
|
||||
* Visits a unittest.
|
||||
*
|
||||
* When overriden, the protected bool "skipTests" should be handled
|
||||
* so that the content of the test is not analyzed.
|
||||
*/
|
||||
override void visit(const Unittest unittest_)
|
||||
{
|
||||
if (!skipTests)
|
||||
unittest_.accept(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits a module declaration.
|
||||
*
|
||||
* When overriden, make sure to keep this structure
|
||||
*/
|
||||
override void visit(const(Module) mod)
|
||||
{
|
||||
mod.accept(this);
|
||||
}
|
||||
|
||||
AutoFix.CodeReplacement[] resolveAutoFix(
|
||||
const Module mod,
|
||||
scope const(Token)[] tokens,
|
||||
const AutoFix.ResolveContext context,
|
||||
const AutoFixFormatting formatting,
|
||||
)
|
||||
{
|
||||
cast(void) mod;
|
||||
cast(void) tokens;
|
||||
cast(void) context;
|
||||
cast(void) formatting;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
bool inAggregate;
|
||||
bool skipTests;
|
||||
const(Token)[] tokens;
|
||||
|
||||
template visitTemplate(T)
|
||||
{
|
||||
override void visit(const T structDec)
|
||||
{
|
||||
inAggregate = true;
|
||||
structDec.accept(this);
|
||||
inAggregate = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The file name
|
||||
*/
|
||||
string fileName;
|
||||
|
||||
const(Scope)* sc;
|
||||
|
||||
MessageSet _messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visitor that implements the AST traversal logic.
|
||||
* Supports collecting error messages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue