Commit 55175c14 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixed scope completion after a template-id. For example, when completing std::list<int>::i...

parent 44f29afc
...@@ -46,6 +46,13 @@ ExpressionUnderCursor::~ExpressionUnderCursor() ...@@ -46,6 +46,13 @@ ExpressionUnderCursor::~ExpressionUnderCursor()
int ExpressionUnderCursor::startOfExpression(BackwardsScanner &tk, int index) int ExpressionUnderCursor::startOfExpression(BackwardsScanner &tk, int index)
{ {
if (tk[index - 1].is(T_GREATER)) {
const int matchingBraceIndex = tk.startOfMatchingBrace(index);
if (tk[matchingBraceIndex - 1].is(T_IDENTIFIER))
index = matchingBraceIndex - 1;
}
index = startOfExpression_helper(tk, index); index = startOfExpression_helper(tk, index);
if (_jumpedComma) { if (_jumpedComma) {
...@@ -148,11 +155,11 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in ...@@ -148,11 +155,11 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in
} }
return index - 1; return index - 1;
} else if (tk[index - 1].is(T_RPAREN)) { } else if (tk[index - 1].is(T_RPAREN)) {
int rparenIndex = tk.startOfMatchingBrace(index); int matchingBraceIndex = tk.startOfMatchingBrace(index);
if (rparenIndex != index) { if (matchingBraceIndex != index) {
if (tk[rparenIndex - 1].is(T_GREATER)) { if (tk[matchingBraceIndex - 1].is(T_GREATER)) {
int lessIndex = tk.startOfMatchingBrace(rparenIndex); int lessIndex = tk.startOfMatchingBrace(matchingBraceIndex);
if (lessIndex != rparenIndex - 1) { if (lessIndex != matchingBraceIndex - 1) {
if (tk[lessIndex - 1].is(T_DYNAMIC_CAST) || if (tk[lessIndex - 1].is(T_DYNAMIC_CAST) ||
tk[lessIndex - 1].is(T_STATIC_CAST) || tk[lessIndex - 1].is(T_STATIC_CAST) ||
tk[lessIndex - 1].is(T_CONST_CAST) || tk[lessIndex - 1].is(T_CONST_CAST) ||
...@@ -166,7 +173,7 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in ...@@ -166,7 +173,7 @@ int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int in
return startOfExpression(tk, lessIndex); return startOfExpression(tk, lessIndex);
} }
} }
return startOfExpression(tk, rparenIndex); return startOfExpression(tk, matchingBraceIndex);
} }
return index; return index;
} else if (tk[index - 1].is(T_RBRACKET)) { } else if (tk[index - 1].is(T_RBRACKET)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment