Remove check for "this" inside Token class
The check hides real memory problems and is also useless in most cases.
This commit is contained in:
parent
5a35beebf7
commit
283c2e508e
10
lib/token.h
10
lib/token.h
|
@ -155,12 +155,9 @@ public:
|
||||||
_isNumber = number;
|
_isNumber = number;
|
||||||
}
|
}
|
||||||
bool isArithmeticalOp() const {
|
bool isArithmeticalOp() const {
|
||||||
return (this && (_str=="<<" || _str==">>" || (_str.size()==1 && _str.find_first_of("+-*/%") != std::string::npos)));
|
return (_str=="<<" || _str==">>" || (_str.size()==1 && _str.find_first_of("+-*/%") != std::string::npos));
|
||||||
}
|
}
|
||||||
bool isOp() const {
|
bool isOp() const {
|
||||||
if (!this)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (isArithmeticalOp() ||
|
return (isArithmeticalOp() ||
|
||||||
_str == "&&" ||
|
_str == "&&" ||
|
||||||
_str == "||" ||
|
_str == "||" ||
|
||||||
|
@ -174,12 +171,9 @@ public:
|
||||||
}
|
}
|
||||||
bool isExtendedOp() const {
|
bool isExtendedOp() const {
|
||||||
return isOp() ||
|
return isOp() ||
|
||||||
(this && _str.size() == 1 && _str.find_first_of(",[]()?:") != std::string::npos);
|
(_str.size() == 1 && _str.find_first_of(",[]()?:") != std::string::npos);
|
||||||
}
|
}
|
||||||
bool isAssignmentOp() const {
|
bool isAssignmentOp() const {
|
||||||
if (!this)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (_str == "=" ||
|
return (_str == "=" ||
|
||||||
_str == "+=" ||
|
_str == "+=" ||
|
||||||
_str == "-=" ||
|
_str == "-=" ||
|
||||||
|
|
Loading…
Reference in New Issue