Cache and reuse value
This commit is contained in:
parent
42b310e337
commit
8f21aba606
|
@ -6585,12 +6585,12 @@ bool Tokenizer::simplifyKnownVariablesGetData(unsigned int varid, Token **_tok2,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// no break => the value of the counter value is known after the for loop..
|
// no break => the value of the counter value is known after the for loop..
|
||||||
const std::string& compareop = tok2->strAt(5);
|
const Token* compareTok = tok2->tokAt(5);
|
||||||
if (compareop == "<") {
|
if (compareTok->str() == "<") {
|
||||||
value = tok2->strAt(6);
|
value = compareTok->next()->str();
|
||||||
valueVarId = tok2->tokAt(6)->varId();
|
valueVarId = compareTok->next()->varId();
|
||||||
} else
|
} else
|
||||||
value = MathLib::toString(MathLib::toLongNumber(tok2->strAt(6)) + 1);
|
value = MathLib::toString(MathLib::toLongNumber(compareTok->next()->str()) + 1);
|
||||||
|
|
||||||
// Skip for-body..
|
// Skip for-body..
|
||||||
tok3 = tok2->previous()->link()->next()->link()->next();
|
tok3 = tok2->previous()->link()->next()->link()->next();
|
||||||
|
|
Loading…
Reference in New Issue