prevent a range error, close #368
This commit is contained in:
parent
4998a3c441
commit
cb2074a152
|
@ -791,10 +791,14 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
||||||
//writeln("<<<");
|
//writeln("<<<");
|
||||||
//dumpTokens(tokens.release);
|
//dumpTokens(tokens.release);
|
||||||
//writeln("<<<");
|
//writeln("<<<");
|
||||||
|
if (tokens.length == 0) // workaround (#371)
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
else if (tokens[0] == tok!"." && tokens.length > 1)
|
else if (tokens[0] == tok!"." && tokens.length > 1)
|
||||||
{
|
{
|
||||||
tokens = tokens[1 .. $];
|
tokens = tokens[1 .. $];
|
||||||
|
if (tokens.length == 0) // workaround (#371)
|
||||||
|
return [];
|
||||||
symbols = completionScope.getSymbolsAtGlobalScope(stringToken(tokens[0]));
|
symbols = completionScope.getSymbolsAtGlobalScope(stringToken(tokens[0]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -802,8 +806,11 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
||||||
|
|
||||||
if (symbols.length == 0)
|
if (symbols.length == 0)
|
||||||
{
|
{
|
||||||
warning("Could not find declaration of ", stringToken(tokens[0]),
|
//TODO: better bugfix for issue #368, see test case 52 or pull #371
|
||||||
" from position ", cursorPosition);
|
if (tokens.length)
|
||||||
|
warning("Could not find declaration of ", stringToken(tokens[0]),
|
||||||
|
" from position ", cursorPosition);
|
||||||
|
else assert(0, "internal error");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
void main(){assert(te.caretRightText == "tà");}
|
|
@ -0,0 +1,4 @@
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -c46 -d
|
Loading…
Reference in New Issue