Update code for new dependencies
This commit is contained in:
parent
601f1ea87f
commit
9681bacb40
12
makefile
12
makefile
|
@ -60,12 +60,12 @@ SERVER_SRC := \
|
||||||
$(shell find src/common -name "*.d")\
|
$(shell find src/common -name "*.d")\
|
||||||
$(shell find src/server -name "*.d")\
|
$(shell find src/server -name "*.d")\
|
||||||
$(shell find dsymbol/src -name "*.d")\
|
$(shell find dsymbol/src -name "*.d")\
|
||||||
libdparse/src/std/d/ast.d\
|
libdparse/src/dparse/ast.d\
|
||||||
libdparse/src/std/d/entities.d\
|
libdparse/src/dparse/entities.d\
|
||||||
libdparse/src/std/d/lexer.d\
|
libdparse/src/dparse/lexer.d\
|
||||||
libdparse/src/std/d/parser.d\
|
libdparse/src/dparse/parser.d\
|
||||||
libdparse/src/std/d/formatter.d\
|
libdparse/src/dparse/formatter.d\
|
||||||
libdparse/src/std/lexer.d\
|
libdparse/src/std/experimental/lexer.d\
|
||||||
$(shell find containers/experimental_allocator/src/std/experimental/allocator/ -name "*.d")\
|
$(shell find containers/experimental_allocator/src/std/experimental/allocator/ -name "*.d")\
|
||||||
containers/src/containers/dynamicarray.d\
|
containers/src/containers/dynamicarray.d\
|
||||||
containers/src/containers/ttree.d\
|
containers/src/containers/ttree.d\
|
||||||
|
|
|
@ -32,9 +32,9 @@ import std.string;
|
||||||
import std.typecons;
|
import std.typecons;
|
||||||
import std.uni;
|
import std.uni;
|
||||||
|
|
||||||
import std.d.ast;
|
import dparse.ast;
|
||||||
import std.d.lexer;
|
import dparse.lexer;
|
||||||
import std.d.parser;
|
import dparse.parser;
|
||||||
|
|
||||||
import dsymbol.conversion;
|
import dsymbol.conversion;
|
||||||
import dsymbol.modulecache;
|
import dsymbol.modulecache;
|
||||||
|
@ -635,6 +635,49 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response,
|
||||||
warning("Could not find ", moduleParts);
|
warning("Could not find ", moduleParts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void skip(alias O, alias C, T)(T t, ref size_t i)
|
||||||
|
{
|
||||||
|
int depth = 1;
|
||||||
|
while (i < t.length) switch (t[i].type)
|
||||||
|
{
|
||||||
|
case O:
|
||||||
|
i++;
|
||||||
|
depth++;
|
||||||
|
break;
|
||||||
|
case C:
|
||||||
|
i++;
|
||||||
|
depth--;
|
||||||
|
if (depth <= 0)
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isSliceExpression(T)(T tokens, size_t index)
|
||||||
|
{
|
||||||
|
while (index < tokens.length) switch (tokens[index].type)
|
||||||
|
{
|
||||||
|
case tok!"[":
|
||||||
|
skip!(tok!"[", tok!"]")(tokens, index);
|
||||||
|
break;
|
||||||
|
case tok!"(":
|
||||||
|
skip!(tok!"(", tok!")")(tokens, index);
|
||||||
|
break;
|
||||||
|
case tok!"]":
|
||||||
|
case tok!"}":
|
||||||
|
return false;
|
||||||
|
case tok!"..":
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
index++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -766,11 +809,8 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
||||||
close = tok!"]";
|
close = tok!"]";
|
||||||
if (symbols[0].qualifier == SymbolQualifier.array)
|
if (symbols[0].qualifier == SymbolQualifier.array)
|
||||||
{
|
{
|
||||||
auto h = i;
|
|
||||||
skip();
|
skip();
|
||||||
Parser p = new Parser();
|
if (!isSliceExpression(tokens, i))
|
||||||
p.setTokens(tokens[h .. i].array());
|
|
||||||
if (!p.isSliceExpression())
|
|
||||||
{
|
{
|
||||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||||
if (symbols.length == 0)
|
if (symbols.length == 0)
|
||||||
|
@ -784,12 +824,9 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto h = i;
|
|
||||||
skip();
|
skip();
|
||||||
Parser p = new Parser();
|
|
||||||
p.setTokens(tokens[h .. i].array());
|
|
||||||
DSymbol*[] overloads;
|
DSymbol*[] overloads;
|
||||||
if (p.isSliceExpression())
|
if (isSliceExpression(tokens, i))
|
||||||
overloads = symbols[0].getPartsByName(internString("opSlice"));
|
overloads = symbols[0].getPartsByName(internString("opSlice"));
|
||||||
else
|
else
|
||||||
overloads = symbols[0].getPartsByName(internString("opIndex"));
|
overloads = symbols[0].getPartsByName(internString("opIndex"));
|
||||||
|
|
Loading…
Reference in New Issue