Skip to content

Commit ed64ca6

Browse files
committed
Token: only look up control-flow keywords in update_property_info() if necessary
1 parent d551564 commit ed64ca6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/token.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static const std::unordered_set<std::string> controlFlowKeywords = {
107107

108108
void Token::update_property_info()
109109
{
110-
setFlag(fIsControlFlowKeyword, controlFlowKeywords.find(mStr) != controlFlowKeywords.end());
110+
setFlag(fIsControlFlowKeyword, false);
111111
// TODO: clear fIsLong
112112
isStandardType(false);
113113

@@ -125,8 +125,13 @@ void Token::update_property_info()
125125
else if (std::isalpha((unsigned char)mStr[0]) || mStr[0] == '_' || mStr[0] == '$') { // Name
126126
if (mImpl->mVarId)
127127
tokType(eVariable);
128-
else if (mTokensFrontBack.list.isKeyword(mStr) || mStr == "asm") // TODO: not a keyword
128+
else if (mTokensFrontBack.list.isKeyword(mStr)) {
129129
tokType(eKeyword);
130+
setFlag(fIsControlFlowKeyword, controlFlowKeywords.find(mStr) != controlFlowKeywords.end());
131+
}
132+
else if (mStr == "asm") { // TODO: not a keyword
133+
tokType(eKeyword);
134+
}
130135
else if (mTokType != eVariable && mTokType != eFunction && mTokType != eType && mTokType != eKeyword)
131136
tokType(eName);
132137
} else if (simplecpp::Token::isNumberLike(mStr)) {

0 commit comments

Comments
 (0)