diff --git a/lib/token.h b/lib/token.h index 298933937..653b9728b 100644 --- a/lib/token.h +++ b/lib/token.h @@ -492,10 +492,12 @@ public: } void varId(unsigned int id) { _varId = id; - if (id != 0) + if (id != 0) { _tokType = eVariable; - else + isStandardType(false); + } else { update_property_info(); + } } /** diff --git a/test/testtoken.cpp b/test/testtoken.cpp index 34ae0f9c6..fe049dafe 100644 --- a/test/testtoken.cpp +++ b/test/testtoken.cpp @@ -830,6 +830,12 @@ private: // Change back to standard type tok.str("int"); ASSERT_EQUALS(true, tok.isStandardType()); + + // token can't be both type and variable + tok.str("abc"); + tok.isStandardType(true); + tok.varId(123); + ASSERT_EQUALS(false, tok.isStandardType()); } void updateProperties() const {