Skip to content

Commit

Permalink
More complete fix for #177
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Jan 4, 2015
1 parent 30b586c commit 9bc6555
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/autocomplete.d
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,17 @@ T getExpression(T)(T beforeTokens)
case tok!"dstringLiteral":
};

enum EXPRESSION_LOOP_BREAK = q{
if (i + 1 < beforeTokens.length) switch (beforeTokens[i + 1].type)
{
mixin (TYPE_IDENT_AND_LITERAL_CASES);
i++;
break expressionLoop;
default:
break;
}
};

if (beforeTokens.length == 0)
return beforeTokens[0 .. 0];
size_t i = beforeTokens.length - 1;
Expand All @@ -964,14 +975,7 @@ T getExpression(T)(T beforeTokens)
case tok!"import":
break expressionLoop;
mixin (TYPE_IDENT_AND_LITERAL_CASES);
if (i + 1 < beforeTokens.length) switch (beforeTokens[i + 1].type)
{
mixin (TYPE_IDENT_AND_LITERAL_CASES);
i++;
break expressionLoop;
default:
break;
}
mixin (EXPRESSION_LOOP_BREAK);
if (i > 0 && beforeTokens[i - 1] == tok!"!")
{
sliceEnd -= 2;
Expand All @@ -988,6 +992,7 @@ T getExpression(T)(T beforeTokens)
open = tok!"]";
close = tok!"[";
skip:
mixin (EXPRESSION_LOOP_BREAK);
auto bookmark = i;
int depth = 1;
do
Expand Down

0 comments on commit 9bc6555

Please sign in to comment.