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/server -name "*.d")\
|
||||
$(shell find dsymbol/src -name "*.d")\
|
||||
libdparse/src/std/d/ast.d\
|
||||
libdparse/src/std/d/entities.d\
|
||||
libdparse/src/std/d/lexer.d\
|
||||
libdparse/src/std/d/parser.d\
|
||||
libdparse/src/std/d/formatter.d\
|
||||
libdparse/src/std/lexer.d\
|
||||
libdparse/src/dparse/ast.d\
|
||||
libdparse/src/dparse/entities.d\
|
||||
libdparse/src/dparse/lexer.d\
|
||||
libdparse/src/dparse/parser.d\
|
||||
libdparse/src/dparse/formatter.d\
|
||||
libdparse/src/std/experimental/lexer.d\
|
||||
$(shell find containers/experimental_allocator/src/std/experimental/allocator/ -name "*.d")\
|
||||
containers/src/containers/dynamicarray.d\
|
||||
containers/src/containers/ttree.d\
|
||||
|
|
|
@ -32,9 +32,9 @@ import std.string;
|
|||
import std.typecons;
|
||||
import std.uni;
|
||||
|
||||
import std.d.ast;
|
||||
import std.d.lexer;
|
||||
import std.d.parser;
|
||||
import dparse.ast;
|
||||
import dparse.lexer;
|
||||
import dparse.parser;
|
||||
|
||||
import dsymbol.conversion;
|
||||
import dsymbol.modulecache;
|
||||
|
@ -635,6 +635,49 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response,
|
|||
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!"]";
|
||||
if (symbols[0].qualifier == SymbolQualifier.array)
|
||||
{
|
||||
auto h = i;
|
||||
skip();
|
||||
Parser p = new Parser();
|
||||
p.setTokens(tokens[h .. i].array());
|
||||
if (!p.isSliceExpression())
|
||||
if (!isSliceExpression(tokens, i))
|
||||
{
|
||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||
if (symbols.length == 0)
|
||||
|
@ -784,12 +824,9 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
|||
}
|
||||
else
|
||||
{
|
||||
auto h = i;
|
||||
skip();
|
||||
Parser p = new Parser();
|
||||
p.setTokens(tokens[h .. i].array());
|
||||
DSymbol*[] overloads;
|
||||
if (p.isSliceExpression())
|
||||
if (isSliceExpression(tokens, i))
|
||||
overloads = symbols[0].getPartsByName(internString("opSlice"));
|
||||
else
|
||||
overloads = symbols[0].getPartsByName(internString("opIndex"));
|
||||
|
|
Loading…
Reference in New Issue