Cleanup variable names, reduce unneeded operations
This commit is contained in:
parent
776e720d8f
commit
57c379d300
|
@ -105,60 +105,58 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
|
||||||
|
|
||||||
if (!settings->library.markupFile(FileName) // only check source files
|
if (!settings->library.markupFile(FileName) // only check source files
|
||||||
&& settings->library.isexporter(tok->str()) && tok->next() != 0) {
|
&& settings->library.isexporter(tok->str()) && tok->next() != 0) {
|
||||||
const Token * qPropToken = tok;
|
const Token * propToken = tok->next();
|
||||||
qPropToken = qPropToken->next();
|
while (propToken && propToken->str() != ")") {
|
||||||
while (qPropToken && qPropToken->str() != ")") {
|
if (settings->library.isexportedprefix(tok->str(), propToken->str())) {
|
||||||
if (settings->library.isexportedprefix(tok->str(), qPropToken->str())) {
|
const Token* nextPropToken = propToken->next();
|
||||||
const Token* qNextPropToken = qPropToken->next();
|
const std::string& value = nextPropToken->str();
|
||||||
const std::string& value = qNextPropToken->str();
|
|
||||||
if (_functions.find(value) != _functions.end()) {
|
if (_functions.find(value) != _functions.end()) {
|
||||||
_functions[value].usedOtherFile = true;
|
_functions[value].usedOtherFile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (settings->library.isexportedsuffix(tok->str(), qPropToken->str())) {
|
if (settings->library.isexportedsuffix(tok->str(), propToken->str())) {
|
||||||
const Token* qNextPropToken = qPropToken->previous();
|
const Token* prevPropToken = propToken->previous();
|
||||||
const std::string& value = qNextPropToken->str();
|
const std::string& value = prevPropToken->str();
|
||||||
if (value != ")" && _functions.find(value) != _functions.end()) {
|
if (value != ")" && _functions.find(value) != _functions.end()) {
|
||||||
_functions[value].usedOtherFile = true;
|
_functions[value].usedOtherFile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qPropToken = qPropToken->next();
|
propToken = propToken->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->library.markupFile(FileName)
|
if (settings->library.markupFile(FileName)
|
||||||
&& settings->library.isimporter(FileName, tok->str()) && tok->next()) {
|
&& settings->library.isimporter(FileName, tok->str()) && tok->next()) {
|
||||||
const Token * qPropToken = tok;
|
const Token * propToken = tok->next();
|
||||||
qPropToken = qPropToken->next();
|
if (propToken->next()) {
|
||||||
if (qPropToken->next()) {
|
propToken = propToken->next();
|
||||||
qPropToken = qPropToken->next();
|
while (propToken && propToken->str() != ")") {
|
||||||
while (qPropToken && qPropToken->str() != ")") {
|
const std::string& value = propToken->str();
|
||||||
const std::string& value = qPropToken->str();
|
|
||||||
if (!value.empty()) {
|
if (!value.empty()) {
|
||||||
_functions[value].usedOtherFile = true;
|
_functions[value].usedOtherFile = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qPropToken = qPropToken->next();
|
propToken = propToken->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->library.isreflection(tok->str())) {
|
if (settings->library.isreflection(tok->str())) {
|
||||||
const int index = settings->library.reflectionArgument(tok->str());
|
const int argIndex = settings->library.reflectionArgument(tok->str());
|
||||||
if (index >= 0) {
|
if (argIndex >= 0) {
|
||||||
const Token * funcToken = tok->next();
|
const Token * funcToken = tok->next();
|
||||||
int p = 0;
|
int index = 0;
|
||||||
std::string value;
|
std::string value;
|
||||||
while (funcToken) {
|
while (funcToken) {
|
||||||
if (funcToken->str()==",") {
|
if (funcToken->str()==",") {
|
||||||
if (++p==index)
|
if (++index == argIndex)
|
||||||
break;
|
break;
|
||||||
value = "";
|
value = "";
|
||||||
} else
|
} else
|
||||||
value += funcToken->str();
|
value += funcToken->str();
|
||||||
funcToken = funcToken->next();
|
funcToken = funcToken->next();
|
||||||
}
|
}
|
||||||
if (p==index) {
|
if (index == argIndex) {
|
||||||
value = value.substr(1, value.length() - 2);
|
value = value.substr(1, value.length() - 2);
|
||||||
_functions[value].usedOtherFile = true;
|
_functions[value].usedOtherFile = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue