forked from qt-creator/qt-creator
CppEditor: Fix always-false-condition
The condition didn't make sense. tk.kind() can't be < T_FIRST_QT_KEYWORD *and* tk.kind() > T_LAST_KEYWORD at the same time. Change-Id: Id300ad84f37eeff5081b0389c00d574a9cb23f35 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
10
src/libs/3rdparty/cplusplus/Token.h
vendored
10
src/libs/3rdparty/cplusplus/Token.h
vendored
@@ -227,9 +227,8 @@ enum Kind {
|
||||
T_WCHAR_T,
|
||||
T_LAST_PRIMITIVE = T_WCHAR_T,
|
||||
|
||||
T_FIRST_QT_KEYWORD,
|
||||
|
||||
// Qt keywords
|
||||
T_FIRST_QT_KEYWORD,
|
||||
T_EMIT = T_FIRST_QT_KEYWORD,
|
||||
T_SIGNAL,
|
||||
T_SLOT,
|
||||
@@ -251,8 +250,8 @@ enum Kind {
|
||||
T_Q_DECLARE_INTERFACE,
|
||||
T_Q_OBJECT,
|
||||
T_Q_GADGET,
|
||||
|
||||
T_LAST_KEYWORD = T_Q_GADGET,
|
||||
T_LAST_QT_KEYWORD = T_Q_GADGET,
|
||||
T_LAST_KEYWORD = T_LAST_QT_KEYWORD,
|
||||
|
||||
// aliases
|
||||
T_OR = T_PIPE_PIPE,
|
||||
@@ -330,6 +329,9 @@ public:
|
||||
inline bool isPrimitiveType() const
|
||||
{ return f.kind >= T_FIRST_PRIMITIVE && f.kind <= T_LAST_PRIMITIVE; }
|
||||
|
||||
inline bool isQtKeyword() const
|
||||
{ return f.kind >= T_FIRST_QT_KEYWORD && f.kind <= T_LAST_QT_KEYWORD; }
|
||||
|
||||
inline bool isComment() const
|
||||
{ return f.kind == T_COMMENT || f.kind == T_DOXY_COMMENT ||
|
||||
f.kind == T_CPP_COMMENT || f.kind == T_CPP_DOXY_COMMENT; }
|
||||
|
@@ -581,7 +581,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
}
|
||||
}
|
||||
|
||||
if (tk.isNot(T_IDENTIFIER) && tk.kind() < T_FIRST_QT_KEYWORD && tk.kind() > T_LAST_KEYWORD)
|
||||
if (tk.isNot(T_IDENTIFIER) && !tk.isQtKeyword())
|
||||
return link;
|
||||
|
||||
tc.setPosition(endOfToken);
|
||||
|
Reference in New Issue
Block a user