fix #584 - crash when completing and if the previous expression is negated merged-on-behalf-of: Basile-z <Basile-z@users.noreply.github.com>
This commit is contained in:
parent
8a7a6c75ac
commit
cb0e49bc36
|
@ -189,9 +189,12 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
||||||
{
|
{
|
||||||
size_t j;
|
size_t j;
|
||||||
tokens.skipParen(j, tok!"(", tok!")");
|
tokens.skipParen(j, tok!"(", tok!")");
|
||||||
|
if (j > 1)
|
||||||
|
{
|
||||||
symbols = getSymbolsByTokenChain(completionScope, tokens[1 .. j],
|
symbols = getSymbolsByTokenChain(completionScope, tokens[1 .. j],
|
||||||
cursorPosition, completionType);
|
cursorPosition, completionType);
|
||||||
tokens = tokens[j + 1 .. $];
|
tokens = tokens[j + 1 .. $];
|
||||||
|
}
|
||||||
//writeln("<<<");
|
//writeln("<<<");
|
||||||
//dumpTokens(tokens.release);
|
//dumpTokens(tokens.release);
|
||||||
//writeln("<<<");
|
//writeln("<<<");
|
||||||
|
@ -514,12 +517,14 @@ T getExpression(T)(T beforeTokens)
|
||||||
i = bookmark + 1;
|
i = bookmark + 1;
|
||||||
break expressionLoop;
|
break expressionLoop;
|
||||||
case tok!"!":
|
case tok!"!":
|
||||||
if (skipCount == 1)
|
// only break if the bang is for a template instance
|
||||||
|
if (i - 2 >= 0 && beforeTokens[i - 2].type == tok!"identifier" && skipCount == 1)
|
||||||
{
|
{
|
||||||
sliceEnd = i - 1;
|
sliceEnd = i - 1;
|
||||||
i -= 2;
|
i -= 2;
|
||||||
}
|
|
||||||
break expressionLoop;
|
break expressionLoop;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
identifiers
|
||||||
|
alignof k
|
||||||
|
init k
|
||||||
|
mangleof k
|
||||||
|
max k
|
||||||
|
min k
|
||||||
|
sizeof k
|
||||||
|
stringof k
|
|
@ -0,0 +1,9 @@
|
||||||
|
identifiers
|
||||||
|
T h
|
||||||
|
alignof k
|
||||||
|
i v
|
||||||
|
init k
|
||||||
|
mangleof k
|
||||||
|
sizeof k
|
||||||
|
stringof k
|
||||||
|
tupleof k
|
|
@ -0,0 +1,7 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
char[][] a;
|
||||||
|
if (!(a[0][0]). ){}
|
||||||
|
template Foo(T) { int i;}
|
||||||
|
if (Foo!(int). ){}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -c49 > actual1.txt
|
||||||
|
diff actual1.txt expected1.txt
|
||||||
|
../../bin/dcd-client $1 file.d -c103 > actual2.txt
|
||||||
|
diff actual2.txt expected2.txt
|
Loading…
Reference in New Issue