Skip to content
Snippets Groups Projects
Commit a2ded1e8 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Added boundary check.

parent 933ef8cf
No related branches found
No related tags found
No related merge requests found
...@@ -147,11 +147,13 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in ...@@ -147,11 +147,13 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in
--i; --i;
} }
int j = i; if (i >= 0) {
while (tk[j].is(T_LBRACKET)) int j = i;
++j; while (tk[j].is(T_LBRACKET))
if (tk[j].is(T_IDENTIFIER) && tk[j + 1].is(T_IDENTIFIER)) ++j;
return i; if (tk[j].is(T_IDENTIFIER) && tk[j + 1].is(T_IDENTIFIER))
return i;
}
} }
return index - 1; return index - 1;
} else if (tk[index - 1].is(T_RPAREN)) { } else if (tk[index - 1].is(T_RPAREN)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment