refactor test for operator
This commit is contained in:
parent
b246e3d145
commit
f04c7c0221
|
@ -1631,6 +1631,7 @@ bool CppParser::checkForKeyword(KeywordType& keywordType)
|
|||
case KeywordType::None:
|
||||
case KeywordType::NotKeyword:
|
||||
case KeywordType::DeclType:
|
||||
case KeywordType::Operator:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
@ -1753,13 +1754,12 @@ bool CppParser::checkForTypedefStruct()
|
|||
bool CppParser::checkForUsing(KeywordType keywordType)
|
||||
{
|
||||
return keywordType==KeywordType::Using && (mIndex < mTokenizer.tokenCount()-1);
|
||||
|
||||
}
|
||||
|
||||
void CppParser::checkAndHandleMethodOrVar(KeywordType keywordType)
|
||||
{
|
||||
if (mIndex+2>=mTokenizer.tokenCount()) {
|
||||
mIndex+=2; // left's finish;
|
||||
mIndex+=2; // let's finish;
|
||||
return;
|
||||
}
|
||||
QString currentText=mTokenizer[mIndex]->text;
|
||||
|
@ -1773,7 +1773,7 @@ void CppParser::checkAndHandleMethodOrVar(KeywordType keywordType)
|
|||
mIndex+=2;
|
||||
}
|
||||
} else {
|
||||
if (currentText=="operator") {
|
||||
if (keywordType == KeywordType::Operator) {
|
||||
handleOperatorOverloading("",
|
||||
mIndex,
|
||||
false);
|
||||
|
|
|
@ -184,8 +184,9 @@ void initParser()
|
|||
CppKeywords.insert("const",KeywordType::None);
|
||||
CppKeywords.insert("extern",KeywordType::None);
|
||||
|
||||
CppKeywords.insert("operator",KeywordType::Operator);
|
||||
|
||||
// handled elsewhere
|
||||
CppKeywords.insert("operator",KeywordType::None);
|
||||
CppKeywords.insert("static",KeywordType::None);
|
||||
|
||||
//struct/class/union
|
||||
|
|
|
@ -76,6 +76,7 @@ enum class KeywordType {
|
|||
Typedef, //typedef
|
||||
Using, //using
|
||||
DeclType, // decltype
|
||||
Operator, //operator
|
||||
None, // It's a keyword but don't process here
|
||||
NotKeyword
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue