This commit is contained in:
Hackerpilot 2015-08-21 14:35:38 -07:00
parent 70c78a2a10
commit bb34e38d4f
10 changed files with 53 additions and 2 deletions

View File

@ -819,8 +819,11 @@ void setCompletions(T)(ref AutocompleteResponse response,
Scope* completionScope, T tokens, size_t cursorPosition,
CompletionType completionType, bool isBracket = false, string partial = null)
{
static void addSymToResponse(DSymbol* s, ref AutocompleteResponse r, string p)
static void addSymToResponse(DSymbol* s, ref AutocompleteResponse r, string p,
size_t[] circularGuard = [])
{
if (circularGuard.canFind(cast(size_t) s))
return;
foreach (sym; s.opSlice())
{
if (sym.name !is null && sym.name.length > 0 && sym.kind != CompletionKind.importSymbol
@ -831,7 +834,7 @@ void setCompletions(T)(ref AutocompleteResponse response,
r.completions ~= sym.name.dup;
}
if (sym.kind == CompletionKind.importSymbol && !sym.skipOver && sym.type !is null)
addSymToResponse(sym.type, r, p);
addSymToResponse(sym.type, r, p, circularGuard ~ (cast(size_t) s));
}
}

View File

@ -0,0 +1,5 @@
module circular.a;
public import circular.b;
int alpha;

View File

@ -0,0 +1,4 @@
module circular.b;
public import circular.a;
int bravo;

View File

@ -0,0 +1,4 @@
module circular.x;
public import circular.y;
int x_ray;

View File

@ -0,0 +1,4 @@
module circular.y;
public import circular.z;
int yankee;

View File

@ -0,0 +1,4 @@
module circular.z;
public import circular.x;
int zulu;

View File

@ -0,0 +1,3 @@
identifiers
alpha v
bravo v

View File

@ -0,0 +1,4 @@
identifiers
x_ray v
yankee v
zulu v

12
tests/tc018/file.d Normal file
View File

@ -0,0 +1,12 @@
import circular.a;
import circular.x;
unittest
{
circular.a.
}
unittest
{
circular.x.
}

8
tests/tc018/run.sh Executable file
View File

@ -0,0 +1,8 @@
set -e
set -u
../../bin/dcd-client file.d -c61 > actual1.txt
diff actual1.txt expected1.txt
../../bin/dcd-client file.d -c88 > actual2.txt
diff actual2.txt expected2.txt