Skip to content

Commit

Permalink
Fix #177
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Jan 4, 2015
1 parent 0f2ffbd commit a422d7f
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions src/autocomplete.d
Original file line number Diff line number Diff line change
Expand Up @@ -918,20 +918,7 @@ body
*/
T getExpression(T)(T beforeTokens)
{
if (beforeTokens.length == 0)
return beforeTokens[0 .. 0];
size_t i = beforeTokens.length - 1;
size_t sliceEnd = beforeTokens.length;
IdType open;
IdType close;
uint skipCount = 0;

expressionLoop: while (true)
{
switch (beforeTokens[i].type)
{
case tok!"import":
break expressionLoop;
enum TYPE_IDENT_AND_LITERAL_CASES = q{
case tok!"int":
case tok!"uint":
case tok!"long":
Expand Down Expand Up @@ -960,6 +947,31 @@ T getExpression(T)(T beforeTokens)
case tok!"stringLiteral":
case tok!"wstringLiteral":
case tok!"dstringLiteral":
};

if (beforeTokens.length == 0)
return beforeTokens[0 .. 0];
size_t i = beforeTokens.length - 1;
size_t sliceEnd = beforeTokens.length;
IdType open;
IdType close;
uint skipCount = 0;

expressionLoop: while (true)
{
switch (beforeTokens[i].type)
{
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;
}
if (i > 0 && beforeTokens[i - 1] == tok!"!")
{
sliceEnd -= 2;
Expand Down

0 comments on commit a422d7f

Please sign in to comment.