Skip to content

Commit c485ac4

Browse files
committed
Token: only look up standard types in update_property_info() if necessary
1 parent 9480f96 commit c485ac4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/token.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,18 @@ void Token::update_property_info()
127127
tokType(eVariable);
128128
else if (mTokensFrontBack.list.isKeyword(mStr)) {
129129
tokType(eKeyword);
130+
update_property_isStandardType();
130131
setFlag(fIsControlFlowKeyword, controlFlowKeywords.find(mStr) != controlFlowKeywords.end());
131132
}
132133
else if (mStr == "asm") { // TODO: not a keyword
133134
tokType(eKeyword);
134135
}
135136
// TODO: remove condition? appears to be (no longer necessary) protection for reset of varids in Tokenizer::setVarId()
136-
else if (mTokType != eVariable && mTokType != eFunction && mTokType != eType && mTokType != eKeyword)
137+
else if (mTokType != eVariable && mTokType != eFunction && mTokType != eType && mTokType != eKeyword) {
137138
tokType(eName);
139+
// some types are not being treated as keywords
140+
update_property_isStandardType();
141+
}
138142
} else if (simplecpp::Token::isNumberLike(mStr)) {
139143
if ((MathLib::isInt(mStr) || MathLib::isFloat(mStr)) && mStr.find('_') == std::string::npos)
140144
tokType(eNumber);
@@ -175,8 +179,6 @@ void Token::update_property_info()
175179
tokType(eEllipsis);
176180
else
177181
tokType(eOther);
178-
179-
update_property_isStandardType();
180182
} else {
181183
tokType(eNone);
182184
}

0 commit comments

Comments
 (0)