forked from mirror/openmw-tes3mp
Removal of unnecessary variable.
empty variable duplicates empty() method of std::string. Check for empty value should be replaced by assert since it does not makes much sense to call scanInt with null character.
This commit is contained in:
parent
eb8afa5d35
commit
d5689730eb
1 changed files with 5 additions and 4 deletions
|
@ -164,9 +164,7 @@ namespace Compiler
|
||||||
bool Scanner::scanInt (char c, Parser& parser, bool& cont)
|
bool Scanner::scanInt (char c, Parser& parser, bool& cont)
|
||||||
{
|
{
|
||||||
std::string value;
|
std::string value;
|
||||||
|
|
||||||
value += c;
|
value += c;
|
||||||
bool empty = false;
|
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
|
@ -175,7 +173,6 @@ namespace Compiler
|
||||||
if (std::isdigit (c))
|
if (std::isdigit (c))
|
||||||
{
|
{
|
||||||
value += c;
|
value += c;
|
||||||
empty = false;
|
|
||||||
}
|
}
|
||||||
else if (std::isalpha (c) || c=='_')
|
else if (std::isalpha (c) || c=='_')
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -190,7 +187,11 @@ namespace Compiler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty || error)
|
/*
|
||||||
|
* value could be empty only if scanInt is called with c == '\0'.
|
||||||
|
* That is unlikely so it should be replaced by assertion.
|
||||||
|
*/
|
||||||
|
if (value.empty() || error)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TokenLoc loc (mLoc);
|
TokenLoc loc (mLoc);
|
||||||
|
|
Loading…
Reference in a new issue