endless loop when tokens do not represent a lambda

Fixes the endless loop when traversing the callstack
while debugging and the tokens do not represent a lamda.

for example:

 `return Class{}(var);`

Change-Id: I2c4dbf9df24046158147a04347aa435a7ccd02bc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jasmin Fazlic
2021-07-30 16:16:48 +02:00
committed by fassl
parent c116b25709
commit ec013afe00

View File

@@ -183,6 +183,7 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in
int leftParenIndex = tk.startOfMatchingBrace(currentIndex); int leftParenIndex = tk.startOfMatchingBrace(currentIndex);
if (tk[leftParenIndex-1].is(T_THROW)) { if (tk[leftParenIndex-1].is(T_THROW)) {
currentIndex = leftParenIndex-1; currentIndex = leftParenIndex-1;
continue;
} else if (tk[leftParenIndex-1].is(T_RBRACKET)) { } else if (tk[leftParenIndex-1].is(T_RBRACKET)) {
int leftBracketIndex = tk.startOfMatchingBrace(leftParenIndex); int leftBracketIndex = tk.startOfMatchingBrace(leftParenIndex);
if (leftBracketIndex != leftParenIndex-1) if (leftBracketIndex != leftParenIndex-1)
@@ -192,9 +193,8 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in
int leftBracketIndex = tk.startOfMatchingBrace(currentIndex); int leftBracketIndex = tk.startOfMatchingBrace(currentIndex);
if (leftBracketIndex != currentIndex-1) if (leftBracketIndex != currentIndex-1)
return leftBracketIndex; return leftBracketIndex;
} else {
--currentIndex;
} }
--currentIndex;
} }
} }
} }